<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94716>94716</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lld crash with Wl,-fixup_chains when build ios
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
liudikang
</td>
</tr>
</table>
<pre>
## What did you do?
First we build a go project with gomobile (https://github.com/xxf098/go-tun2socks-build) as a static library,
then linker this static library into our IOS project.
What did you see happen?
lld crashed.
I found crash position of lld:
`SymtabSectionImpl<LP>::writeTo` of file `lld/MachO/SyntheticSections.cpp`
Crashed on this line: `nList->n_sect = defined->isec()->parent->index;`
After we remove ldflags "-Wl,-fixup_chains" ,or modify llvm code crash not happed.
this is crash stack (this lld is build by myself,prebuild is same)
```
#0 0x0000000104b0d454 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x1000fd454)
#1 0x0000000104b0b664 llvm::sys::RunSignalHandlers() (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x1000fb664)
#2 0x0000000104b0db10 SignalHandler(int) (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x1000fdb10)
#3 0x000000019c48b584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
#4 0x0000000104e17154 SymtabSectionImpl<lld::macho::LP64>::writeTo(unsigned char*) const (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x100407154)
#5 0x0000000104a948b8 std::__1::__function::__func<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_1, std::__1::allocator<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_1>, void ()>::operator()() (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x1000848b8)
#6 0x0000000104a947d0 std::__1::__function::__func<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0, std::__1::allocator<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0>, void ()>::operator()() (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x1000847d0)
#7 0x0000000104a93270 llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x100083270)
#8 0x0000000104a92fac void* std::__1::__thread_proxy[abi:un170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()>>(void*) (/xxxxx/third_party/llvm-build/Release+Asserts/bin/lld+0x100082fac)
#9 0x000000019c45af94 (/usr/lib/system/libsystem_pthread.dylib+0x180446f94)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV99v4yoW_mvIC2qEseMfD3lI03p3pFlNNak0jxE2xzFbDF7Abfzfr7CdtE4y917dO9VEkWXgcPjO9x2OgVkrDgpgjVb3aPWwYJ2rtVlL0XHxwtRhUWjerxENEQ3xj5o5zAXHve4w1yjMEXlAZJMLYx1-A1x0QnLM8EHj1uj_Qunwm3A1PuhGF0ICRjStnWstCjeI5ojmB-HqrliWukE0Px4rkqW-V9-5TlGryxd7NzhFNMPMYoatY06UWIrCMNMjuh0huBoUlkK9gMGuFvbCDgvlNNadwV--7U7YluPU8TmLzQLgmrUtqHOMUnJcGmZr4LN5X3ClOzWN4VZb4YRWWFdYSu7D_GCLYrLrG8eKHZTe6kvTShRuvz6h8NGbhps3Ixw8axQT76EaKIuJ90Tz_7Cy_oZovuuVq8GJcvJil2XbopiMa2xHjFirkQcpFKBw492or8K6OxQ-qr310qDwAXOohALue4WFEtEU0cy3WmZADdZCcTii8P68xPjcVA6MF91Ao18BS15JdrAYUX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