Pass the nopie flag to the linker when linking with -pg.
authorBrad Smith <brad@comstyle.com>
Sat, 27 Oct 2018 00:23:28 +0000 (00:23 +0000)
committerBrad Smith <brad@comstyle.com>
Sat, 27 Oct 2018 00:23:28 +0000 (00:23 +0000)
llvm-svn: 345439

clang/lib/Driver/ToolChains/OpenBSD.cpp
clang/test/Driver/openbsd.c

index 018076a..3d35d37 100644 (file)
@@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
   if (Args.hasArg(options::OPT_pie))
     CmdArgs.push_back("-pie");
-  if (Args.hasArg(options::OPT_nopie))
+  if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg))
     CmdArgs.push_back("-nopie");
 
   if (Output.isFilename()) {
index 1ea1f58..ab79e3a 100644 (file)
@@ -84,6 +84,8 @@
 // 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 -pg %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
 // 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 \