Closed GoogleCodeExporter closed 9 years ago
Interesting warning with slightly different repro:
% head a.c b.c
==> a.c <==
int CCC;
int *zoo() {
return &CCC;
}
==> b.c <==
#include <stdio.h>
extern int CCC;
extern int *zoo();
int main(int argc, char** argv) {
printf("main %p\n", &CCC);
printf("lib %p\n", zoo());
}
% ./my_clang -O2 a.c -fasan -c -fPIC && gcc -shared a.o -o a.so && gcc -c b.c
&& ./my_clang++ -fasan -O2 b.o a.so -Wl,-rpath=. && ./a.out
./a.out: Symbol `CCC' causes overflow in R_X86_64_PC32 relocation
main 0x2829c40
lib 0x7fd102829c40
Original comment by konstant...@gmail.com
on 6 Oct 2011 at 3:49
GNU ld gives even more interesting warning:
/usr/bin/ld: a.o: relocation R_X86_64_PC32 against symbol `CCC' can not be used
when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
Original comment by konstant...@gmail.com
on 6 Oct 2011 at 7:53
GNU ld gives even more interesting warning:
/usr/bin/ld: a.o: relocation R_X86_64_PC32 against symbol `CCC' can not be used
when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
Original comment by konstant...@gmail.com
on 6 Oct 2011 at 8:09
fixed by r849.
This was caused by http://llvm.org/bugs/show_bug.cgi?id=11081
The fix is to not use GLobalAlias at all (we don't seem to need it anyway)
Original comment by konstant...@gmail.com
on 6 Oct 2011 at 10:00
Original issue reported on code.google.com by
konstant...@gmail.com
on 29 Jul 2011 at 4:03