From 2bd4479ce891cb5e9abe77e4286ca4ce139adb61 Mon Sep 17 00:00:00 2001 From: Sumanth Gundapaneni Date: Thu, 19 Jan 2017 16:54:04 +0000 Subject: [PATCH] [Hexagon] Linux linker does not support .gnu-hash Hexagon Linux dynamic loader does not use (in fact does not support) .gnu-hash Differential Revision: https://reviews.llvm.org/D28865 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292496 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 4 +++- test/Driver/linux-ld.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 9bc9ae4f6a..a4e797587c 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -4122,6 +4122,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) const bool IsAndroid = Triple.isAndroid(); const bool IsMips = isMipsArch(Arch); + const bool IsHexagon = Arch == llvm::Triple::hexagon; if (IsMips && !SysRoot.empty()) ExtraOpts.push_back("--sysroot=" + SysRoot); @@ -4131,7 +4132,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) // .gnu.hash needs symbols to be grouped by hash code whereas the MIPS // ABI requires a mapping between the GOT and the symbol table. // Android loader does not support .gnu.hash. - if (!IsMips && !IsAndroid) { + // Hexagon linker/loader does not support .gnu.hash + if (!IsMips && !IsAndroid && !IsHexagon) { if (Distro.IsRedhat() || Distro.IsOpenSUSE() || (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick)) ExtraOpts.push_back("--hash-style=gnu"); diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 5d1001beb0..e5aa870866 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -705,6 +705,14 @@ // CHECK-PPC64LE-ELFv2: "-m" "elf64lppc" // CHECK-PPC64LE-ELFv2: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld64.so.2" // +// Check that we do not pass --hash-style=gnu or --hash-style=both to +// hexagon linux linker +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=hexagon-linux-gnu \ +// RUN: | FileCheck --check-prefix=CHECK-HEXAGON %s +// CHECK-HEXAGON: "{{.*}}hexagon-link{{(.exe)?}}" +// CHECK-HEXAGON-NOT: "--hash-style={{gnu|both}}" +// // Check that we do not pass --hash-style=gnu and --hash-style=both to linker // and provide correct path to the dynamic linker and emulation mode when build // for MIPS platforms. -- 2.40.0