[lld] r287617 - Do not save unused pointers to In<ELFT>.

Aleksey Shlyapnikov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 15:19:26 PST 2016


It seems like this change makes check-lld asan unhappy, see
sanitizer-x86_64-linux-fast, for example.

On Mon, Nov 21, 2016 at 8:28 PM, Rui Ueyama via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: ruiu
> Date: Mon Nov 21 22:28:39 2016
> New Revision: 287617
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287617&view=rev
> Log:
> Do not save unused pointers to In<ELFT>.
>
> Modified:
>     lld/trunk/ELF/SyntheticSections.h
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/SyntheticSections.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/
> SyntheticSections.h?rev=287617&r1=287616&r2=287617&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/SyntheticSections.h (original)
> +++ lld/trunk/ELF/SyntheticSections.h Mon Nov 21 22:28:39 2016
> @@ -618,9 +618,6 @@ template <class ELFT> struct In {
>    static GotPltSection<ELFT> *GotPlt;
>    static HashTableSection<ELFT> *HashTab;
>    static InputSection<ELFT> *Interp;
> -  static MipsAbiFlagsSection<ELFT> *MipsAbiFlags;
> -  static MipsOptionsSection<ELFT> *MipsOptions;
> -  static MipsReginfoSection<ELFT> *MipsReginfo;
>    static PltSection<ELFT> *Plt;
>    static RelocationSection<ELFT> *RelaDyn;
>    static RelocationSection<ELFT> *RelaPlt;
> @@ -645,9 +642,6 @@ template <class ELFT> MipsGotSection<ELF
>  template <class ELFT> GotPltSection<ELFT> *In<ELFT>::GotPlt;
>  template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
>  template <class ELFT> InputSection<ELFT> *In<ELFT>::Interp;
> -template <class ELFT> MipsAbiFlagsSection<ELFT> *In<ELFT>::MipsAbiFlags;
> -template <class ELFT> MipsOptionsSection<ELFT> *In<ELFT>::MipsOptions;
> -template <class ELFT> MipsReginfoSection<ELFT> *In<ELFT>::MipsReginfo;
>  template <class ELFT> PltSection<ELFT> *In<ELFT>::Plt;
>  template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
>  template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaPlt;
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.
> cpp?rev=287617&r1=287616&r2=287617&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Mon Nov 21 22:28:39 2016
> @@ -305,24 +305,18 @@ template <class ELFT> void Writer<ELFT>:
>      Symtab<ELFT>::X->Sections.push_back(Common);
>    }
>
> +  // Add MIPS-specific sections.
>    if (Config->EMachine == EM_MIPS) {
> -    // .MIPS.abiflags
> -    if (auto *Sec = MipsAbiFlagsSection<ELFT>::create()) {
> -      In<ELFT>::MipsAbiFlags = Sec;
> +    if (auto *Sec = MipsAbiFlagsSection<ELFT>::create())
>        Symtab<ELFT>::X->Sections.push_back(Sec);
> -    }
> -    // .MIPS.options
> -    if (auto *Sec = MipsOptionsSection<ELFT>::create()) {
> -      In<ELFT>::MipsOptions = Sec;
> +    if (auto *Sec = MipsOptionsSection<ELFT>::create())
>        Symtab<ELFT>::X->Sections.push_back(Sec);
> -    }
> -    // MIPS .reginfo
> -    if (auto *Sec = MipsReginfoSection<ELFT>::create()) {
> -      In<ELFT>::MipsReginfo = Sec;
> +    if (auto *Sec = MipsReginfoSection<ELFT>::create())
>        Symtab<ELFT>::X->Sections.push_back(Sec);
> -    }
>    }
>
> +  // Add .got. MIPS' .got is so different from the other archs,
> +  // it has its own class.
>    if (Config->EMachine == EM_MIPS)
>      In<ELFT>::MipsGot = make<MipsGotSection<ELFT>>();
>    else
> @@ -1498,11 +1492,6 @@ template <class ELFT> void Writer<ELFT>:
>  template <class ELFT> void Writer<ELFT>::writeSections() {
>    uint8_t *Buf = Buffer->getBufferStart();
>
> -  // Finalize MIPS .MIPS.options sections because that contains
> -  // offsets to .got and _gp.
> -  if (In<ELFT>::MipsOptions)
> -    In<ELFT>::MipsOptions->finalize();
> -
>    // PPC64 needs to process relocations in the .opd section
>    // before processing relocations in code-containing sections.
>    Out<ELFT>::Opd = findSection(".opd");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161122/e722a5f9/attachment.html>


More information about the llvm-commits mailing list