Page 1 of 1

Problem with linking script

Posted: Thu Dec 24, 2015 7:48 pm
by Enerccio
For some reason, even though I specify directly in my linking script where some sections should be, linker moves them around and ends up with inccorect layout that can't be linked together.

Summary of my problem: http://stackoverflow.com/questions/3445 ... should-not

I need those sections for smp ap processors, and if I declare them nobits, they end up in -2GB kernel space, completely unusable and kernel won't even link anymore:

Code: Select all

entry.s:(.mp_entry+0x1): relocation truncated to fit: R_X86_64_32 against `.ap_data,'
	utils/collections/array.o \
entry.s:(.mp_entry+0x11): relocation truncated to fit: R_X86_64_32 against `.ap_data,'
	-ffreestanding -mno-red-zone -nostdlib -lgcc -lc -z max-page-size=0x1000   -O0  -L../kclib/usr/lib
entry.s:(.mp_entry+0x25): relocation truncated to fit: R_X86_64_32 against `.ap_stack,'
entry_o.o: In function `cpu_boot_continue':
entry.s:(.mp_entry+0x39): relocation truncated to fit: R_X86_64_32 against `.ap_data,'

Re: Problem with linking script

Posted: Fri Dec 25, 2015 4:52 pm
by onlyonemac
It's generally better to summarise your problem in the thread than to link to a summary elsewhere.

Re: Problem with linking script

Posted: Fri Dec 25, 2015 11:49 pm
by xenos
You might need to manually create different output segments with the PHDRS command:
https://sourceware.org/binutils/docs/ld/PHDRS.html
See the .user section here, for example:
https://github.com/xenos1984/NOS/blob/m ... 4/ldscript
Also, instead of BLOCK, you could try to write out the address of your ap_stack section, since you want it to be fixed anyway.