Fwd: Relocation R_X86_64_32 against undefined symbol

Himanshu Chauhan hchauhan@xvisor-x86.org
Sat Nov 11 11:53:00 GMT 2017


I am working on a hypervisor (https://github.com/hschauhan/xvisor-x86_64).
While it compiles fine with GCC 5.4, 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.


More information about the Gcc-help mailing list