Hacker News new | past | comments | ask | show | jobs | submit login

Yes, that's true... but often, visible symbols don't have enough information to get deduplicated anyway. Often, the symbol is just an address within a section in the object file. The section contains other code, and you can't remove things from it... by default, on most systems.

E.g. if you have file.o, the linker will see something like this:

    section .text: [...16kb of data follows...]
    section .data: [...2kb of data follows...]

    my_function = .text + 0x1f3a
This is simplified, but it just illustrates the core of what an object file looks like during linking.

It's just not enough information to go on, if you want to deduplicate a function. C runs on weird embedded systems. You might think, "Just use LTO" and well, those weird systems don't always have LTO. You might think, "If you care about code size, don't use inline functions!" and well, sometimes, inlining a function results in smaller code!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: