Yes, I replicated this on an Ubuntu 11 distro with GCC 4.6.x
On Thu, Feb 23, 2012 at 5:34 PM, Iyer, Balaji V <balaji.v.i...@intel.com> wrote: > Hello J. K., > Have you tried with a newer version of GCC? GCC 4.1 is pretty old.... > > Thanks, > > Balaji V. Iyer. > > -----Original Message----- > From: J K [mailto:jkwi...@gmail.com] > Sent: Thursday, February 23, 2012 10:31 AM > To: gcc@gcc.gnu.org > Subject: Differences in GCC and ICC compiled objects, GCC relocations broken? > > Posted in the Intel forums but this may be more of a GCC issue. > Please advise if I should post elsewhere. > > Compiling a C module in with a large app (>2GB data) and getting relocatable > errors with GCC and not ICC. > > ./classification_dpr_BB.o: In function `BB_detection_dpr': > /homedata/johnk/dpr/src_ > 20120126/DD2_V2.20120126/src/./ > classification_dpr_BB.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_dpr_BB.c cc -I../include -g -v -fPIC -mcmodel=medium -DDEBUG > -c ./classification_dpr_BB.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? Are there switches > to GCC to force relocations > like ICC? > > 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 for any help.