Page 1 of 1

Relocation R_X86_64_32 against undefined symbol

Posted: Thu Nov 09, 2017 10:05 am
by chauhanjpr
Hi,

I am working on a hypervisor (https://github.com/hschauhan/xvisor-x86_64). While it compiles fine with GCC 6.3, it doesn't compile with GCC 7.2 that comes preinstalled with ubuntu 17.10. I get the following error:

/usr/bin/ld: /home/hchauhan/sandbox/xvisor-x86_64/build/arch/x86/cpu/cpu.o: relocation R_X86_64_32 against undefined symbol `_bootstrap_stack_start' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:344: recipe for target '/home/hchauhan/sandbox/xvisor-x86_64/build/vmm_tmp1.elf' failed

_bootstrap_stack_start is a symbol defined in linker script with PROVIDE. Previous GCC is able to link but new one is unable to do so. _bootstrap_stack_start is used to load %esp under .code32

I searched the internet for the failure and it looks like it has something to do with default visibility of symbols in gcc 7.2. I have tried -fvisibility etc but to no avail.

Any pointer would be of help.

Regards
Himanshu

Re: Relocation R_X86_64_32 against undefined symbol

Posted: Thu Mar 15, 2018 9:00 pm
by chauhanjpr
I had solved this problem but didn't post a reply. I am posting it here in case somebody needs it.

you will need to use -fno-pie as your compiler flags.

Regards
Himanshu