Weird linker script...
Posted: Thu Feb 28, 2008 6:27 am
I have the following code in boot.S :
and the following in code.c :
That's very basic. I want to make a higher half kernel, so I use the following linker script :
but the line *(.boot*) doesn't seem to include anything at all !
If I replace it by "boot.o" (ie the object file containing the code), it works ok.
Also note that the script posted above works with elf32-i386 as output format.
I *could* use the file name instead of the section name, but in my real kernel, the file is located in some arch-dependant subdirectory, and I would really like not to bother with the file location.
Another weird thing is that if I include the .boot section along with the .text section (in the same output section), it is actually included. It seems not to be included only if alone in its output section (looks as if the linker was unable to see that section at all).
Anyone knows why this fails ?
Code: Select all
.section .boot
.long MULTIBOOT_HEADER_AND_STUFF
wrapper:
jmp wrapper
Code: Select all
void func(void) {
}
Code: Select all
OUTPUT_FORMAT(binary)
SECTIONS {
. = 0x100000;
.boot : {
*(.boot*)
}
limit = .;
. = 0xFFC00000;
.code : AT(ADDR(.code) - 0xFFC00000 + limit) {
*(.text*)
}
}
If I replace it by "boot.o" (ie the object file containing the code), it works ok.
Also note that the script posted above works with elf32-i386 as output format.
I *could* use the file name instead of the section name, but in my real kernel, the file is located in some arch-dependant subdirectory, and I would really like not to bother with the file location.
Another weird thing is that if I include the .boot section along with the .text section (in the same output section), it is actually included. It seems not to be included only if alone in its output section (looks as if the linker was unable to see that section at all).
Anyone knows why this fails ?