This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[GOLD] common symbol resolution
- From: Jack Carter <jcarter at mips dot com>
- To: <binutils at sourceware dot org>
- Date: Fri, 11 May 2012 17:37:53 -0700
- Subject: [GOLD] common symbol resolution
I am running the Mips build of the gold linker on the "Common symbol
override" test.
For the scenario when the .o has a COMMON symbol and the shared object
it is linked against has the symbol defined. I believe the a.out is
suppose to have the symbol as an UNDEF.
See http://www.scribd.com/doc/89505704/19/Symbol-Resolution #9
It looks to me that the gold linker is set up to either override the
target symbols attribute or keep it what it was. My output has the
symbol in the a.out becoming a DEF.
Is there a clean and easy way to just modify the output symbol
attributes by hand.
reloc.cc:Symbol_table::resolve(...)
calls
reloc.cc: Symbol_table::should_override(...)
case WEAK_DEF * 16 + COMMON:
case DYN_DEF * 16 + COMMON:
case DYN_WEAK_DEF * 16 + COMMON:
// A common symbol does override a weak definition or a dynamic
// definition.
return true;
and then calls
this->override(...)
My first attempt to fix this was to hack Symbol_table::override(). That
got ugly quickly and I still wasn't changing the output attributes of
the symbol.
Is there an elegant method for modifying target symbol attributes or
should I just plow ahead.
Thanks,
Jack
ld/../gas/as-new -o
tmpdir/comm-data2.o /home/jcarter/workarea/gold/gold/src/ld/testsuite/ld-elf/comm-data2.s
ld/ld-new -o tmpdir/comm-data
-L/home/jcarter/workarea/gold/gold/src/ld/testsuite/ld-elf -Ltmpdir
-lcomm-data