diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2023-01-08 22:26:26 -0500 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-09 19:52:50 +0100 |
commit | 6777cf5650d6989fcee000780a71c05e9426526e (patch) | |
tree | 35749f0b5ec32dbfdf13bdc2dec1ba5c8fe55f53 /x86_64 | |
parent | 390030cffd48a77bbb63cb432c27bc2ba4063c52 (diff) | |
download | gnumach-6777cf5650d6989fcee000780a71c05e9426526e.tar.gz gnumach-6777cf5650d6989fcee000780a71c05e9426526e.tar.bz2 gnumach-6777cf5650d6989fcee000780a71c05e9426526e.zip |
Set max-page-size when linking the kernel to 0x1000.
With the exception of linux, x86_64 ld default's max-page-size
is 2MB (default for i386 is 4K) and compiling gnumach with x86_64-pc-gnu-ld
will generate a kernel image where the boot section starts at the file offset
2MB. This makes it unbootable on grub because the file is no longer multiboot.
Here's the objdump -h output before the patch:
Sections:
Idx Name Size VMA LMA File off Algn
0 .boot 0000c000 0000000001000000 0000000001000000 00200000 2**12
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text 0009078f 000000004100c000 000000000100c000 0020c000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 000110fc 000000004109c7a0 000000000109c7a0 0029c7a0 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .eh_frame 000101f0 00000000410ad8a0 00000000010ad8a0 002ad8a0 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .data 000070a0 00000000412bdaa0 00000000012bdaa0 002bdaa0 2**5
CONTENTS, ALLOC, LOAD, DATA
5 .bss 00023f10 00000000412c5000 00000000012c5000 002c4b40 2**12
ALLOC
6 .comment 00000012 0000000000000000 0000000000000000 002c4b40 2**0
CONTENTS, READONLY
After, when forcing ld's max-page-size to be 4K:
Sections:
Idx Name Size VMA LMA File off Algn
0 .boot 0000c000 0000000001000000 0000000001000000 00001000 2**12
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text 0009078f 000000004100c000 000000000100c000 0000d000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 000110fc 000000004109c7a0 000000000109c7a0 0009d7a0 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .eh_frame 000101f0 00000000410ad8a0 00000000010ad8a0 000ae8a0 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .data 000070a0 00000000410beaa0 00000000010beaa0 000beaa0 2**5
CONTENTS, ALLOC, LOAD, DATA
5 .bss 00023f10 00000000410c6000 00000000010c6000 000c5b40 2**12
ALLOC
6 .comment 00000012 0000000000000000 0000000000000000 000c5b40 2**0
CONTENTS, READONLY
It is also possible that something is wrong with the linker script but
couldn't find anything concrete so far. After this patch the kernel is
bootable with x86_64-pc-gnu-ld (and far smaller in size).
Message-Id: <Y7uJYpIsovhShREj@jupiter.tail36e24.ts.net>
Diffstat (limited to 'x86_64')
-rw-r--r-- | x86_64/Makefrag.am | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/x86_64/Makefrag.am b/x86_64/Makefrag.am index edf533fd..1ee1092a 100644 --- a/x86_64/Makefrag.am +++ b/x86_64/Makefrag.am @@ -262,6 +262,7 @@ gnumach_LINKFLAGS += \ --defsym _START_MAP=$(_START_MAP) \ --defsym _START=$(_START_MAP) \ --defsym KERNEL_MAP_SHIFT=$(KERNEL_MAP_BASE) \ + -z max-page-size=0x1000 \ -T '$(srcdir)'/x86_64/ldscript AM_CCASFLAGS += \ |