[PATCH] D30566: [ELF] - Do not try to create .eh_frame_hdr for relocatable output.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 00:57:27 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL297365: [ELF] - Do not try to create .eh_frame_hdr for relocatable output. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D30566?vs=90825&id=91141#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30566

Files:
  lld/trunk/ELF/Writer.cpp
  lld/trunk/test/ELF/relocatable-eh-frame-hdr.s


Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -435,12 +435,11 @@
   In<ELFT>::Iplt = make<PltSection<ELFT>>(0);
   Add(In<ELFT>::Iplt);
 
-  if (Config->EhFrameHdr) {
-    In<ELFT>::EhFrameHdr = make<EhFrameHeader<ELFT>>();
-    Add(In<ELFT>::EhFrameHdr);
-  }
-
   if (!Config->Relocatable) {
+    if (Config->EhFrameHdr) {
+      In<ELFT>::EhFrameHdr = make<EhFrameHeader<ELFT>>();
+      Add(In<ELFT>::EhFrameHdr);
+    }
     In<ELFT>::EhFrame = make<EhFrameSection<ELFT>>();
     Add(In<ELFT>::EhFrame);
   }
Index: lld/trunk/test/ELF/relocatable-eh-frame-hdr.s
===================================================================
--- lld/trunk/test/ELF/relocatable-eh-frame-hdr.s
+++ lld/trunk/test/ELF/relocatable-eh-frame-hdr.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld --eh-frame-hdr -r %t.o -o %t
+# RUN: llvm-readobj -s %t | FileCheck %s
+
+# CHECK:       Sections [
+# CHECK-NOT:    Name: .eh_frame_hdr
+
+.section .foo,"ax", at progbits
+.cfi_startproc
+.cfi_endproc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30566.91141.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170309/ab35e38b/attachment.bin>


More information about the llvm-commits mailing list