gcc -ffunction-sections -Wl,--gc-sections

Jan Kratochvil jan.kratochvil at redhat.com
Thu Mar 24 16:40:34 UTC 2011


On Thu, 24 Mar 2011 17:06:09 +0100, Adam Jackson wrote:
> For example, if I'm the X server, I have a bunch of symbols exported
> from the binary that the drivers are expected to call, but that are
> never called from the server itself.  Does marking a function
> __attribute__((visibility("default"))) mark it as used from the garbage
> collector's perspective?

It does not:

__attribute__((visibility("default"))) void f (void) {}
int main (void) { return 0; }

gcc -ffunction-sections -Wl,--gc-sections -fvisibility=hidden -o sect sect.c -Wall -rdynamic
nm --dynamic sect
0000000000000000 a f

(and neither with -Wl,--dynamic-list=...)

OK, so not applicable as is, thanks for the hint for more investigations.


Thanks,
Jan


More information about the devel mailing list