[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 <name> 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/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 244b5a1d..36de1e44 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -650,6 +650,8 @@
// Add strings. We know that these are the last strings to be added to
// DynStrTab and doing this here allows this function to set DT_STRSZ.
+ for (StringRef S : Config->AuxiliaryList)
+ Add({DT_AUXILIARY, Out<ELFT>::DynStrTab->addString(S)});
if (!Config->RPath.empty())
Add({Config->EnableNewDtags ? DT_RUNPATH : DT_RPATH,
Out<ELFT>::DynStrTab->addString(Config->RPath)});