[llvm-branch-commits] [cfe-branch] r295752 - Merging r295610:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 21 11:11:22 PST 2017
Author: hans
Date: Tue Feb 21 13:11:22 2017
New Revision: 295752
URL: http://llvm.org/viewvc/llvm-project?rev=295752&view=rev
Log:
Merging r295610:
------------------------------------------------------------------------
r295610 | brad | 2017-02-19 11:33:26 -0800 (Sun, 19 Feb 2017) | 4 lines
Link static PIE programs against rcrt0.o on OpenBSD
Patch by Stefan Kempf.
------------------------------------------------------------------------
Modified:
cfe/branches/release_40/ (props changed)
cfe/branches/release_40/lib/Driver/Tools.cpp
cfe/branches/release_40/test/Driver/openbsd.c
Propchange: cfe/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 13:11:22 2017
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291963-291964,292032,292052,292183,292194,292247,292265,292497,292555,292558-292559,292561,292590,292800,292847,292874,292991,293043,293134,293360,293369,293596,293678,293787,294008,294800,294855,295149-295150,295224,295313
+/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291963-291964,292032,292052,292183,292194,292247,292265,292497,292555,292558-292559,292561,292590,292800,292847,292874,292991,293043,293134,293360,293369,293596,293678,293787,294008,294800,294855,295149-295150,295224,295313,295610
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_40/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/lib/Driver/Tools.cpp?rev=295752&r1=295751&r2=295752&view=diff
==============================================================================
--- cfe/branches/release_40/lib/Driver/Tools.cpp (original)
+++ cfe/branches/release_40/lib/Driver/Tools.cpp Tue Feb 21 13:11:22 2017
@@ -8937,6 +8937,10 @@ void openbsd::Linker::ConstructJob(Compi
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+ else if (Args.hasArg(options::OPT_static) &&
+ !Args.hasArg(options::OPT_nopie))
+ CmdArgs.push_back(
+ Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
else
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
Modified: cfe/branches/release_40/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/test/Driver/openbsd.c?rev=295752&r1=295751&r2=295752&view=diff
==============================================================================
--- cfe/branches/release_40/test/Driver/openbsd.c (original)
+++ cfe/branches/release_40/test/Driver/openbsd.c Tue Feb 21 13:11:22 2017
@@ -67,3 +67,26 @@
// CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
// CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
// CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -static -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// CHECK-PIE: "{{.*}}crt0.o"
+// CHECK-PIE-NOT: "-nopie"
+// CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
+// CHECK-STATIC-PIE-NOT: "-nopie"
+// CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"
More information about the llvm-branch-commits
mailing list