send2vinnie / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

Archive reader not pulling in right member to override commons #175

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
cat > 1.c << \!
short common;
int val() { return common; }
!

cat > 2.c << \!
int common = 10;
int fn() { return val(); }
!

cat > 3.c << \!
extern int common;
static int val() { return common; }
!

clang -c 1.c 2.c 3.c
rm -f lib2.a lib3.a
ar cr lib2.a 2.o
ar cr lib3.a 3.o
ld.mcld 1.o lib2.a lib3.a -t

What is the expected output? What do you see instead?
The above link will not pull in the defined symbol common from lib2.a to 
override the common symbol that is in the NamePool.

As per other mature linkers such as GNU linker, if the symbol in the archive 
was a common (either small or larger than the one in NamePool) symbol, it will 
not pull in to coalesce them.

Original issue reported on code.google.com by khem...@codeaurora.org on 14 Aug 2014 at 4:32

GoogleCodeExporter commented 9 years ago

Original comment by mysekki on 15 Aug 2014 at 8:23

GoogleCodeExporter commented 9 years ago

Original comment by mysekki on 15 Aug 2014 at 8:24