From: Ed Maste Date: Tue, 12 Apr 2016 21:11:46 +0000 (+0000) Subject: Always use --eh-frame-hdr on FreeBSD, even for -static X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=246482bb9e3f1b094b7a2c67c54210ce5e37c0cc;p=clang Always use --eh-frame-hdr on FreeBSD, even for -static FreeBSD uses LLVM's libunwind on FreeBSD/arm64 today (and is expected to use it more widely in the future), and it requires the EH frame segment in static binaries. This is the same as r203742 for NetBSD. Differential Revision: http://reviews.llvm.org/D19029 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266123 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9fbb12c089..f0b1de85b2 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -8197,12 +8197,12 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (IsPIE) CmdArgs.push_back("-pie"); + CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-Bstatic"); } else { if (Args.hasArg(options::OPT_rdynamic)) CmdArgs.push_back("-export-dynamic"); - CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_shared)) { CmdArgs.push_back("-Bshareable"); } else { diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c index 45e9204361..f008b76b93 100644 --- a/test/Driver/freebsd.c +++ b/test/Driver/freebsd.c @@ -82,6 +82,7 @@ // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STATIC %s +// CHECK-STATIC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic" // CHECK-STATIC: crt1.o // CHECK-STATIC: crtbeginT.o