Reputation: 8797
Tested under CentOS 5.1 g++ 4.1.2 and 4.6.3 and 4.7.0, they all produce same results. How do I solve this? Basically I can't build llvm with Debug build.
[hidden]$ cat x.cpp
#include <iostream>
int main() {
}
[hidden]$ g++ -c -fPIC -g x.cpp
[hidden]$ objdump -r x.o | grep R_X86_64_32 | head -10
000000000000001c R_X86_64_32 .debug_frame
0000000000000044 R_X86_64_32 .debug_frame
000000000000006c R_X86_64_32 .debug_frame
0000000000000006 R_X86_64_32 .debug_abbrev
000000000000000c R_X86_64_32 .debug_str+0x0000000000000414
0000000000000011 R_X86_64_32 .debug_str+0x00000000000007f2
0000000000000015 R_X86_64_32 .debug_str+0x000000000000017b
0000000000000029 R_X86_64_32 .debug_line
000000000000002e R_X86_64_32 .debug_str+0x0000000000000422
0000000000000034 R_X86_64_32 .debug_str+0x0000000000000607
Upvotes: 0
Views: 1040
Reputation: 213385
How do I solve this?
You don't have a problem to solve (you haven't shown any signs of the problem existing).
And no, -g
and -fPIC
are perfectly compatible and do not conflict with each other.
Upvotes: 2
Reputation: 13877
These are not dynamic relocations. They will be resolved at link time. This does not break -fPIC.
Remember there are two kinds of linking, static and dynamic. Static linking is done by the compiler/linker when you compile the final program binary from the object files, and dynamic linking is done by the OS (ld-linux.so
in the case of linux).
To get a list of dynamic relocations, use objdump -R
. It will only work on dynamically linked binaries, however (i.e. not .o files).
Upvotes: 0