http://llvm.org/bugs/show_bug.cgi?id=4533

           Summary: relocation problem with shared libraries on x86-64
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


The problem is that the address of a function shows up differently in two
different translation units. One TU is compiled to a shared library with -fPIC,
the other has neither. This works with GCC but not LLVM:

$ g++ -O2 -fPIC x.cc -shared -o x.so
$ g++ -O2 y.cc -o y x.so
$ ./y
y: 0x400570
x: 0x400570

$ llvm-g++ -O2 -fPIC x.cc -shared -o x.so
$ llvm-g++ -O2 y.cc -o y x.so
$ ./y
y: 0x4004c8
x: 0x7f07903b2240

The testcase is two very small files:

x.cc:
  #include <cstdio>

  void trouble() {}

  void func() {
    printf("x: %p\n", trouble);
  }

y.cc:
  #include <cstdio>

  void trouble();
  extern void func();

  int main(void) {
    printf("y: %p\n", trouble);
    func();
  }


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to