[llvm-bugs] [Bug 27878] New: lld segfault on relocatable link of test/ELF/Inputs/no-augmentation.o

Simon Atanasyan via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 25 09:21:47 PDT 2016


Linker should merge input .MIPS.options sections into the single
output .MIPS.options section. Now it works if '-r' is not specified. It's
interesting that both bfd and gold linkers have a bug. In case of '-r'
option they just concatenate input .MIPS.options sections one by one.

By the way now LLD does not support '-r' for MIPS by this and some other
more important reasons.

​Simon​

On Wed, May 25, 2016 at 6:51 PM, Rui Ueyama <ruiu at google.com> wrote:

> It crashes because a .MIPS.options input section has no output section.
> Simon, do you know what is the best way to handle that type of section for
> -r? Should we just copy .MIPS.options to output? What if there are two or
> more .MIPS.options input sections from multiple input object files?
>
> On Wed, May 25, 2016 at 8:35 AM, via llvm-bugs <llvm-bugs at lists.llvm.org>
> wrote:
>
>> Bug ID 27878 <https://llvm.org/bugs/show_bug.cgi?id=27878>
>> Summary lld segfault on relocatable link of
>> test/ELF/Inputs/no-augmentation.o
>> Product lld
>> Version unspecified
>> Hardware PC
>> OS FreeBSD
>> Status NEW
>> Severity normal
>> Priority P
>> Component All Bugs
>> Assignee unassignedbugs at nondot.org
>> Reporter emaste at freebsd.org
>> CC llvm-bugs at lists.llvm.org
>> Classification Unclassified
>>
>> Discovered while creating the test added in r270706.
>>
>> % build-nodebug/bin/lldb build-debug/bin/ld.lld -- -r
>> tools/lld/test/ELF/Inputs/no-augmentation.o
>> (lldb) target create "build-debug/bin/ld.lld"
>> Current executable set to 'build-debug/bin/ld.lld' (x86_64).
>> (lldb) settings set -- target.run-args  "-r"
>> "tools/lld/test/ELF/Inputs/no-augmentation.o"
>> (lldb) run
>> Process 60069 launching
>> Process 60069 launched: '/tank/emaste/src/llvm/build-debug/bin/ld.lld' (x86_64)
>> Process 60069 stopped
>> * thread #1: tid = 101148, 0x0000000000650bb2
>> ld.lld`lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >::writeLocalSymbols(this=0x0000000806858160, Buf=<no value available>) +
>> 1090 at OutputSections.cpp:1332, stop reason = signal SIGSEGV: invalid address
>> (fault address: 0x8)
>>     frame #0: 0x0000000000650bb2
>> ld.lld`lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >::writeLocalSymbols(this=0x0000000806858160, Buf=<no value available>) +
>> 1090 at OutputSections.cpp:1332
>>    1329         ESym->st_value = Body.Value;
>>    1330       } else {
>>    1331         const OutputSectionBase<ELFT> *OutSec = Section->OutSec;
>> -> 1332         ESym->st_shndx = OutSec->SectionIndex;
>>    1333         ESym->st_value = OutSec->getVA() + Section->getOffset(Body);
>>    1334       }
>>    1335       ESym->st_name = P.second;
>> (lldb) bt
>> * thread #1: tid = 101148, 0x0000000000650bb2
>> ld.lld`lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >::writeLocalSymbols(this=0x0000000806858160, Buf=<no value available>) +
>> 1090 at OutputSections.cpp:1332, stop reason = signal SIGSEGV: invalid address
>> (fault address: 0x8)
>>   * frame #0: 0x0000000000650bb2
>> ld.lld`lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >::writeLocalSymbols(this=0x0000000806858160, Buf=<no value available>) +
>> 1090 at OutputSections.cpp:1332
>>     frame #1: 0x0000000000650750
>> ld.lld`lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >::writeTo(this=0x0000000806858160, Buf="") + 96 at
>> OutputSections.cpp:1310
>>     frame #2: 0x0000000000778a51 ld.lld`(anonymous
>> namespace)::Writer<llvm::object::ELFType<(this=0x00007fffffffbfa0)0, true>>::writeSections() + 673 at Writer.cpp:1352
>>     frame #3: 0x00000000007725ee ld.lld`(anonymous
>> namespace)::Writer<llvm::object::ELFType<(this=0x00007fffffffbfa0)0, true>>::run() + 318 at Writer.cpp:233
>>     frame #4: 0x00000000007cd618 ld.lld`void
>> lld::elf::writeResult<llvm::object::ELFType<(llvm::support::endianness)0, true>>(Symtab=0x00007fffffffd680)0, true> >*) + 7208 at Writer.cpp:201
>>     frame #5: 0x00000000005538b7 ld.lld`void
>> lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)0,
>> true> >(this=0x00007fffffffe168, Args=0x00007fffffffdc90) + 3175 at
>> Driver.cpp:521
>>     frame #6: 0x00000000005451ad
>> ld.lld`lld::elf::LinkerDriver::main(this=0x00007fffffffe168,
>> ArgsArr=ArrayRef<const char *> @ 0x00007fffffffdec8) + 1709 at Driver.cpp:281
>>     frame #7: 0x0000000000544a96 ld.lld`lld::elf::link(Args=ArrayRef<const char
>> *> @ 0x00007fffffffe3c0, Error=0x00000000048929e8) + 182 at Driver.cpp:49
>>     frame #8: 0x0000000000452077 ld.lld`main(Argc=3, Argv=0x00007fffffffe500) +
>> 231 at lld.cpp:106
>>     frame #9: 0x0000000000451eaf ld.lld`_start(ap=<unavailable>,
>> cleanup=<unavailable>) + 367 at crt1.c:78 [opt]
>> (lldb)
>>
>> ------------------------------
>> You are receiving this mail because:
>>
>>    - You are on the CC list for the bug.
>>
>>
>> _______________________________________________
>> llvm-bugs mailing list
>> llvm-bugs at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
>>
>>
>


-- 
Simon Atanasyan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160525/9df588f4/attachment-0001.html>


More information about the llvm-bugs mailing list