[cfe-commits] r168309 - in /cfe/trunk: lib/Driver/ToolChains.cpp test/Driver/constructors.c
Logan Chien
tzuhsiang.chien at gmail.com
Mon Nov 19 03:45:31 PST 2012
Author: logan
Date: Mon Nov 19 05:45:31 2012
New Revision: 168309
URL: http://llvm.org/viewvc/llvm-project?rev=168309&view=rev
Log:
Enable -fuse-init-array for Android X86/MIPS.
The dynamic linker of Android does not support .ctors/.dtors.
We should emit .init_array and .fini_array regardless the
gcc version.
NOTE: This patch does not affect the ARM backend, because
it is required to generate .init_array and .fini_array
for program targeting ARM AAPCS and AEABI.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/constructors.c
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=168309&r1=168308&r2=168309&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Nov 19 05:45:31 2012
@@ -2230,7 +2230,8 @@
void Linux::addClangTargetOptions(ArgStringList &CC1Args) const {
const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion();
- if (V >= Generic_GCC::GCCVersion::Parse("4.7.0"))
+ if (V >= Generic_GCC::GCCVersion::Parse("4.7.0") ||
+ getTriple().getEnvironment() == llvm::Triple::Android)
CC1Args.push_back("-fuse-init-array");
}
Modified: cfe/trunk/test/Driver/constructors.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/constructors.c?rev=168309&r1=168308&r2=168309&view=diff
==============================================================================
--- cfe/trunk/test/Driver/constructors.c (original)
+++ cfe/trunk/test/Driver/constructors.c Mon Nov 19 05:45:31 2012
@@ -10,5 +10,21 @@
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-4-6 %s
-
// CHECK-GCC-4-6-NOT: -fuse-init-array
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target arm-unknown-linux-androideabi \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target mipsel-unknown-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i386-unknown-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+
+// CHECK-ANDROID: -fuse-init-array
More information about the cfe-commits
mailing list