<div dir="ltr">LGTM</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 20, 2016 at 11:05 AM, Simon Atanasyan <span dir="ltr"><<a href="mailto:simon@atanasyan.com" target="_blank">simon@atanasyan.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Committed at r258331.<br>
Thanks for review.<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Jan 20, 2016 at 6:09 PM, Rafael Espíndola<br>
<<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
> LGTM, just trim the test a bit please. You don't need a body for<br>
> _start and if the bug reproduced with -shared you don't even need<br>
> _start.<br>
><br>
><br>
> Thanks,<br>
> Rafael<br>
><br>
><br>
> On 20 January 2016 at 09:25, Simon Atanasyan <<a href="mailto:simon@atanasyan.com">simon@atanasyan.com</a>> wrote:<br>
>> Hi,<br>
>><br>
>> Now LLD keeps STT_FILE symbols in the symbol table because<br>
>> `elf2::shouldKeepInSymtab` returns true for them. But if such symbol<br>
>> has an empty name, the LLD crashes.<br>
>><br>
>> % cat test.s<br>
>>  .file ""<br>
>>  .globl _start;<br>
>>  _start:<br>
>>    mov $60, %rax<br>
>>    mov $42, %rdi<br>
>>    syscall<br>
>> % llvm-mc -filetype=obj -triple=x86_64-unknown-linux test.s -o test.o<br>
>> % lld -flavor gnu test.o<br>
>><br>
>> The problem is in the `elf2::shouldKeepInSymtab`. STT_FILE symbol has<br>
>> no associated section so the `File.getSection(Sym)` returns null and<br>
>> the LLD crashes on the `Sec->getSectionHdr()->sh_flags` call.<br>
>><br>
>> The most simple fix is to ignore STT_FILE symbols at all. Attached<br>
>> patch implements that.<br>
>><br>
>> But maybe we want to keep them for some reasons?<br>
>><br>
>> --<br>
>> Simon Atanasyan<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Simon Atanasyan<br>
</font></span></blockquote></div><br></div>