Weird linker script...

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
User avatar
pini
Member
Member
Posts: 26
Joined: Wed Oct 18, 2006 5:12 am
Location: Nancy, France

Weird linker script...

Post by pini »

I have the following code in boot.S :

Code: Select all

.section .boot

.long MULTIBOOT_HEADER_AND_STUFF

wrapper:
	jmp	wrapper
and the following in code.c :

Code: Select all

void func(void) {
}
That's very basic. I want to make a higher half kernel, so I use the following linker script :

Code: Select all

OUTPUT_FORMAT(binary)
SECTIONS {
	. = 0x100000;
	.boot : {
		*(.boot*)
	}
	limit = .;
	. = 0xFFC00000;
	.code : AT(ADDR(.code) - 0xFFC00000 + limit) {
		*(.text*)
	}
}
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 ?
Don't think you can. Know you can.
Post Reply