From 747d670baef35f0615b32652e93c97a2ff8dba18 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 30 May 2024 11:18:03 -0700 Subject: [ELF] Make .interp/SHT_NOTE not special Follow-up to a previous simplification 2473b1af085ad54e89666cedf684fdf10a84f058. The xor difference between a SHT_NOTE and a read-only SHT_PROGBITS (previously >=NOT_SPECIAL) should be smaller than RF_EXEC. Otherwise, for the following section layout, `findOrphanPos` would place .text before note. ``` // simplified from linkerscript/custom-section-type.s non orphans: progbits 0x8060c00 NOT_SPECIAL note 0x8040003 orphan: .text 0x8061000 NOT_SPECIAL ``` rw-text.lds in orphan.s (added by 73e07e924470ebab76a634e41fadf425a859e0ea) demonstrates a similar case. The new behavior is more similar to GNU ld. #93763 fixed BOLT's brittle reliance on the previous .interp behavior. --- lld/test/ELF/linkerscript/orphan.s | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lld/test') diff --git a/lld/test/ELF/linkerscript/orphan.s b/lld/test/ELF/linkerscript/orphan.s index cff6a3e..4f01b18 100644 --- a/lld/test/ELF/linkerscript/orphan.s +++ b/lld/test/ELF/linkerscript/orphan.s @@ -55,13 +55,13 @@ # RUN: ld.lld a.o -T rw-text.lds -o rw-text # RUN: llvm-readelf -S rw-text | FileCheck %s --check-prefix=RW-TEXT -# RW-TEXT: .interp PROGBITS 00000000000002{{..}} 0 -# RW-TEXT-NEXT: .note.my NOTE 00000000000002{{..}} 0 -# RW-TEXT-NEXT: .jcr PROGBITS 00000000000002{{..}} 0 +# RW-TEXT: .jcr PROGBITS 00000000000002{{..}} 0 # RW-TEXT-NEXT: .rw1 PROGBITS 00000000000002{{..}} 0 # RW-TEXT-NEXT: .rw2 PROGBITS 00000000000002{{..}} 0 # RW-TEXT-NEXT: .rw3 PROGBITS 00000000000002{{..}} 0 # RW-TEXT-NEXT: .bss NOBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .interp PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .note.my NOTE 00000000000002{{..}} 0 # RW-TEXT-NEXT: .text PROGBITS 0000000000001{{...}} 0 # RW-TEXT-NEXT: .mytext PROGBITS 0000000000001{{...}} 0 -- cgit v1.1