[lld] r361802 - [ELF] Replace two addSymbol() call sites with Symbol::resolve(). NFC
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue May 28 05:46:28 PDT 2019
Nice!
On Tue, May 28, 2019 at 7:09 PM Fangrui Song via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: maskray
> Date: Tue May 28 03:12:06 2019
> New Revision: 361802
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361802&view=rev
> Log:
> [ELF] Replace two addSymbol() call sites with Symbol::resolve(). NFC
>
> If we have a handle of the symbol, insert() called by addSymbol() is
> redundant. Just call resolve().
>
> 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=361802&r1=361801&r2=361802&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Tue May 28 03:12:06 2019
> @@ -180,9 +180,9 @@ static Defined *addOptionalRegular(Strin
> if (!S || S->isDefined())
> return nullptr;
>
> - return cast<Defined>(Symtab->addSymbol(
> - Defined{/*File=*/nullptr, Name, Binding, StOther, STT_NOTYPE, Val,
> - /*Size=*/0, Sec}));
> + S->resolve(Defined{/*File=*/nullptr, Name, Binding, StOther,
> STT_NOTYPE, Val,
> + /*Size=*/0, Sec});
> + return cast<Defined>(S);
> }
>
> static Defined *addAbsolute(StringRef Name) {
> @@ -239,9 +239,8 @@ void elf::addReservedSymbols() {
> if (Config->EMachine == EM_PPC || Config->EMachine == EM_PPC64)
> GotOff = 0x8000;
>
> - Symtab->addSymbol(Defined{/*File=*/nullptr, GotSymName, STB_GLOBAL,
> - STV_HIDDEN, STT_NOTYPE, GotOff, /*Size=*/0,
> - Out::ElfHeader});
> + S->resolve(Defined{/*File=*/nullptr, GotSymName, STB_GLOBAL,
> STV_HIDDEN,
> + STT_NOTYPE, GotOff, /*Size=*/0, Out::ElfHeader});
> ElfSym::GlobalOffsetTable = cast<Defined>(S);
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://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/20190528/092a9820/attachment.html>
More information about the llvm-commits
mailing list