summaryrefslogtreecommitdiffstats
path: root/clang/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
commit0b84291222802702cbe8f30211680a6d754f9927 (patch)
treed5f066485335bbfa1a9f623c23c54532f34a5aab /clang/lib/Driver/ToolChains.cpp
parent79ea1d887791e8519fee96dbb66cd3672dc700d4 (diff)
downloadbcm5719-llvm-0b84291222802702cbe8f30211680a6d754f9927.tar.gz
bcm5719-llvm-0b84291222802702cbe8f30211680a6d754f9927.zip
Fix the --hash-style option when the target is MIPS as it is
incompatible with the MIPS ABI. Patch by Simon Atanasyan. llvm-svn: 146243
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 989fe44925f..e5b884be33b 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/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");
OpenPOWER on IntegriCloud