mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MIPS: boot: compressed: place .rodata.* and discard .MIPS.abiflags
@ 2026-10-09 23:28 Rosen Penev
  2026-11-05 15:24 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-10-09 23:28 UTC (permalink / raw)
  To: linux-mips
  Cc: Thomas Bogendoerfer, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

The decompressor linker script only collects .rodata. Clang emits the
decompressor's strings in .rodata.str1.1 and also produces a
.MIPS.abiflags section. GNU ld places such orphans next to similar
sections, but ld.lld puts them after .bss:

  [ 5] .bss            NOBITS   809246c0 5346b8 402010
  [ 6] .MIPS.abiflags  ...      80d266d0 9366d0 000018
  [ 7] .rodata.str1.1  PROGBITS 80d266e8 9366e8 000164

This pulls the 4 MB of .bss (mostly the boot heap) into the file and
leaves the strings beyond _end. For BCM47XX vmlinuz grows from 5.4 MB
to 9.6 MB.

Collect .rodata.* with .rodata, and discard .MIPS.abiflags and
.gnu.attributes as arch/mips/kernel/vmlinux.lds.S does.

Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 arch/mips/boot/compressed/ld.script | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 0ebb667274d6..c45be18c6f0d 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -17,7 +17,7 @@ SECTIONS
 	/* . = VMLINUZ_LOAD_ADDRESS; */
 	.text : {
 		*(.text)
-		*(.rodata)
+		*(.rodata .rodata.*)
 	}: text
 	/* End of text section */
 
@@ -50,7 +50,9 @@ SECTIONS
 
 	/* Sections to be discarded */
 	/DISCARD/ : {
+		*(.MIPS.abiflags)
 		*(.MIPS.options)
+		*(.gnu.attributes)
 		*(.options)
 		*(.pdr)
 		*(.reginfo)
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: boot: compressed: place .rodata.* and discard .MIPS.abiflags
  2026-10-09 23:28 [PATCH] MIPS: boot: compressed: place .rodata.* and discard .MIPS.abiflags Rosen Penev
@ 2026-11-05 15:24 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2026-11-05 15:24 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-mips, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

On Fri, Oct 09, 2026 at 04:28:57PM -0700, Rosen Penev wrote:
> The decompressor linker script only collects .rodata. Clang emits the
> decompressor's strings in .rodata.str1.1 and also produces a
> .MIPS.abiflags section. GNU ld places such orphans next to similar
> sections, but ld.lld puts them after .bss:
> 
>   [ 5] .bss            NOBITS   809246c0 5346b8 402010
>   [ 6] .MIPS.abiflags  ...      80d266d0 9366d0 000018
>   [ 7] .rodata.str1.1  PROGBITS 80d266e8 9366e8 000164
> 
> This pulls the 4 MB of .bss (mostly the boot heap) into the file and
> leaves the strings beyond _end. For BCM47XX vmlinuz grows from 5.4 MB
> to 9.6 MB.
> 
> Collect .rodata.* with .rodata, and discard .MIPS.abiflags and
> .gnu.attributes as arch/mips/kernel/vmlinux.lds.S does.
> 
> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  arch/mips/boot/compressed/ld.script | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
> index 0ebb667274d6..c45be18c6f0d 100644
> --- a/arch/mips/boot/compressed/ld.script
> +++ b/arch/mips/boot/compressed/ld.script
> @@ -17,7 +17,7 @@ SECTIONS
>  	/* . = VMLINUZ_LOAD_ADDRESS; */
>  	.text : {
>  		*(.text)
> -		*(.rodata)
> +		*(.rodata .rodata.*)
>  	}: text
>  	/* End of text section */
>  
> @@ -50,7 +50,9 @@ SECTIONS
>  
>  	/* Sections to be discarded */
>  	/DISCARD/ : {
> +		*(.MIPS.abiflags)
>  		*(.MIPS.options)
> +		*(.gnu.attributes)
>  		*(.options)
>  		*(.pdr)
>  		*(.reginfo)
> -- 
> 2.56.0

applied to mips-fixes

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-05 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 23:28 [PATCH] MIPS: boot: compressed: place .rodata.* and discard .MIPS.abiflags Rosen Penev
2026-11-05 15:24 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®