(no title)
moefh | 2 months ago
It can't do that because the program might load a dynamic library that depends on the function (it's perfectly OK for a `.so` to depend on a function from the main executable, for example).
That's one of the reasons why a very cheap optimization is to always use `static` for functions when you can. You're telling the compiler that the function doesn't need to be visible outside the current compilation unit, so the compiler is free to even inline it completely and never produce an actual callable function, if appropriate.
bruce343434|2 months ago
I get it though, because carefully structuring your #includes to get a single translation unit is messy, and compile times get too long.
cyco130|2 months ago
1718627440|2 months ago
gpderetta|2 months ago
sureglymop|2 months ago
That makes perfect sense, thank you!
And I just realized why I was mistaken. I am using fasm with `format ELF64 executable` to create a ELF file. Looking at it with a hex editor, it has no sections or symbol table because it creates a completely stripped binary.
Learned something :)