Re:Chrome Binary Size
by caf on Tuesday September 21, 2010 @01:13AM
(#1711555)
It's possible to define symbols in header files (for example, inline functions).
[ Parent
| on HN ]
I thought the way the C preprocessor worked, those ended up getting literally copy and pasted into the .c file that #include'd them, and should be indistinguishable from the case where you wrote them directly in the .c file? Or does gcc keep track of where #include'd files came from, and write that info into the binary?
Yes, otherwise you'd never find syntax errors in the header files.
But that's during the compilation phase - this is the compiled binary. Binaries that are compiled with debugging information turned on will include this information for a similar reason: so that when you're debugging a program, or when it breaks, you can map that to places in your source file.
Right - and `nm` uses the debugging information to identify the file:line where each symbol was defined. The original scripts used to generate the treemap use `nm`.