<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - segfault linking FreeBSD/mips64 base system"
   href="http://bugs.llvm.org/show_bug.cgi?id=32504">32504</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>segfault linking FreeBSD/mips64 base system
          </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>URL</th>
          <td>https://people.freebsd.org/~emaste/lld/lld-mips.tar
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>emaste@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While testing D31528 (Multi-GOT) with the FreeBSD base system I encountered a
segfault (linking libc), and observed that it's reproducible without the patch
applied.

--- libc.so.7.full ---
building shared library libc.so.7
cc -isystem /usr/obj/mips.mips64/usr/home/emaste/src/freebsd/tmp/usr/include
-L/usr/obj/mips.mips64/usr/home/emaste/src/freebsd/tmp/usr/lib
-B/usr/obj/mips.mips64/usr/home/emaste/src/freebsd/tmp/usr/lib
--sysroot=/usr/obj/mips.mips64/usr/home/emaste/src/freebsd/tmp
-B/usr/obj/mips.mips64/usr/home/emaste/src/freebsd/tmp/usr/bin  -EB
-nodefaultlibs -Wl,--version-script=Version.map  -shared -Wl,-x
-Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o libc.so.7.full
-Wl,-soname,libc.so.7  `NM='nm' NMFLAGS='' lorder machdep_ldisd.pico
bt_close.pico ... wcstok.pico wcswidth.pico wcsxfrm.pico wmemchr.pico
wmemcmp.pico wmemcpy.pico wmemmove.pico wmemset.pico |  tsort -q` 
-lcompiler_rt
cc: Internal error: Segmentation fault (program ld)
Please submit a full bug report.
See <URL:<a href="http://www.freebsd.org/support.html">http://www.freebsd.org/support.html</a>> for instructions.

Reproducer is located at <a href="https://people.freebsd.org/~emaste/lld/lld-mips.tar">https://people.freebsd.org/~emaste/lld/lld-mips.tar</a>.

Backtrace after reproducing on unpatched lld:

nuc% ~/src/llvm/build-debug/bin/ld.lld $(cat response.txt)
zsh: segmentation fault (core dumped)  ~/src/llvm/build-debug/bin/ld.lld $(cat
response.txt )
nuc% lldb ~/src/llvm/build-debug/bin/ld.lld -c lld.core    
(lldb) target create "/home/emaste/src/llvm/build-debug/bin/ld.lld" --core
"lld.core"
Core file '/home/emaste/bugs/lld/lld-mips/lld.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'lld', stop reason = signal SIGSEGV
  * frame #0: ld.lld`lld::elf::DynamicReloc::getOffset(this=0x000000ef2c526020)
const at SyntheticSections.cpp:1182
    frame #1:
ld.lld`_ZN3lld3elf17RelocationSectionIN4llvm6object7ELFTypeILNS2_7support10endiannessE0ELb1EEEE7writeToEPh(this=0x000000ef2abc5000,
Buf="") at SyntheticSections.cpp:1230
    frame #2:
ld.lld`_ZN3lld3elf12InputSection7writeToIN4llvm6object7ELFTypeILNS3_7support10endiannessE0ELb1EEEEEvPh(this=0x000000ef2abc5008,
Buf="") at InputSection.cpp:649
    frame #3:
ld.lld`_ZZN3lld3elf13OutputSection7writeToIN4llvm6object7ELFTypeILNS3_7support10endiannessE0ELb1EEEEEvPhENKUlPNS0_12InputSectionEE_clESB_(this=0x00000000099aab40,
IS=0x000000ef2abc5008) at OutputSections.cpp:242
    frame #4:
ld.lld`_ZZN3lld17parallel_for_eachINSt3__111__wrap_iterIPPNS_3elf12InputSectionEEEZNS3_13OutputSection7writeToIN4llvm6object7ELFTypeILNSA_7support10endiannessE0ELb1EEEEEvPhEUlS5_E_EEvT_SI_T0_ENKUlvE_clEv
[inlined]
_ZNSt3__18for_eachINS_11__wrap_iterIPPN3lld3elf12InputSectionEEEZNS3_13OutputSection7writeToIN4llvm6object7ELFTypeILNSA_7support10endiannessE0ELb1EEEEEvPhEUlS5_E_EET0_T_SJ_SI_(__first=__wrap_iter<lld::elf::InputSection
**> @ 0x00000000099aab50, __last=__wrap_iter<lld::elf::InputSection **> @
0x00000000099aab48, __f=(Buf = "")) at algorithm:879
    frame #5:
