<div dir="ltr">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?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 25, 2016 at 8:35 AM, via llvm-bugs <span dir="ltr"><<a href="mailto:llvm-bugs@lists.llvm.org" target="_blank">llvm-bugs@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    
      
    
    <div><table border="1" cellspacing="0" cellpadding="8">
        <tbody><tr>
          <th>Bug ID</th>
          <td><a title="NEW --- - lld segfault on relocatable link of test/ELF/Inputs/no-augmentation.o" href="https://llvm.org/bugs/show_bug.cgi?id=27878" target="_blank">27878</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld segfault on relocatable link of test/ELF/Inputs/no-augmentation.o
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td><a href="mailto:unassignedbugs@nondot.org" target="_blank">unassignedbugs@nondot.org</a>
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td><a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td><a href="mailto:llvm-bugs@lists.llvm.org" target="_blank">llvm-bugs@lists.llvm.org</a>
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></tbody></table>
      <p>
        </p><div>
        <pre>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>
<span>>::writeSections() + 673 at Writer.cpp:1352</span>
    frame #3: 0x00000000007725ee ld.lld`(anonymous
namespace)::Writer<llvm::object::ELFType<(this=0x00007fffffffbfa0)0, true>
<span>>::run() + 318 at Writer.cpp:233</span>
    frame #4: 0x00000000007cd618 ld.lld`void
lld::elf::writeResult<llvm::object::ELFType<(llvm::support::endianness)0, true>
<span>>(Symtab=0x00007fffffffd680)0, true> >*) + 7208 at Writer.cpp:201</span>
    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)</pre>
        </div>
      <p></p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </div>

<br>_______________________________________________<br>
llvm-bugs mailing list<br>
<a href="mailto:llvm-bugs@lists.llvm.org">llvm-bugs@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs</a><br>
<br></blockquote></div><br></div>