Compiling a C module in with a large app (>2GB data) and getting relocatable errors
with GCC and not ICC. Linking with the ICC compiled object is no problem.
We need this to work with both. What magic is ICC pulling off?
./classification.o: In function `BB_detection':
./classification.c:118: relocation truncated to fit: R_X86_64_PC32 against `.bss'
Can anyone familiar with the output of readelf see why the GCC
object is not relocatable and the ICC one is? Would another tool
be more suitable?
icc -I../include -g -v -sox -fPIC -mcmodel=medium -DDEBUG -c ./classification.c
cc -I../include -g -v -fPIC -mcmodel=medium -DDEBUG -c ./classification.c
This module does not use more than 2GB data itself, I just need it to be linked with
code that does, so -fPIC. I left off the medium memory model switch on both with no impact.
Everything is static except for the -shared-intel -mcmodel=medium on the main link (ifort is used).
Could it have something to do with the relocation types shown here?
GCC
Relocation section '.rela.text' at offset 0xd040 contains 449 entries:
Offset Info Type Sym. Value Sym. Name + Addend
00000000004e 001700000002 R_X86_64_PC32 0000000000000000 .rodata + fffffffffffffffc
00000000008e 000400000002 R_X86_64_PC32 0000000000000000 .bss + 1e5c
0000000000bc 000400000002 R_X86_64_PC32 0000000000000000 .bss + 105c
ICC
Relocation section '.rela.text' at offset 0xf222 contains 732 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000030 00780000001a R_X86_64_GOTPC32 0000000000000000 _GLOBAL_OFFSET_TABLE_ + fffffffffffffffc
000000000036 000600000019 R_X86_64_GOTOFF64 0000000000000000 _2il0floatpacket.15 + 0
000000000057 000700000019 R_X86_64_GOTOFF64 0000000000000008 _2il0floatpacket.16 + 0
00000000009f 00780000001a R_X86_64_GOTPC32 0000000000000000 _GLOBAL_OFFSET_TABLE_ + fffffffffffffffc
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
icc (ICC) 11.1 20100806
The full output of readelf -all are at these links.
ICC
http://www.box.com/s/2iqnqydmi0mdz52xs9ac
GCC
http://www.box.com/s/jjcgq1x2s5ybpg7s9b6g
Thanks.