ld.lld`_ZZN3lld17parallel_for_eachINSt3__111__wrap_iterIPPNS_3elf12InputSectionEEEZNS3_13OutputSection7writeToIN4llvm6object7ELFTypeILNSA_7support10endiannessE0ELb1EEEEEvPhEUlS5_E_EEvT_SI_T0_ENKUlvE_clEv(this=0x000000ef2b018018)
at Parallel.h:307
    frame #6:
ld.lld`_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN3lld17parallel_for_eachINS_11__wrap_iterIPPNS3_3elf12InputSectionEEEZNS6_13OutputSection7writeToIN4llvm6object7ELFTypeILNSD_7support10endiannessE0ELb1EEEEEvPhEUlS8_E_EEvT_SL_T0_EUlvE_EEEvDpOT_
[inlined]
_ZNSt3__18__invokeIRZN3lld17parallel_for_eachINS_11__wrap_iterIPPNS1_3elf12InputSectionEEEZNS4_13OutputSection7writeToIN4llvm6object7ELFTypeILNSB_7support10endiannessE0ELb1EEEEEvPhEUlS6_E_EEvT_SJ_T0_EUlvE_JEEEDTclclsr3std3__1E7forwardISJ_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSJ_DpOSN_(__f=0x000000ef2b018018)
at type_traits:4301
    frame #7:
ld.lld`_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN3lld17parallel_for_eachINS_11__wrap_iterIPPNS3_3elf12InputSectionEEEZNS6_13OutputSection7writeToIN4llvm6object7ELFTypeILNSD_7support10endiannessE0ELb1EEEEEvPhEUlS8_E_EEvT_SL_T0_EUlvE_EEEvDpOT_(__args=0x000000ef2b018018)
at __functional_base:359
    frame #8:
ld.lld`_ZNSt3__110__function6__funcIZN3lld17parallel_for_eachINS_11__wrap_iterIPPNS2_3elf12InputSectionEEEZNS5_13OutputSection7writeToIN4llvm6object7ELFTypeILNSC_7support10endiannessE0ELb1EEEEEvPhEUlS7_E_EEvT_SK_T0_EUlvE_NS_9allocatorISM_EEFvvEEclEv(this=0x000000ef2b018010)
at functional:1552
    frame #9:
ld.lld`std::__1::function<void()(void)>::operator(this=0x000000ef2b018010)(void)
const at functional:1914
    frame #10:
ld.lld`_ZZN3lld9TaskGroup5spawnENSt3__18functionIFvvEEEENKUlvE_clEv(this=0x000000ef2b018010)
at Parallel.h:189
    frame #11:
ld.lld`_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN3lld9TaskGroup5spawnENS_8functionIFvvEEEEUlvE_EEEvDpOT_
[inlined]
_ZNSt3__18__invokeIRZN3lld9TaskGroup5spawnENS_8functionIFvvEEEEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS8_DpOS9_(__f=0x000000ef2b018010)
at type_traits:4301
    frame #12:
ld.lld`_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN3lld9TaskGroup5spawnENS_8functionIFvvEEEEUlvE_EEEvDpOT_(__args=0x000000ef2b018010)
at __functional_base:359
    frame #13:
ld.lld`_ZNSt3__110__function6__funcIZN3lld9TaskGroup5spawnENS_8functionIFvvEEEEUlvE_NS_9allocatorIS7_EES5_EclEv(this=0x000000ef2b018000)
at functional:1552
    frame #14:
ld.lld`std::__1::function<void()(void)>::operator(this=0x00000000099aad20)(void)
const at functional:1914
    frame #15:
ld.lld`lld::internal::ThreadPoolExecutor::work(this=0x0000000005466af0) at
Parallel.h:160
    frame #16:
ld.lld`_ZZN3lld8internal18ThreadPoolExecutorC1EjENKUlvE_clEv(this=0x000000ef29ebc2e8)
at Parallel.h:129
    frame #17:
ld.lld`_ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3lld8internal18ThreadPoolExecutorC1EjEUlvE_EEEEEPvSC_
[inlined]
_ZNSt3__18__invokeIZN3lld8internal18ThreadPoolExecutorC1EjEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS5_DpOS6_(__f=0x000000ef29ebc2e8)
at type_traits:4301
    frame #18:
ld.lld`_ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3lld8internal18ThreadPoolExecutorC1EjEUlvE_EEEEEPvSC_
[inlined]
_ZNSt3__116__thread_executeINS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEZN3lld8internal18ThreadPoolExecutorC1EjEUlvE_JEJEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE(__t=0x000000ef29ebc2e0)
at thread:336
    frame #19:
ld.lld`_ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN3lld8internal18ThreadPoolExecutorC1EjEUlvE_EEEEEPvSC_(__vp=0x000000ef29ebc2e0)
at thread:346
    frame #20: libthr.so.3`thread_start(curthread=0x000000ef29efbe00) at
thr_create.c:289</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>