Skip to content

globals are broken if PIC and nonPIC objects are mixed:  #3

@ramosian-glider

Description

@ramosian-glider

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions