[lld] r294346 - Simplify symbol computation for non alloc sections.

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 16:20:36 PST 2017


This is causing regression in our build, I'm now getting a lot of errors
which look like:

ld.lld: error:
./build-magenta-pc-x86-64/target/target.mod.o:(.debug_info+0x6): relocation
R_X86_64_32 out of range
ld.lld: error: ./build-magenta-pc-x86-64/app/app.mod.o:(.debug_info+0x6):
relocation R_X86_64_32 out of range
ld.lld: error:
./build-magenta-pc-x86-64/platform/platform.mod.o:(.debug_info+0x6):
relocation R_X86_64_32 out of range
...
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to
see all errors)

I'll try to extract a minimal reproducer.

On Tue, Feb 7, 2017 at 12:33 PM Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Tue Feb  7 14:22:04 2017
> New Revision: 294346
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294346&view=rev
> Log:
> Simplify symbol computation for non alloc sections.
>
> We now just keep the address the section would have if it was
> allocatable. Only the writer ignores it at the very end.
>
> Modified:
>     lld/trunk/ELF/LinkerScript.cpp
>     lld/trunk/ELF/OutputSections.cpp
>
> Modified: lld/trunk/ELF/LinkerScript.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=294346&r1=294345&r2=294346&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/LinkerScript.cpp (original)
> +++ lld/trunk/ELF/LinkerScript.cpp Tue Feb  7 14:22:04 2017
> @@ -101,12 +101,8 @@ static void assignSymbol(SymbolAssignmen
>
>    if (auto *Body = dyn_cast<DefinedSynthetic>(Cmd->Sym)) {
>      Body->Section = Cmd->Expression.Section();
> -    if (Body->Section) {
> -      uint64_t VA = 0;
> -      if (Body->Section->Flags & SHF_ALLOC)
> -        VA = Body->Section->Addr;
> -      Body->Value = Cmd->Expression(Dot) - VA;
> -    }
> +    if (Body->Section)
> +      Body->Value = Cmd->Expression(Dot) - Body->Section->Addr;
>      return;
>    }
>
> @@ -802,12 +798,9 @@ void LinkerScript<ELFT>::assignAddresses
>    }
>
>    uintX_t MinVA = std::numeric_limits<uintX_t>::max();
> -  for (OutputSectionBase *Sec : *OutputSections) {
> +  for (OutputSectionBase *Sec : *OutputSections)
>      if (Sec->Flags & SHF_ALLOC)
>        MinVA = std::min<uint64_t>(MinVA, Sec->Addr);
> -    else
> -      Sec->Addr = 0;
> -  }
>
>    allocateHeaders<ELFT>(Phdrs, *OutputSections, MinVA);
>  }
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=294346&r1=294345&r2=294346&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Tue Feb  7 14:22:04 2017
> @@ -57,7 +57,7 @@ void OutputSectionBase::writeHeaderTo(ty
>    Shdr->sh_flags = Flags;
>    Shdr->sh_info = Info;
>    Shdr->sh_link = Link;
> -  Shdr->sh_addr = Addr;
> +  Shdr->sh_addr = (Flags & SHF_ALLOC) ? Addr : 0;
>    Shdr->sh_size = Size;
>    Shdr->sh_name = ShName;
>  }
>
>
> _______________________________________________
> 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/20170208/6334c62b/attachment.html>


More information about the llvm-commits mailing list