From 83214dfb01d45aa57e3cb0b1a9314e0e3d83e281 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 4 Aug 2017 02:39:27 +0000 Subject: [PATCH] [Driver][Fuchsia] Pass --hash-style=gnu to the linker The .gnu_hash format is superior, and all versions of the Fuchsia dynamic linker support it. Differential Revision: https://reviews.llvm.org/D36254 llvm-svn: 310017 --- clang/lib/Driver/ToolChains/Fuchsia.cpp | 6 ++++-- clang/test/Driver/fuchsia.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp index a825c3827114..368a8bc998e3 100644 --- a/clang/lib/Driver/ToolChains/Fuchsia.cpp +++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp @@ -64,10 +64,12 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_s)) CmdArgs.push_back("-s"); - if (Args.hasArg(options::OPT_r)) + if (Args.hasArg(options::OPT_r)) { CmdArgs.push_back("-r"); - else + } else { CmdArgs.push_back("--build-id"); + CmdArgs.push_back("--hash-style=gnu"); + } CmdArgs.push_back("--eh-frame-hdr"); diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c index 73154fb4f150..5b61bf424f55 100644 --- a/clang/test/Driver/fuchsia.c +++ b/clang/test/Driver/fuchsia.c @@ -9,6 +9,7 @@ // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id" +// CHECK: "--hash-style=gnu" // CHECK: "-dynamic-linker" "ld.so.1" // CHECK: Scrt1.o // CHECK-NOT: crti.o