[PATCH] D125074: [ELF] Change (NOLOAD) type mismatch to use SHT_NOBITS instead of SHT_PROGBITS

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 07:49:57 PDT 2022


This revision was automatically updated to reflect the committed changes.
MaskRay marked an inline comment as done.
Closed by commit rGb3d5bb3b308f: [ELF] Change (NOLOAD) type mismatch to use SHT_NOBITS instead of SHT_PROGBITS (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125074/new/

https://reviews.llvm.org/D125074

Files:
  lld/ELF/OutputSections.cpp
  lld/test/ELF/linkerscript/custom-section-type.s
  lld/test/ELF/linkerscript/noload.s


Index: lld/test/ELF/linkerscript/noload.s
===================================================================
--- lld/test/ELF/linkerscript/noload.s
+++ lld/test/ELF/linkerscript/noload.s
@@ -24,7 +24,7 @@
 
 # WARN:   warning: section type mismatch for .data_noload_a
 # CHECK2:      Name                 Type     Address          Off               Size
-# CHECK2:      .data_noload_a       PROGBITS 0000000000000000 [[OFF:[0-9a-f]+]] 001001
+# CHECK2:      .data_noload_a       NOBITS   0000000000000000 [[OFF:[0-9a-f]+]] 001001
 
 #--- asm
 .section .text,"ax", at progbits
Index: lld/test/ELF/linkerscript/custom-section-type.s
===================================================================
--- lld/test/ELF/linkerscript/custom-section-type.s
+++ lld/test/ELF/linkerscript/custom-section-type.s
@@ -37,7 +37,7 @@
 ## Mismatched progbits and expr are changed to SHT_PROGBITS.
 # MISMATCH: progbits PROGBITS
 # MISMATCH: note     NOTE
-# MISMATCH: expr     PROGBITS
+# MISMATCH: expr     0x42: <unknown>
 
 # RUN: not ld.lld -T %t/unknown1.lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNKNOWN1
 # UNKNOWN1: error: {{.*}}.lds:1: symbol not found: foo
Index: lld/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/ELF/OutputSections.cpp
@@ -123,7 +123,8 @@
                  "\n>>> output section " + name + ": " +
                  getELFSectionTypeName(config->emachine, type));
       }
-      type = SHT_PROGBITS;
+      if (!typeIsSet)
+        type = SHT_PROGBITS;
     } else {
       type = isec->type;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125074.427640.patch
Type: text/x-patch
Size: 1613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220506/18d97dd7/attachment.bin>


More information about the llvm-commits mailing list