bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Set max-page-size when linking the kernel to 0x1000.


From: Samuel Thibault
Subject: Re: [PATCH] Set max-page-size when linking the kernel to 0x1000.
Date: Mon, 9 Jan 2023 19:52:57 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le dim. 08 janv. 2023 22:26:26 -0500, a ecrit:
> 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).
> ---
>  x86_64/Makefrag.am | 1 +
>  1 file changed, 1 insertion(+)
> 
> 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 += \
> -- 
> 2.39.0
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]