hvdijk updated this revision to Diff 359016. hvdijk edited the summary of this revision. hvdijk added a reviewer: MaskRay. hvdijk added a comment.
Updated to use `Triple.isX32()`. Should we perhaps just merge this as is, ahead of the update to compiler-rt to create x32 objects? For non-x32, this change is NFC, for x32, the change results in a better error message about compiler-rt objects not existing rather than being for the wrong architecture. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D100148/new/ https://reviews.llvm.org/D100148 Files: clang/lib/Driver/ToolChain.cpp clang/test/Driver/sanitizer-ld.c Index: clang/test/Driver/sanitizer-ld.c =================================================================== --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -284,28 +284,28 @@ // CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // RUN: %clang -fsanitize=float-divide-by-zero %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: -static-libsan \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx -// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "--no-whole-archive" +// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x32.a" "--no-whole-archive" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx // CHECK-UBSAN-LINUX-NOT: "-lstdc++" Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -383,6 +383,9 @@ if (TC.getArch() == llvm::Triple::x86 && Triple.isAndroid()) return "i686"; + if (TC.getArch() == llvm::Triple::x86_64 && Triple.isX32()) + return "x32"; + return llvm::Triple::getArchTypeName(TC.getArch()); }
Index: clang/test/Driver/sanitizer-ld.c =================================================================== --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -284,28 +284,28 @@ // CHECK-MSAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.msan // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // RUN: %clang -fsanitize=float-divide-by-zero %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ -// RUN: -target i386-unknown-linux -fuse-ld=ld \ +// RUN: -target x86_64-unknown-linux-gnux32 -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ // RUN: -static-libsan \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx -// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "--no-whole-archive" +// CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone-x32.a" "--no-whole-archive" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan // CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx // CHECK-UBSAN-LINUX-NOT: "-lstdc++" Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -383,6 +383,9 @@ if (TC.getArch() == llvm::Triple::x86 && Triple.isAndroid()) return "i686"; + if (TC.getArch() == llvm::Triple::x86_64 && Triple.isX32()) + return "x32"; + return llvm::Triple::getArchTypeName(TC.getArch()); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits