[PATCH] D44381: [mips] Prevent PIC to be set to level 2
Aleksandar Beserminji via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 16 03:26:39 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330118: [mips] Prevent PIC to be set to level 2 (authored by abeserminji, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D44381?vs=142406&id=142609#toc
Repository:
rL LLVM
https://reviews.llvm.org/D44381
Files:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/test/Driver/pic.c
Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1007,12 +1007,17 @@
if ((ROPI || RWPI) && (PIC || PIE))
ToolChain.getDriver().Diag(diag::err_drv_ropi_rwpi_incompatible_with_pic);
- // When targettng MIPS64 with N64, the default is PIC, unless -mno-abicalls is
- // used.
- if ((Triple.getArch() == llvm::Triple::mips64 ||
- Triple.getArch() == llvm::Triple::mips64el) &&
- Args.hasArg(options::OPT_mno_abicalls))
- return std::make_tuple(llvm::Reloc::Static, 0U, false);
+ if (Triple.getArch() == llvm::Triple::mips ||
+ Triple.getArch() == llvm::Triple::mipsel ||
+ Triple.getArch() == llvm::Triple::mips64 ||
+ Triple.getArch() == llvm::Triple::mips64el) {
+ // When targettng MIPS with -mno-abicalls, it's always static.
+ if(Args.hasArg(options::OPT_mno_abicalls))
+ return std::make_tuple(llvm::Reloc::Static, 0U, false);
+ // Unlike other architectures, MIPS, even with -fPIC/-mxgot/multigot,
+ // does not use PIC level 2 for historical reasons.
+ IsPICLevelTwo = false;
+ }
if (PIC)
return std::make_tuple(llvm::Reloc::PIC_, IsPICLevelTwo ? 2U : 1U, PIE);
Index: cfe/trunk/test/Driver/pic.c
===================================================================
--- cfe/trunk/test/Driver/pic.c
+++ cfe/trunk/test/Driver/pic.c
@@ -292,9 +292,9 @@
// RUN: %clang -c %s -target mipsel-linux-android14 -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
// RUN: %clang -c %s -target mipsel-linux-android16 -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
// RUN: %clang -c %s -target mipsel-linux-android24 -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
//
// 64-bit Android targets are always PIE.
// RUN: %clang -c %s -target aarch64-linux-android -### 2>&1 \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44381.142609.patch
Type: text/x-patch
Size: 2074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180416/0a56a6ee/attachment.bin>
More information about the cfe-commits
mailing list