aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-12-09 04:45:18 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-12-09 04:45:18 +0000
commitd4e6e7e4a8c1f64162e14220579abab53e0ca10c (patch)
tree64d445a11761a23e2c0c1fda9979290b1c9832b3 /lib/Driver/ToolChains.cpp
parent8a0f15592b08cdcbeb9f0e9d5684bacdedfb6473 (diff)
Fix the --hash-style option when the target is MIPS as it is
incompatible with the MIPS ABI. Patch by Simon Atanasyan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146243 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r--lib/Driver/ToolChains.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 989fe44925..e5b884be33 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1882,13 +1882,24 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
ExtraOpts.push_back("-X");
- if (IsRedhat(Distro) || IsOpenSuse(Distro) || Distro == UbuntuMaverick ||
- Distro == UbuntuNatty || Distro == UbuntuOneiric)
- ExtraOpts.push_back("--hash-style=gnu");
-
- if (IsDebian(Distro) || IsOpenSuse(Distro) || Distro == UbuntuLucid ||
- Distro == UbuntuJaunty || Distro == UbuntuKarmic)
- ExtraOpts.push_back("--hash-style=both");
+ const bool IsMips = Arch == llvm::Triple::mips ||
+ Arch == llvm::Triple::mipsel ||
+ Arch == llvm::Triple::mips64 ||
+ Arch == llvm::Triple::mips64el;
+
+ // 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 (IsRedhat(Distro) || IsOpenSuse(Distro) || Distro == UbuntuMaverick ||
+ Distro == UbuntuNatty || Distro == UbuntuOneiric)
+ ExtraOpts.push_back("--hash-style=gnu");
+
+ if (IsDebian(Distro) || IsOpenSuse(Distro) || Distro == UbuntuLucid ||
+ Distro == UbuntuJaunty || Distro == UbuntuKarmic)
+ ExtraOpts.push_back("--hash-style=both");
+ }
if (IsRedhat(Distro))
ExtraOpts.push_back("--no-add-needed");