r312048 - Restore clang_rt library name on i686-android.

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 15:12:31 PDT 2017


Author: eugenis
Date: Tue Aug 29 15:12:31 2017
New Revision: 312048

URL: http://llvm.org/viewvc/llvm-project?rev=312048&view=rev
Log:
Restore clang_rt library name on i686-android.

Summary:
Recent changes canonicalized clang_rt library names to refer to
"i386" on all x86 targets. Android historically uses i686.

This change adds a special case to keep i686 in all clang_rt
libraries when targeting Android.

Reviewers: hans, mgorny, beanz

Subscribers: srhines, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D37278

Modified:
    cfe/trunk/lib/Driver/ToolChain.cpp
    cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=312048&r1=312047&r2=312048&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Aug 29 15:12:31 2017
@@ -305,6 +305,10 @@ static StringRef getArchNameForCompilerR
                ? "armhf"
                : "arm";
 
+  // For historic reasons, Android library is using i686 instead of i386.
+  if (TC.getArch() == llvm::Triple::x86 && Triple.isAndroid())
+    return "i686";
+
   return llvm::Triple::getArchTypeName(TC.getArch());
 }
 

Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=312048&r1=312047&r2=312048&view=diff
==============================================================================
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Tue Aug 29 15:12:31 2017
@@ -133,6 +133,18 @@
 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     -target i686-linux-android -fuse-ld=ld -fsanitize=address \
+// RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
+//
+// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-X86-NOT: "-lc"
+// CHECK-ASAN-ANDROID-X86: "-pie"
+// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
+// CHECK-ASAN-ANDROID-X86: libclang_rt.asan-i686-android.so"
+// CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     -target arm-linux-androideabi -fsanitize=address \
 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:     -shared-libasan \




More information about the cfe-commits mailing list