diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index be7851adecea66..76cedf312d68a1 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -379,9 +379,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA, if (NeedsXRayDeps) linkXRayRuntimeDeps(HTC, Args, CmdArgs); - CmdArgs.push_back("-lclang_rt.builtins-hexagon"); if (!Args.hasArg(options::OPT_nolibc)) CmdArgs.push_back("-lc"); + CmdArgs.push_back("-lclang_rt.builtins-hexagon"); } if (D.CCCIsCXX()) { if (HTC.ShouldLinkCXXStdlib(Args)) diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c index 86cc9a30e932c6..6f7f3b20f9141f 100644 --- a/clang/test/Driver/hexagon-toolchain-linux.c +++ b/clang/test/Driver/hexagon-toolchain-linux.c @@ -11,7 +11,7 @@ // CHECK000-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o // CHECK000: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1" // CHECK000: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o" -// CHECK000: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK000: "-lc" "-lclang_rt.builtins-hexagon" // ----------------------------------------------------------------------------- // Passing --musl --shared // ----------------------------------------------------------------------------- @@ -21,7 +21,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | FileCheck -check-prefix=CHECK001 %s // CHECK001-NOT: -dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1 // CHECK001: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o" -// CHECK001: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK001: "-lc" "-lclang_rt.builtins-hexagon" // CHECK001-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o // ----------------------------------------------------------------------------- // Passing --musl -nostdlib @@ -33,8 +33,8 @@ // CHECK002: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1" // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o // CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o -// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // CHECK002-NOT: "-lc" +// CHECK002-NOT: "-lclang_rt.builtins-hexagon" // ----------------------------------------------------------------------------- // Passing --musl -nostartfiles // ----------------------------------------------------------------------------- @@ -45,7 +45,7 @@ // CHECK003: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1" // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}Scrt1.o // CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o -// CHECK003: "-lclang_rt.builtins-hexagon" "-lc" +// CHECK003: "-lc" "-lclang_rt.builtins-hexagon" // ----------------------------------------------------------------------------- // Passing --musl -nodefaultlibs // ----------------------------------------------------------------------------- @@ -55,8 +55,8 @@ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK004 %s // CHECK004: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1" // CHECK004: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o" -// CHECK004-NOT: "-lclang_rt.builtins-hexagon" // CHECK004-NOT: "-lc" +// CHECK004-NOT: "-lclang_rt.builtins-hexagon" // ----------------------------------------------------------------------------- // Passing --musl -nolibc // -----------------------------------------------------------------------------