[clang] [clang][hexagon] Add support for -nolibc (PR #67515)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 22:41:53 PDT 2023


================
@@ -401,6 +401,30 @@
 // CHECK338-NOT: "--end-group"
 // CHECK338: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o"
 
+// RUN: %clangxx -### -target hexagon-unknown-elf \
+// RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN:   -mcpu=hexagonv60 \
+// RUN:   -nolibc \
+// RUN:   %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOLIBC %s
+// CHECK-NOLIBC: "-cc1"
+// CHECK-NOLIBC: {{hexagon-link|ld}}
+// CHECK-NOLIBC: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o"
+// CHECK-NOLIBC: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o"
+// CHECK-NOLIBC: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o"
+// CHECK-NOLIBC: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60"
+// CHECK-NOLIBC: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib"
+// CHECK-NOLIBC: "{{[^"]+}}.o"
+// CHECK-NOLIBC: "-lstdc++"
+// CHECK-NOLIBC: "-lm"
----------------
MaskRay wrote:

The pattern `{{hexagon-link|ld}}` is too broad. The `ld` part may match `clang -cc1 .../build/` if someone's build directory is called `build` (`ld` is a substring!).

With `-fuse-ld=lld`, we can ensure that the linker is not affected by `CLANG_DEFAULT_LINKER` and `"{{.*}}ld.lld"` will occur...

https://github.com/llvm/llvm-project/pull/67515


More information about the cfe-commits mailing list