This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: relocation truncated to fit


On 7/26/07, Canqun Yang <canqun@yahoo.com.cn> wrote:
Hi, all

Can anyone help me to resolve this problem?

When I compile a program with .bss segement larger than 2.0GB, I get the
following error message from GNU linker (binutils-2.15).

(.text+0x305): In function `sta_':
: relocation truncated to fit: R_X86_64_32S plot_
......

I upgrade the assembler and the linker from binutis-2.17, then get the
message below.

STA.o: In function `sta_':
STA.F:(.text+0x305): relocation truncated to fit: R_X86_64_32S against
symbol `plot_' defined in COMMON section in STA.o

So, I modified the binutils-2.17/bfd/elf64-x86-64.c and rebuild the linker
to ignore the relocation errors. Though the executable generated,
segementation fault occurred during execution.

Here is the configuration of my computer:

CPU: Intel(R) Xeon(R) CPU            5150  @ 2.66GHz
OS: Linux mds 2.6.9-34.EL_lustre.1.4.6.1custom #3 SMP Fri Jul 13 15:27:27
CST 2007 x86_64 x86_64 x86_64 GNU/Linux
Compiler: Intel C++/Fortran compiler for linux 10.0

I also wrote a program with large uninitialized data -- more than 2.0GB.
It passes after linked with the modified linker. The source code is appended.

Try using -mcmodel=medium


Richard.

#define N 0x05fff

double a[N][N];

int
main ()
{
  int i, j;
  double sum;

  for (i = 0; i < N; i+=5)
    for (j = 0; j < N; j+=5)
      a[i][j] = 2* i*j + i*i + j*j;


sum = 0.0; for (i = 0; i < N; i+=5) for (j = 0; j < N; j+=5) sum += a[i][j];

  printf ("%f\n", sum);
}


Best regards,


Canqun Yang


___________________________________________________________ 抢注雅虎免费邮箱3.5G容量,20M附件! http://cn.mail.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]