Hi,

this patch removes --hash-style option from driver-generated link
command line on Android. The reason is that Android linker does not
support .gnu.hash, so the default (sysv) is the correct value. What's
worse, there is a bug in the older version of GNU ld used in the
current Android toolchain that messes up .hash section whenever
.gnu.hash is present.

Please review.
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp	(revision 147931)
+++ lib/Driver/ToolChains.cpp	(working copy)
@@ -1918,11 +1918,14 @@
                       Arch == llvm::Triple::mips64 ||
                       Arch == llvm::Triple::mips64el;
 
+  // Android loader does not support .gnu.hash.
+  const bool IsAndroid = Triple.getEnvironment() == llvm::Triple::ANDROIDEABI;
+
   // Do not use 'gnu' hash style for Mips targets because .gnu.hash
   // and the MIPS ABI require .dynsym to be sorted in different ways.
   // .gnu.hash needs symbols to be grouped by hash code whereas the MIPS
   // ABI requires a mapping between the GOT and the symbol table.
-  if (!IsMips) {
+  if (!IsMips && !IsAndroid) {
     if (IsRedhat(Distro) || IsOpenSuse(Distro) || Distro == UbuntuMaverick ||
         Distro == UbuntuNatty || Distro == UbuntuOneiric)
       ExtraOpts.push_back("--hash-style=gnu");
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to