[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ld behavior on different architectures
From: |
Constantine Kousoulos |
Subject: |
ld behavior on different architectures |
Date: |
Thu, 07 Jun 2007 19:56:08 +0300 |
User-agent: |
Icedove 1.5.0.10 (X11/20070329) |
Hello all,
First of all, excuse me if i'm asking a naive question. I'm a
complete noob at using linker scripts (and generally ld), so
please give me a helping hand.
I use the same linker script when building a (non linux) kernel
natively on i386 and on amd64. The linker script defines the first
section to be one called 'boot'. This is where i put multiboot
headers so that they are within the first 8 bytes of the kernel
image. Grub succesfully retrieves the headers from the i386 build
but not from the amd64 build. This is not a grub question.
Does the linker's behavior change across different architectures?
Is is possible that the 'boot' section is *not* at the beginning
of the file on amd64?
Thanks,
Constantine
Here's my linker script:
start_offset = 0x100000;
kernel_offset = 0xc0000000; (0xffffffff80000000 when building on
amd64)
real_start = start - kernel_offset;
boot_stack_size = 4096;
ENTRY(real_start)
SECTIONS
{
. = (start_offset + kernel_offset);
.boot ALIGN(4096) : AT(ADDR(.boot) - kernel_offset)
{
_boot = .;
*(.boot)
_eboot = .;
}
.bootdata ALIGN(4) : AT(ADDR(.bootdata) - kernel_offset)
{
_bootdata = .;
*(.bootdata)
_ebootdata = .;
}
.bootstack ALIGN(4096) : AT(ADDR(.bootstack) - kernel_offset)
{
_bootstack = .;
. += boot_stack_size;
_ebootstack = .;
}
.text ALIGN(4096) : AT(ADDR(.text) - kernel_offset)
{
_text = .;
*(.text)
_etext = .;
}
.rodata ALIGN(4) : AT(ADDR(.rodata) - kernel_offset)
{
_rodata = .;
*(.rodata)
_erodata = .;
}
.data ALIGN(4096) : AT(ADDR(.data) - kernel_offset)
{
_data = .;
*(.data)
_edata = .;
}
.bss ALIGN(4) : AT(ADDR(.bss) - kernel_offset)
{
_bss = .;
*(.bss)
_ebss = .;
}
_end = .;
}
- ld behavior on different architectures,
Constantine Kousoulos <=