Create an instance of Target after reading all input files. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 29 09:11:34 PDT 2019


Yes, this is the only place where we were using Target while reading input
files.

On Fri, Mar 29, 2019 at 2:09 AM George Rimar <grimar at accesssoftek.com>
wrote:

> Were changes in 'elf::addReservedSymbols()' intentional?
> (I am not sure they are NFC from the context and they do not seem to be
> relative with the patch topic).
>
> @@ -214,17 +214,24 @@ void elf::addReservedSymbols() {
>    // the .got section.
>    // We do not allow _GLOBAL_OFFSET_TABLE_ to be defined by input objects
> as the
>    // correctness of some relocations depends on its value.
> -  StringRef GotTableSymName =
> +  StringRef GotSymName =
>        (Config->EMachine == EM_PPC64) ? ".TOC." : "_GLOBAL_OFFSET_TABLE_";
> -  if (Symbol *S = Symtab->find(GotTableSymName)) {
> -    if (S->isDefined())
> +
> +  if (Symbol *S = Symtab->find(GotSymName)) {
> +    if (S->isDefined()) {
>        error(toString(S->File) + " cannot redefine linker defined symbol
> '" +
> -            GotTableSymName + "'");
> -    else
> -      ElfSym::GlobalOffsetTable = Symtab->addDefined(
> -          GotTableSymName, STV_HIDDEN, STT_NOTYPE, Target->GotBaseSymOff,
> -          /*Size=*/0, STB_GLOBAL, Out::ElfHeader,
> -          /*File=*/nullptr);
> +            GotSymName + "'");
> +      return;
> +    }
> +
> +    uint64_t GotOff = 0;
> +    if (Config->EMachine == EM_PPC || Config->EMachine == EM_PPC64)
> +      GotOff = 0x8000;
> +
> +    ElfSym::GlobalOffsetTable =
> +        Symtab->addDefined(GotSymName, STV_HIDDEN, STT_NOTYPE, GotOff,
> +                           /*Size=*/0, STB_GLOBAL, Out::ElfHeader,
> +                           /*File=*/nullptr);
>    }
>
>
> Best regards,
> George | Developer | Access Softek, Inc
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190329/d473bd98/attachment.html>


More information about the llvm-commits mailing list