Re:Exploring GNU extensions in the Linux kernel
by jcalvinowens on Monday May 13, 2024 @12:42PM
(#40345242)
Clang supports the extensions, you can build the Linux kernel with clang today:
make -s LLVM=1
Re:Exploring GNU extensions in the Linux kernel
by e63f67dd-065b on Monday May 13, 2024 @11:50PM
(#40351468)
As sibling mentioned, you can build the kernel with clang today. `make CC=clang`, and for whatever reason I've found that it produces code that's significantly more pleasant to step through under a debugger than gcc.
If anybody has an explanation for this I'd love to hear it.
Re:Exploring GNU extensions in the Linux kernel
by MaskRay on Tuesday May 14, 2024 @12:07AM
(#40351516)
Interesting.
Traditionally, Clang's -O1 and higher optimizations have been considered less debuggable than GCC's.
Sony developers have proposed changes to improve the debugging experience and some work has been done, e.g. https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-ne...
* change representation to help make -g not change codegen : https://discourse.llvm.org/t/rfc-debuginfo-proposed-changes-...
For example, Linux kernel use local labels, inline assembly and builtin functions heavily.
This article inspires me to persist studying in Linux kernel and Clang compiler.