Code: Select all
21:15:34-kzinti@droneship:~/dev/rainbow-os (master)$ readelf -l build/arch/x86_64/kernel/kernel
Elf file type is EXEC (Executable file)
Entry point 0xffffffff8000b708
There are 3 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0xffffffff80000000 0xffffffff80000000
0x000000000000f35c 0x000000000000f35c R E 0x1000
LOAD 0x0000000000011000 0xffffffff80010000 0xffffffff80010000
0x00000000000053fc 0x00000000000053fc R 0x1000
LOAD 0x0000000000017000 0xffffffff80016000 0xffffffff80016000
0x0000000000002013 0x000000000002d002 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text
01 .rodata .eh_frame
02 .data .init_array .fini_array .vdso .bss
Code: Select all
21:17:53-kzinti@droneship:~/dev/rainbow-os-2/build (master)$ readelf -l kernel/src/kernel
Elf file type is EXEC (Executable file)
Entry point 0xffffffff80000000
There are 3 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0xffffffff80000000 0xffffffff80000000
0x000000000000000e 0x000000000000000e R E 0x1000
LOAD 0x000000000000100e 0xffffffff8000000e 0xffffffff8000000e
0x000000000000007e 0x000000000000007e R 0x1000
LOAD 0x0000000000001090 0xffffffff80000090 0xffffffff80000090
0x00000000000000e0 0x00000000000000e0 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text
01 .interp .note.gnu.build-id .dynsym .dynstr .gnu.hash
02 .dynamic
1) The alignment of each program header is "0x1000" as expected.
2) The offset (and virtual address) of the last two program headers is (are) NOT aligned to 0x1000. This I did not expect.
3) Not the same code is compiled in both cases, but that doesn't explain #2
Perhaps my link script needs fixing but I am not sure what. I have been unsuccessful at the googles.
Here is my link script (same used in both cases):
https://github.com/kiznit/rainbow-os/bl ... kernel.lds