<div dir="ltr">On PowerPC we have a failing address sanitizer test when linking with LLD. The issue is that the symbol '__libc_stack_end' is resolved to an undefined weak symbol when linking with LLD but not when linking (with the exact same command/input) with other linkers. Tracing the symbol I see it is resolved to a definition in the dynamic linker as expected:<div><br></div><div>/home/sfertile/LLVM_MonoRepo/build/lib/clang/11.0.0/lib/linux/libclang_rt.asan-powerpc64le.a(sanitizer_linux.cpp.o): reference to __libc_stack_end<br>/lib/powerpc64le-linux-gnu/libpthread.so.0: reference to __libc_stack_end<br>/lib/powerpc64le-linux-gnu/ld64.so.2: shared definition of __libc_stack_end<br><internal>: reference to __libc_stack_end</div><div><br></div><div>The last line in the trace output shows where we demote the shared definition to an undefined symbol here: <a href="https://github.com/llvm/llvm-project/blob/c8bfed05e21f945b5ac71cd01d62e2854a8ddcf9/lld/ELF/Driver.cpp#L1505">https://github.com/llvm/llvm-project/blob/c8bfed05e21f945b5ac71cd01d62e2854a8ddcf9/lld/ELF/Driver.cpp#L1505</a></div><div><br></div><div>I'm guessing the fix is that if `needsInterpSection()` is true then the dynamic linker should be marked as needed. Its going to end up in the DT_NEEDED anyway so the symbols can't become <span class="gmail-pl-c">dangling references. </span>In my case then, the demotion won't happen and everything works as expected. Is this the right direction?</div></div>