Skip to content

Commit

Permalink
[Driver] Generate .eh_frame_hdr for static executables too.
Browse files Browse the repository at this point in the history
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

llvm-svn: 325733
  • Loading branch information
DanAlbert committed Feb 21, 2018

Verified

This commit was signed with the committer’s verified signature. The key has expired.
LnL7 Daiderd Jordan
1 parent 3b17b84 commit e12561d
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion clang/test/Driver/linux-ld.c
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit e12561d

Please sign in to comment.