r309523 - Also pass -pie back to the linker when linking on OpenBSD.

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 30 14:14:00 PDT 2017


Author: brad
Date: Sun Jul 30 14:13:59 2017
New Revision: 309523

URL: http://llvm.org/viewvc/llvm-project?rev=309523&view=rev
Log:
Also pass -pie back to the linker when linking on OpenBSD.

Modified:
    cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp
    cfe/trunk/test/Driver/openbsd.c

Modified: cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp?rev=309523&r1=309522&r2=309523&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/OpenBSD.cpp Sun Jul 30 14:13:59 2017
@@ -133,6 +133,8 @@ void openbsd::Linker::ConstructJob(Compi
     }
   }
 
+  if (Args.hasArg(options::OPT_pie))
+    CmdArgs.push_back("-pie");
   if (Args.hasArg(options::OPT_nopie))
     CmdArgs.push_back("-nopie");
 

Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=309523&r1=309522&r2=309523&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Sun Jul 30 14:13:59 2017
@@ -77,7 +77,9 @@
 // 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: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE-FLAG %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -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
@@ -93,6 +95,7 @@
 // RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
 // CHECK-PIE: "{{.*}}crt0.o"
 // CHECK-PIE-NOT: "-nopie"
+// CHECK-PIE-FLAG: "-pie"
 // CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
 // CHECK-STATIC-PIE-NOT: "-nopie"
 // CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"




More information about the cfe-commits mailing list