From 30f9051d7d8b6f56c8149fd1bdcc714285f77527 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 21 Feb 2018 22:36:51 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325733 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains/Gnu.cpp | 4 +--- test/Driver/linux-ld.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp index 9b31246ba7..5e0a299a6e 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp @@ -378,9 +378,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 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"); diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 662aabb867..f9f938577b 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -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" -- 2.40.0