Brian Dessent wrote:
This testcase may not be actually showing you what you want. You have
to balance the extra overhead of having a section for each function
against the savings, and in this case the function being removed is
completely trivial. When you're looking at a 2800 byte ELF file the
noise (headers, padding, etc) is going to overwhelm everything. Try a
more realistic testcase.
Well, that was a trivial testcase, as you said. In real life I have a
lot of .c files with generic functions, but not all of them are used by
all binaries I build. So I search for a way to clean out unused
functions between modules, if possible.
The --gc-sections trick was found after some search, I found also a "set
inline function size to 0 and enable inlining" hint (on RedHat lists, if
I remember correctly) but none of them works.