forked from OSchip/llvm-project
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 llvm-svn: 312048
This commit is contained in:
parent
ba2e61b357
commit
c6daf73c72
|
@ -305,6 +305,10 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
|
|||
? "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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -86,6 +86,14 @@ function(add_compiler_rt_component name)
|
|||
add_dependencies(compiler-rt ${name})
|
||||
endfunction()
|
||||
|
||||
macro(set_output_name output name arch)
|
||||
if(ANDROID AND ${arch} STREQUAL "i386")
|
||||
set(${output} "${name}-i686${COMPILER_RT_OS_SUFFIX}")
|
||||
else()
|
||||
set(${output} "${name}-${arch}${COMPILER_RT_OS_SUFFIX}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Adds static or shared runtime for a list of architectures and operating
|
||||
# systems and puts it in the proper directory in the build and install trees.
|
||||
# add_compiler_rt_runtime(<name>
|
||||
|
@ -142,15 +150,15 @@ function(add_compiler_rt_runtime name type)
|
|||
endif()
|
||||
if(type STREQUAL "STATIC")
|
||||
set(libname "${name}-${arch}")
|
||||
set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
|
||||
set_output_name(output_name_${libname} ${name} ${arch})
|
||||
else()
|
||||
set(libname "${name}-dynamic-${arch}")
|
||||
set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
|
||||
set(extra_link_flags_${libname} ${TARGET_${arch}_LINK_FLAGS} ${LIB_LINK_FLAGS})
|
||||
if(WIN32)
|
||||
set(output_name_${libname} ${name}_dynamic-${arch}${COMPILER_RT_OS_SUFFIX})
|
||||
set_output_name(output_name_${libname} ${name}_dynamic ${arch})
|
||||
else()
|
||||
set(output_name_${libname} ${name}-${arch}${COMPILER_RT_OS_SUFFIX})
|
||||
set_output_name(output_name_${libname} ${name} ${arch})
|
||||
endif()
|
||||
endif()
|
||||
set(sources_${libname} ${LIB_SOURCES})
|
||||
|
|
Loading…
Reference in New Issue