Re:Everything You Never Wanted to Know About Linker Script (...
by klodolph on Saturday November 30, 2024 @08:42AM
(#42281566)
Plenty of assembly files do not use the C preprocessor. It turns out that assemblers have their own macro system.
[ Parent
| on HN ]
Re:Everything You Never Wanted to Know About Linker Script (...
by khrbtxyz on Saturday November 30, 2024 @12:01PM
(#42282582)
Large projects like the Linux kernel, which are mostly C, use the preprocessor in .S files quite heavily.
Linux has hardly any .s files.
~/linux$ find . -name '*.s'
./arch/x86/kernel/asm-offsets.s
./kernel/bounds.s
./scripts/mod/devicetable-offsets.s
But there are plenty of .S files with #includes ~/linux$ $ find . -name '*.S' | xargs grep '#include' | sed 's,:.*,,' | sort -u | wc -l
1217
Re:Everything You Never Wanted to Know About Linker Script (...
by ninkendo on Saturday November 30, 2024 @12:25PM
(#42282772)
FYI, `grep -l` will print just the matching filenames, no need for the sed/sort -u. `git grep` and `rg` also support this option. (I say this because I also used to overcomplicate this in my typical usage.)