Skip to content

Commit 704247c

Browse files
committedOct 28, 2018
Reapply Pass the nopie flag to the linker when linking with -pg.
llvm-svn: 345470
1 parent c4b785a commit 704247c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

Diff for: ‎clang/lib/Driver/ToolChains/OpenBSD.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
138138

139139
if (Args.hasArg(options::OPT_pie))
140140
CmdArgs.push_back("-pie");
141-
if (Args.hasArg(options::OPT_nopie))
141+
if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg))
142142
CmdArgs.push_back("-nopie");
143143

144144
if (Output.isFilename()) {

Diff for: ‎clang/test/Driver/openbsd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \
1313
// RUN: | FileCheck --check-prefix=CHECK-PG %s
1414
// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
15-
// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o"
15+
// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o"
1616

1717
// Check CPU type for MIPS64
1818
// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \

0 commit comments

Comments
 (0)
Please sign in to comment.