I would say that C (and GCC specifically) is the most commonly used compiler for this purpose.
Most modern compilers no longer support segmented 16-bit ones, and none of them are very good at resolving restrictions such as βthis code must match 512 bytesβ or handling things like processor mode switches and unusual situations. For these reasons, people who write their own boot loaders for the "PC BIOS" (as opposed to using something like GRUB) tend to use assembly dialects (NASM, FASM, GAS).
This does not mean that other languages ββ(and other compilers) cannot be used; and I saw how people write kernels in a wide variety of languages ββ(Pascal, C ++, C #, etc.). It is also limited to low-level code (for example, boot code and kernel). Once you go beyond that, you can use almost everything for the higher parts (drivers, file systems, GUI, applications). There are also some people who invent their own languages ββfor use in the kernel and / or higher parts of the OS.
I have an opinion on alternative, but possibly excellent languages. My opinion is that "potentially superior" does not justify the high costs of the Tower of Babel (where most programmers cannot read most of the source code due to language differences), that the existence of many different languages ββis connected with the IT industry as a whole. For an OS project, an alternative language may have theoretical advantages, but in practice, these advantages are outweighed by the lack of a reduction in the number of people who are familiar with the language and can voluntarily help (either when you get stuck or need help with an error, etc. , or later, when you need volunteers to contribute thousands of drivers).
I use a simple old assembler (for boot code, kernel code, drivers, etc.). I do not recommend it; if you are much more experienced in collecting than any other language, and you have other reasons not to use a higher level language, and portability will not be a problem.
I would most likely recommend GCC (as free and open source code for compiling most of the various / separate binaries that make up the OS project). However, I also recommend avoiding the use of non-standard language extensions and any implementation-specific behavior (no matter which language and which compiler you use), so that you can switch to any other compiler at any time (for any mind) easier .