From: George Rimar Date: Fri, 2 Sep 2016 09:13:05 +0000 (+0000) Subject: [ELF] - Fix for: bug 30237 - lld does not implement -f option X-Git-Tag: llvmorg-4.0.0-rc1~10784 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b952ece2df20ef7ffc3afed3c1b6f8e7e1ddd01b;p=platform%2Fupstream%2Fllvm.git [ELF] - Fix for: bug 30237 - lld does not implement -f option FreeBSD's libstdc++ build (used on tier-2 architectures) uses GNU ld's -f option, which sets the DT_AUXILIARY field to the specified name. Multiple -f options may be specified and the DT_AUXILIARY entries will be added in the order in which they appear. Patch implements that option. Differential revision: https://reviews.llvm.org/D24139 llvm-svn: 280475 --- diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index 6eec7e1..7bf650c3 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -76,6 +76,7 @@ struct Configuration { llvm::StringRef Sysroot; std::string RPath; std::vector VersionDefinitions; + std::vector AuxiliaryList; std::vector DynamicList; std::vector SearchPaths; std::vector Undefined; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index c1a6d3f..9b44b1b 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -490,6 +490,11 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->OFormatBinary = isOutputFormatBinary(Args); + for (auto *Arg : Args.filtered(OPT_auxiliary)) + Config->AuxiliaryList.push_back(Arg->getValue()); + if (!Config->Shared && !Config->AuxiliaryList.empty()) + error("-f may not be used without -shared"); + for (auto *Arg : Args.filtered(OPT_undefined)) Config->Undefined.push_back(Arg->getValue()); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index b7be00a..acfba9e 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -7,6 +7,8 @@ class J: Joined<["--", "-"], name>; class S: Separate<["--", "-"], name>; class JS: JoinedOrSeparate<["--", "-"], name>; +def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; + def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; def Bsymbolic_functions: F<"Bsymbolic-functions">, @@ -188,6 +190,7 @@ def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"