<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60568>60568</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvmorg-16.0.0-rc1 Stage 2 build failure (default linker is LLD, shared libraries)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld,
            release:backport
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            amy-kwan
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          amy-kwan
      </td>
    </tr>
</table>

<pre>
    When performing a multistage shared library build of LLVM 16.0.0 rc1 on Power with LLD as the default linker, the following build failure is encountered on the second stage:
```
FAILED: lib/libLTO.so.16git
: && /home/amyk/llvm/lld-shared-lib2/stage1/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics   -Wl,--gc-sections -Wl,--version-script,"/home/amyk/llvm/lld-shared-lib2/stage2/tools/lto/LTO.exports" -shared -Wl,-soname,libLTO.so.16git -o lib/libLTO.so.16git tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o tools/lto/CMakeFiles/LTO.dir/lto.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMAArch64AsmParser.so.16git  lib/libLLVMAMDGPUAsmParser.so.16git lib/libLLVMARMAsmParser.so.16git  lib/libLLVMAVRAsmParser.so.16git lib/libLLVMBPFAsmParser.so.16git  lib/libLLVMMipsAsmParser.so.16git lib/libLLVMMSP430AsmParser.so.16git  lib/libLLVMPowerPCAsmParser.so.16git lib/libLLVMRISCVAsmParser.so.16git  lib/libLLVMSparcAsmParser.so.16git lib/libLLVMSystemZAsmParser.so.16git  lib/libLLVMVEAsmParser.so.16git lib/libLLVMWebAssemblyAsmParser.so.16git  lib/libLLVMX86AsmParser.so.16git lib/libLLVMAArch64CodeGen.so.16git  lib/libLLVMAMDGPUCodeGen.so.16git lib/libLLVMARMCodeGen.so.16git  lib/libLLVMAVRCodeGen.so.16git lib/libLLVMBPFCodeGen.so.16git  lib/libLLVMHexagonCodeGen.so.16git lib/libLLVMLanaiCodeGen.so.16git  lib/libLLVMMipsCodeGen.so.16git lib/libLLVMMSP430CodeGen.so.16git  lib/libLLVMNVPTXCodeGen.so.16git lib/libLLVMPowerPCCodeGen.so.16git  lib/libLLVMRISCVCodeGen.so.16git lib/libLLVMSparcCodeGen.so.16git  lib/libLLVMSystemZCodeGen.so.16git lib/libLLVMVECodeGen.so.16git  lib/libLLVMWebAssemblyCodeGen.so.16git lib/libLLVMX86CodeGen.so.16git  lib/libLLVMXCoreCodeGen.so.16git lib/libLLVMAVRDesc.so.16git  lib/libLLVMBPFDesc.so.16git lib/libLLVMMipsDesc.so.16git  lib/libLLVMMSP430Desc.so.16git lib/libLLVMNVPTXDesc.so.16git  lib/libLLVMPowerPCDesc.so.16git lib/libLLVMSparcDesc.so.16git  lib/libLLVMVEDesc.so.16git lib/libLLVMX86Desc.so.16git  lib/libLLVMXCoreDesc.so.16git lib/libLLVMAArch64Disassembler.so.16git lib/libLLVMAMDGPUDisassembler.so.16git  lib/libLLVMARMDisassembler.so.16git lib/libLLVMAVRDisassembler.so.16git  lib/libLLVMBPFDisassembler.so.16git lib/libLLVMHexagonDisassembler.so.16git lib/libLLVMLanaiDisassembler.so.16git  lib/libLLVMMipsDisassembler.so.16git lib/libLLVMMSP430Disassembler.so.16git lib/libLLVMPowerPCDisassembler.so.16git lib/libLLVMRISCVDisassembler.so.16git  lib/libLLVMSparcDisassembler.so.16git lib/libLLVMSystemZDisassembler.so.16git  lib/libLLVMVEDisassembler.so.16git lib/libLLVMWebAssemblyDisassembler.so.16git lib/libLLVMX86Disassembler.so.16git  lib/libLLVMXCoreDisassembler.so.16git lib/libLLVMAVRInfo.so.16git  lib/libLLVMBPFInfo.so.16git lib/libLLVMMipsInfo.so.16git  lib/libLLVMMSP430Info.so.16git lib/libLLVMNVPTXInfo.so.16git  lib/libLLVMPowerPCInfo.so.16git lib/libLLVMSparcInfo.so.16git  lib/libLLVMVEInfo.so.16git lib/libLLVMX86Info.so.16git  lib/libLLVMXCoreInfo.so.16git lib/libLLVMLTO.so.16git  lib/libLLVMHexagonAsmParser.so.16git lib/libLLVMLanaiAsmParser.so.16git  lib/libLLVMAArch64Desc.so.16git lib/libLLVMAArch64Info.so.16git  lib/libLLVMAMDGPUDesc.so.16git lib/libLLVMAMDGPUInfo.so.16git  lib/libLLVMARMDesc.so.16git lib/libLLVMARMInfo.so.16git  lib/libLLVMHexagonDesc.so.16git lib/libLLVMHexagonInfo.so.16git  lib/libLLVMLanaiDesc.so.16git lib/libLLVMLanaiInfo.so.16git  lib/libLLVMRISCVDesc.so.16git lib/libLLVMRISCVInfo.so.16git  lib/libLLVMSystemZDesc.so.16git lib/libLLVMSystemZInfo.so.16git  lib/libLLVMWebAssemblyDesc.so.16git lib/libLLVMWebAssemblyInfo.so.16git  lib/libLLVMMCDisassembler.so.16git lib/libLLVMCodeGen.so.16git  lib/libLLVMTarget.so.16git lib/libLLVMMC.so.16git  lib/libLLVMBitReader.so.16git lib/libLLVMCore.so.16git  lib/libLLVMSupport.so.16git -Wl,-rpath-link,/home/amyk/llvm/lld-shared-lib2/stage2/lib && :
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasm' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPU' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmDispose' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmInstruction' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMSetDisasmOptions' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPUFeatures' failed: symbol not defined
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
[4020/5862] Building CXX object tools/clang/lib/AST...iles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o
ninja: build stopped: subcommand failed.
```
This is seen as a result of 241dbd310599e3c1a0f1b0c9ced14c8b8760539e.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMmU1v2zwSxz8NcyEoSPRL7EMOjh13AySt4aROsJcFRY5lNhSpJamkfj79gpTc2m0i-Tks-gCBX6SZH4ec_1DmhDknCw1whUbXiFJW7snLG9OIUjRaXLDa74y9Oly9yI3YXz3tQOMK7NbYUuoCM1zWykvnWQHY7ZgFgZXMLbN7nNdSCWy2-O5uc4-zcZImKbY8w0bjlXkDi9-k3-G7uwVmDvsdYAFbViuPldQvYBGdx6tbo5R5C6M1xC2TqraApcOguam1hzCs0dHaATda4BgRGsxQukDpDI3T9i9-Xc5u724WaDALsSK6VDK_e_ySOJNk40L61mcww4iOER1jRJc7UwKiS1buX4KDei3jmyDNpImSOUV0GYfNEF3mUiO65IrpAtFrRK8x2a5u5z9etSEOSqa95ESGGVTGSS-NxmT7Kp3MpZJ-T6RWUoMjOykEaEyewFpjD-9osBDMA_GyhKNrtS5qZgUIwl6ZVKxlaXjD5IkpFUy_e8swedKG1Lp2IEjFLCvBQ4C_WemBOG-lLhwmT5w5T_5bs-BZSuekLshWghJEauklU_IvsA6TCkScUQNWRhfxJRCaRZhOCDdlxTyJAYQlkJg8ybJSkktPtkwpv7OmLnbBybyGzBL3Jj3fkYM6Ilwb-M6h8sTvK4iXNHmV1tdM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