How to solve ERROR: relocation truncated to fit R_X86_64_PC32 in C

0

For my algorithm I have to test it with large arrays. So, in my C code I have two global static arrays of length n.

#define length 10000000

static long long arr1[length+1];
static long long arr2[length+1];

For this length n it works fine. But when I make it 10 times (length 100000000) it shows a particular error many times.

 relocation truncated to fit||R_X86_64_PC32 against symbol `__imp_Sleep' defined in .idata$5 section in C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libkernel32.a(dqifs01360.o)|
 relocation truncated to fit||R_X86_64_PC32 against symbol `__imp_SetUnhandledExceptionFilter' defined in .idata$5 section in C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libkernel32.a(dqifs01346.o)|
...
...

Codeblock compilation command

gcc.exe -Wall -g -Wall  -c "D:\other\all test\main.c" -o obj\Debug\main.o
gcc.exe  -o "bin\Debug\all test.exe" obj\Debug\main.o   

I knew that it may causes as the address may be larger to link variables. So, I tried every one of this at a time in the command but, the error is same.

-mcmodel=medium

-Wl,--image-base -Wl,0x10000000

-fno-unwind-tables -fno-asynchronous-unwind-tables

-fPIC

How can I solve this problem???

c
asked on Stack Overflow Jan 27, 2021 by Ayan Bhunia • edited Jan 27, 2021 by Roshin Raphel

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0