https://sourceware.org/bugzilla/show_bug.cgi?id=23079

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Gold works only because it treats COMMON symbol like definition:

[hjl@gnu-tools-1 nolto]$ cat main.c
#include <stdio.h>

int igt_subtest_jmpbuf;
int main ()
{
  printf ("igt_subtest_jmpbuf: %d\n", igt_subtest_jmpbuf);
  return 0;
}
[hjl@gnu-tools-1 nolto]$ cat x.i
int igt_subtest_jmpbuf = -1;
[hjl@gnu-tools-1 nolto]$ cat y.i
int igt_subtest_jmpbuf = -2;
[hjl@gnu-tools-1 nolto]$ make
gcc    -c -o main.o main.c
gcc -c  -o x.o x.i
gcc -c  -o y.o y.i
ar rcu -o libx.a x.o y.o
gcc  -o x main.o libx.a
gcc -fuse-ld=gold  -o y main.o libx.a
./x
igt_subtest_jmpbuf: -1
[hjl@gnu-tools-1 nolto]$ ./y
igt_subtest_jmpbuf: 0
[hjl@gnu-tools-1 nolto]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to