Skip to content

Commit c3deccb

Browse files
committed
Add/update PIE defaults for OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299269 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 81c8c1c commit c3deccb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,16 +737,18 @@ tools::ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) {
737737
// OpenBSD-specific defaults for PIE
738738
if (Triple.getOS() == llvm::Triple::OpenBSD) {
739739
switch (ToolChain.getArch()) {
740+
case llvm::Triple::arm:
741+
case llvm::Triple::aarch64:
740742
case llvm::Triple::mips64:
741743
case llvm::Triple::mips64el:
742-
case llvm::Triple::sparcel:
743744
case llvm::Triple::x86:
744745
case llvm::Triple::x86_64:
745746
IsPICLevelTwo = false; // "-fpie"
746747
break;
747748

748749
case llvm::Triple::ppc:
749750
case llvm::Triple::sparc:
751+
case llvm::Triple::sparcel:
750752
case llvm::Triple::sparcv9:
751753
IsPICLevelTwo = true; // "-fPIE"
752754
break;

test/Driver/pic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@
227227
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
228228
// RUN: %clang -c %s -target i386-pc-openbsd -### 2>&1 \
229229
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
230+
// RUN: %clang -c %s -target aarch64-unknown-openbsd -### 2>&1 \
231+
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
232+
// RUN: %clang -c %s -target arm-unknown-openbsd -### 2>&1 \
233+
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
230234
// RUN: %clang -c %s -target mips64-unknown-openbsd -### 2>&1 \
231235
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
232236
// RUN: %clang -c %s -target mips64el-unknown-openbsd -### 2>&1 \

0 commit comments

Comments
 (0)