[lld] r295240 - Make --export-dynamic work on non-PIC/PIE targets.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 14:34:10 PST 2017


Please add a testcase.

Cheers,
Rafael

Ed Schouten via llvm-commits <llvm-commits at lists.llvm.org> writes:

> Author: ed
> Date: Wed Feb 15 15:51:25 2017
> New Revision: 295240
>
> URL: http://llvm.org/viewvc/llvm-project?rev=295240&view=rev
> Log:
> Make --export-dynamic work on non-PIC/PIE targets.
>
> For CloudABI I'm only interested in generating non-PIC/PIE executables
> on armv6 and i686, as PIE introduces larger overhead than on aarch64 and
> x86_64. Still, I want to be able to instruct the linker to generate a
> dynamic symbol table if requested. One example use for this is that
> dynamic symbol tables can be used by programs to print nicely formatted
> stacktraces, including symbol names.
>
> Right now there seems to be some logic in LLD that it only wants to emit
> dynamic symbol tables when either linking against libraries or when
> building PIC. Let's extend this to also take --export-dynamic into
> account.
>
> Reviewed by:	ruiu
> Differential Revision:	https://reviews.llvm.org/D29982
>
> Modified:
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=295240&r1=295239&r2=295240&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Wed Feb 15 15:51:25 2017
> @@ -354,7 +354,8 @@ template <class ELFT> void Writer<ELFT>:
>  
>    // Add MIPS-specific sections.
>    bool HasDynSymTab =
> -      !Symtab<ELFT>::X->getSharedFiles().empty() || Config->pic();
> +      !Symtab<ELFT>::X->getSharedFiles().empty() || Config->pic() ||
> +      Config->ExportDynamic;
>    if (Config->EMachine == EM_MIPS) {
>      if (!Config->Shared && HasDynSymTab) {
>        In<ELFT>::MipsRldMap = make<MipsRldMapSection<ELFT>>();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list