[PATCH] D74260: Change default relocation model for hexagon when triple includes musl
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 7 15:29:05 PST 2020
sidneym created this revision.
sidneym added reviewers: kparzysz, bcain, martell, dalias.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Right now if the triple includes musl, saying something like: "--target=x86_64--linux-musl" then the default relocation model is pic. When the target is hexagon I want the default relocation model to be static.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74260
Files:
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/hexagon-toolchain-elf.c
Index: clang/test/Driver/hexagon-toolchain-elf.c
===================================================================
--- clang/test/Driver/hexagon-toolchain-elf.c
+++ clang/test/Driver/hexagon-toolchain-elf.c
@@ -576,3 +576,21 @@
// RUN: | FileCheck -check-prefix=CHECK082 %s
// CHECK082-NOT: -march=
// CHECK082-NOT: -mcpu=
+// -----------------------------------------------------------------------------
+// Check default relocation model
+// -----------------------------------------------------------------------------
+// RUN: %clang -### -target hexagon-linux-unknown-musl \
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN: -mcpu=hexagonv60 \
+// RUN: %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK083 %s
+// CHECK083: "-mrelocation-model" "static"
+// -----------------------------------------------------------------------------
+// Check default relocation model when -fpic is passed
+// -----------------------------------------------------------------------------
+// RUN: %clang -### -target hexagon-linux-unknown-musl -fpic \
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN: -mcpu=hexagonv60 \
+// RUN: %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK084 %s
+// CHECK084: "-mrelocation-model" "pic"
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -919,8 +919,9 @@
}
bool Linux::isPIEDefault() const {
- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
- getTriple().isMusl() || getSanitizerArgs().requiresPIE();
+ return ((getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
+ getTriple().isMusl() || getSanitizerArgs().requiresPIE()) &&
+ getTriple().getArch() != llvm::Triple::hexagon;
}
bool Linux::isNoExecStackDefault() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74260.243296.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200207/986bd0c6/attachment.bin>
More information about the llvm-commits
mailing list