-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Originally reported on Google Code with ID 3
Currently, we can no mix PIC and non-PIC objects if globals are instrumented
% head a.cc b.cc
==> a.cc <==
#include <stdio.h>
int* CCC = new int;
int *zoo() {
printf("z1 %p\n", &CCC);
return CCC;
}
==> b.cc <==
#include <stdio.h>
extern int *CCC;
extern int *zoo();
int main(int argc, char** argv) {
printf("z2 %p\n", &CCC);
zoo();
}
./my_clang++ -O2 a.cc -fasan -c -fPIC && gcc -shared a.o -o a.so && ./my_clang++ -fasan
-O2 b.cc a.so -Wl,-rpath=. && ./a.out
z2 0x60e180
z1 0x7fc063fa2060
# both numbers should be the equal
Reported by konstantin.s.serebryany on 2011-07-29 16:03:45