]> granicus.if.org Git - clang/commitdiff
Always use --eh-frame-hdr on FreeBSD, even for -static
authorEd Maste <emaste@freebsd.org>
Tue, 12 Apr 2016 21:11:46 +0000 (21:11 +0000)
committerEd Maste <emaste@freebsd.org>
Tue, 12 Apr 2016 21:11:46 +0000 (21:11 +0000)
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

lib/Driver/Tools.cpp
test/Driver/freebsd.c

index 9fbb12c089c922f2e4a87c3c7c0674bd4e0910a7..f0b1de85b2a4009b091fe2058ac8396f1aabd654 100644 (file)
@@ -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 {
index 45e92043619bc43fdc1e94a713c6b6544e67593c..f008b76b93ae40078f8ee9591c25df6c9613a72c 100644 (file)
@@ -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