Skip to content

Commit

Permalink
[Hexagon] Enable init_arrays when target is linux-musl
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D76079
  • Loading branch information
SidManning committed Mar 12, 2020
1 parent 4e589e6 commit 6174fdd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/lib/Driver/ToolChains/Hexagon.cpp
Expand Up @@ -544,7 +544,8 @@ unsigned HexagonToolChain::getOptimizationLevel(
void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs,
ArgStringList &CC1Args,
Action::OffloadKind) const {
bool UseInitArrayDefault = false;

bool UseInitArrayDefault = getTriple().isMusl();

if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
options::OPT_fno_use_init_array,
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Driver/hexagon-toolchain-elf.c
Expand Up @@ -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
// -----------------------------------------------------------------------------

0 comments on commit 6174fdd

Please sign in to comment.