[PATCH] D149466: [ELF] Name MergeSyntheticSection using an input section instead of the output section

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 09:35:19 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1408504564f2: [ELF] Name MergeSyntheticSection using an input section instead of the output… (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149466

Files:
  lld/ELF/OutputSections.cpp
  lld/test/ELF/merge-entsize.s
  lld/test/ELF/merge-string-align.s


Index: lld/test/ELF/merge-string-align.s
===================================================================
--- lld/test/ELF/merge-string-align.s
+++ lld/test/ELF/merge-string-align.s
@@ -1,8 +1,13 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: ld.lld %t.o -o %t.so -shared -M | FileCheck %s --check-prefix=MAP
 // RUN: llvm-readobj -S --section-data %t.so | FileCheck %s
 
+// MAP:      .rodata{{$}}
+// MAP-NEXT:         <internal>:(.rodata.foo)
+// MAP-NEXT: .rodata2
+// MAP-NEXT:         <internal>:(.rodata2)
+
         .section        .rodata.foo,"aMS", at progbits,1
         .align  16
         .asciz "foo"
Index: lld/test/ELF/merge-entsize.s
===================================================================
--- lld/test/ELF/merge-entsize.s
+++ lld/test/ELF/merge-entsize.s
@@ -1,8 +1,12 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld %t.o -o %t
+// RUN: ld.lld %t.o -o %t -M | FileCheck %s --check-prefix=MAP
 // RUN: llvm-readobj -S %t | FileCheck %s
 
+// MAP:      .rodata{{$}}
+// MAP-NEXT:         <internal>:(.rodata.1)
+// MAP-NEXT:         <internal>:(.rodata.2)
+
         .section  .rodata.1,"aM", at progbits,1
         .p2align 2
         .byte 0x42
Index: lld/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/ELF/OutputSections.cpp
@@ -217,7 +217,7 @@
       });
       if (i == mergeSections.end()) {
         MergeSyntheticSection *syn =
-            createMergeSynthetic(name, ms->type, ms->flags, ms->addralign);
+            createMergeSynthetic(s->name, ms->type, ms->flags, ms->addralign);
         mergeSections.push_back(syn);
         i = std::prev(mergeSections.end());
         syn->entsize = ms->entsize;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149466.518772.patch
Type: text/x-patch
Size: 1864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/dd244d74/attachment.bin>


More information about the llvm-commits mailing list