[PATCH] D76079: [Hexagon] Enable init_arrays when target is linux-musl
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 12 10:51:13 PDT 2020
sidneym created this revision.
sidneym added reviewers: kparzysz, bcain, adasgupt.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
linux/musl will use init arrays by default.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76079
Files:
clang/lib/Driver/ToolChains/Hexagon.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
@@ -664,3 +664,13 @@
// CHECK089: "/hexagon{{/|\\\\}}lib{{/|\\\\}}crt1.o"
// CHECK089-NOT: -lclang_rt.builtins-hexagon
// CHECK089-NOT: -lc
+// -----------------------------------------------------------------------------
+// Not Passing -fno-use-init-array when musl is selected
+// -----------------------------------------------------------------------------
+// RUN: %clang -### -target hexagon-unknown-linux-musl \
+// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN: -mcpu=hexagonv60 \
+// RUN: %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK090 %s
+// CHECK090-NOT: -fno-use-init-array
+// -----------------------------------------------------------------------------
Index: clang/lib/Driver/ToolChains/Hexagon.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Hexagon.cpp
+++ clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -544,7 +544,8 @@
void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs,
ArgStringList &CC1Args,
Action::OffloadKind) const {
- bool UseInitArrayDefault = false;
+
+ bool UseInitArrayDefault = (getTriple().isMusl()) ? true : false;
if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
options::OPT_fno_use_init_array,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76079.249974.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200312/5633c6e5/attachment.bin>
More information about the llvm-commits
mailing list