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:otherall testmain.c" -o objDebugmain.o
gcc.exe -o "binDebugall test.exe" objDebugmain.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???
question from:
https://stackoverflow.com/questions/65919466/how-to-solve-error-relocation-truncated-to-fit-r-x86-64-pc32-in-c 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…