[PATCH] D85785: [ELF] -r: allow section type 0x70000001 (SHT_X86_64_UNWIND) to be merged into SHT_PROGBITS

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 20:14:50 PDT 2020


MaskRay updated this revision to Diff 285248.
MaskRay edited the summary of this revision.
MaskRay added a comment.

Check emachine


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85785

Files:
  lld/ELF/OutputSections.cpp
  lld/test/ELF/eh-frame-type.test


Index: lld/test/ELF/eh-frame-type.test
===================================================================
--- lld/test/ELF/eh-frame-type.test
+++ lld/test/ELF/eh-frame-type.test
@@ -11,6 +11,9 @@
 # RUN: ld.lld %t1.o %t2.o -o %tboth
 # RUN: llvm-readobj -S %tboth | FileCheck %s
 
+# RUN: ld.lld -r %t1.o %t2.o -o %tboth.ro
+# RUN: llvm-readobj -S %tboth.ro | FileCheck %s
+
 # CHECK:      Name: .eh_frame
 # CHECK-NEXT: Type: SHT_PROGBITS
 
Index: lld/ELF/OutputSections.cpp
===================================================================
--- lld/ELF/OutputSections.cpp
+++ lld/ELF/OutputSections.cpp
@@ -78,10 +78,14 @@
 // to be allocated for nobits sections. Other ones don't require
 // any special treatment on top of progbits, so there doesn't
 // seem to be a harm in merging them.
+//
+// NOTE: clang since rL252300 emits SHT_X86_64_UNWIND .eh_frame sections. Allow
+// them to be merged into SHT_PROGBITS .eh_frame (GNU as .cfi_*).
 static bool canMergeToProgbits(unsigned type) {
   return type == SHT_NOBITS || type == SHT_PROGBITS || type == SHT_INIT_ARRAY ||
          type == SHT_PREINIT_ARRAY || type == SHT_FINI_ARRAY ||
-         type == SHT_NOTE;
+         type == SHT_NOTE ||
+         (type == SHT_X86_64_UNWIND && config->emachine == EM_X86_64);
 }
 
 // Record that isec will be placed in the OutputSection. isec does not become


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85785.285248.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/a6bdca44/attachment.bin>


More information about the llvm-commits mailing list