r325733 - [Driver] Generate .eh_frame_hdr for static executables too.

Dan Albert via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 21 14:36:51 PST 2018


Author: danalbert
Date: Wed Feb 21 14:36:51 2018
New Revision: 325733

URL: http://llvm.org/viewvc/llvm-project?rev=325733&view=rev
Log:
[Driver] Generate .eh_frame_hdr for static executables too.

Summary: libgcc won't unwind without an .eh_frame_hdr section.

Reviewers: srhines, chandlerc

Reviewed By: chandlerc

Subscribers: chandlerc, cfe-commits

Differential Revision: https://reviews.llvm.org/D43203

Modified:
    cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
    cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=325733&r1=325732&r2=325733&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Wed Feb 21 14:36:51 2018
@@ -378,9 +378,7 @@ void tools::gnutools::Linker::ConstructJ
   for (const auto &Opt : ToolChain.ExtraOpts)
     CmdArgs.push_back(Opt.c_str());
 
-  if (!Args.hasArg(options::OPT_static)) {
-    CmdArgs.push_back("--eh-frame-hdr");
-  }
+  CmdArgs.push_back("--eh-frame-hdr");
 
   if (const char *LDMOption = getLDMOption(ToolChain.getTriple(), Args)) {
     CmdArgs.push_back("-m");

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=325733&r1=325732&r2=325733&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Wed Feb 21 14:36:51 2018
@@ -156,7 +156,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
 // CHECK-LD-64-STATIC-NOT: warning:
 // CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
-// CHECK-LD-64-STATIC-NOT: "--eh-frame-hdr"
+// CHECK-LD-64-STATIC: "--eh-frame-hdr"
 // CHECK-LD-64-STATIC: "-m" "elf_x86_64"
 // CHECK-LD-64-STATIC-NOT: "-dynamic-linker"
 // CHECK-LD-64-STATIC: "-static"




More information about the cfe-commits mailing list