[LLD][PATCH] Do not keep STT_FILE symbols in the symbol table

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 11:07:48 PST 2016


LGTM

On Wed, Jan 20, 2016 at 11:05 AM, Simon Atanasyan <simon at atanasyan.com>
wrote:

> Committed at r258331.
> Thanks for review.
>
> On Wed, Jan 20, 2016 at 6:09 PM, Rafael EspĂ­ndola
> <rafael.espindola at gmail.com> wrote:
> > LGTM, just trim the test a bit please. You don't need a body for
> > _start and if the bug reproduced with -shared you don't even need
> > _start.
> >
> >
> > Thanks,
> > Rafael
> >
> >
> > On 20 January 2016 at 09:25, Simon Atanasyan <simon at atanasyan.com>
> wrote:
> >> Hi,
> >>
> >> Now LLD keeps STT_FILE symbols in the symbol table because
> >> `elf2::shouldKeepInSymtab` returns true for them. But if such symbol
> >> has an empty name, the LLD crashes.
> >>
> >> % cat test.s
> >>  .file ""
> >>  .globl _start;
> >>  _start:
> >>    mov $60, %rax
> >>    mov $42, %rdi
> >>    syscall
> >> % llvm-mc -filetype=obj -triple=x86_64-unknown-linux test.s -o test.o
> >> % lld -flavor gnu test.o
> >>
> >> The problem is in the `elf2::shouldKeepInSymtab`. STT_FILE symbol has
> >> no associated section so the `File.getSection(Sym)` returns null and
> >> the LLD crashes on the `Sec->getSectionHdr()->sh_flags` call.
> >>
> >> The most simple fix is to ignore STT_FILE symbols at all. Attached
> >> patch implements that.
> >>
> >> But maybe we want to keep them for some reasons?
> >>
> >> --
> >> Simon Atanasyan
>
>
>
> --
> Simon Atanasyan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160120/ec40a3b7/attachment.html>


More information about the llvm-commits mailing list