Relocation R_X86_64_32 against undefined symbol

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chauhanjpr
Posts: 9
Joined: Tue Feb 28, 2012 6:14 am

Relocation R_X86_64_32 against undefined symbol

Post 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
chauhanjpr
Posts: 9
Joined: Tue Feb 28, 2012 6:14 am

Re: Relocation R_X86_64_32 against undefined symbol

Post 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
Post Reply