summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Smith <brad@comstyle.com>2017-04-22 16:45:56 +0000
committerBrad Smith <brad@comstyle.com>2017-04-22 16:45:56 +0000
commit469eeae0ec737189647c60744dd8b9b0e323cc9f (patch)
tree7dcd457037633fc2dcbd26fb5ee7b67d0e7dfdff
parent80c73a33bd1e0ec3a579053010f16cfd15c13db0 (diff)
Merging r295614:
------------------------------------------------------------------------ r295614 | brad | 2017-02-19 15:11:48 -0500 (Sun, 19 Feb 2017) | 2 lines Always use --eh-frame-hdr on OpenBSD, even for -static ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@301083 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/Tools.cpp2
-rw-r--r--test/Driver/openbsd.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 3c3d453ff7..0ed8212984 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -8907,12 +8907,12 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("__start");
}
+ 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");
CmdArgs.push_back("-Bdynamic");
if (Args.hasArg(options::OPT_shared)) {
CmdArgs.push_back("-shared");
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index 587c31ded0..4160fbb767 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -3,6 +3,12 @@
// CHECK-LD: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
// CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// Check for --eh-frame-hdr being passed with static linking
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-STATIC-EH %s
+// CHECK-LD-STATIC-EH: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD-STATIC-EH: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bstatic" "-o" "a.out" "{{.*}}rcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+
// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PG %s
// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"