This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, Gold garbage collection does not do the right thing with this program: foobar.cc -------------- extern "C" int bar() { return 144; } extern "C" int foo() { return 121; } sym.ver (version_script) ----------- { global: foo; local: bar; }; $ g++ -fPIC -shared -Wl,--gc-sections foobar.cc -o foobar.so -Wl,--version-script,sym.ver $ nm foobar.so | grep bar 00000000000066a t bar Function bar is not garbage collected even though it is local. This simple patch fixes it. * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Check if symbol is not forced local before marking it as referenced. (Symbol_table::add_from_relobj): Mark symbol as referenced only after checking if they cannot be forced local. Ok to submit? Thanks, -Sri.
Attachment:
gc_version_script.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |