r266123 - Always use --eh-frame-hdr on FreeBSD, even for -static

Ed Maste via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 14:11:46 PDT 2016


Author: emaste
Date: Tue Apr 12 16:11:46 2016
New Revision: 266123

URL: http://llvm.org/viewvc/llvm-project?rev=266123&view=rev
Log:
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

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/freebsd.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=266123&r1=266122&r2=266123&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Apr 12 16:11:46 2016
@@ -8197,12 +8197,12 @@ void freebsd::Linker::ConstructJob(Compi
   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 {

Modified: cfe/trunk/test/Driver/freebsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=266123&r1=266122&r2=266123&view=diff
==============================================================================
--- cfe/trunk/test/Driver/freebsd.c (original)
+++ cfe/trunk/test/Driver/freebsd.c Tue Apr 12 16:11:46 2016
@@ -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
 




More information about the cfe-commits mailing list