<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56190>56190</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ODR warnings in AsmPrinter/DWARFLinker
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
thesamesam
</td>
</tr>
</table>
<pre>
Original downstream [report](https://bugs.gentoo.org/853895) is in Gentoo from Agostino Sarubbo (@asarubbo).
Noticed when buildling LLVM 14 with `-Werror=odr` (we're doing some runs with this in Gentoo to test readiness for LTO).
```
FAILED: lib64/libLLVM-14.so
: && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,defs -Wl,-z,nodelete -Wl,-rpath-link,/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm_build-abi_x86_64.amd64/./lib64 -Wl,--gc-sections -Wl,-Bsymbolic-functions -shared -Wl,-soname,libLLVM-14.so -o lib64/libLLVM-14.so tools/llvm-shlib/CMakeFiles/LLVM.dir/libllvm.cpp.o -Wl,-rpath,"\$ORIGIN/../lib64" -Wl,--version-script,/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm_build-abi_x86_64.amd64/./lib64/tools/llvm-shlib/simple_version_script.map -Wl,--whole-archive lib64/libLLVMDemangle.a lib64/libLLVMSupport.a lib64/libLLVMCore.a lib64/libLLVMFuzzMutate.a lib64/libLLVMFileCheck.a lib64/libLLVMInterfaceStub.a lib64/libLLVMIRReader.a lib64/libLLVMCodeGen.a lib64/libLLVMSelectionDAG.a lib64/libLLVMAsmPrinter.a lib64/libLLVMMIRParser.a lib64/libLLVMGlobalISel.a lib64/libLLVMBinaryFormat.a lib64/libLLVMBitReader.a lib64/libLLVMBitWriter.a lib64/libLLVMBitstreamReader.a lib64/libLLVMDWARFLinker.a lib64/libLLVMExtensions.a lib64/libLLVMFrontendOpenACC.a lib64/libLLVMFrontendOpenMP.a lib64/libLLVMTransformUtils.a lib64/libLLVMInstrumentation.a lib64/libLLVMAggressiveInstCombine.a lib64/libLLVMInstCombine.a lib64/libLLVMScalarOpts.a lib64/libLLVMipo.a lib64/libLLVMVectorize.a lib64/libLLVMObjCARCOpts.a lib64/libLLVMCoroutines.a lib64/libLLVMCFGuard.a lib64/libLLVMLinker.a lib64/libLLVMAnalysis.a lib64/libLLVMLTO.a lib64/libLLVMMC.a lib64/libLLVMMCParser.a lib64/libLLVMMCDisassembler.a lib64/libLLVMMCA.a lib64/libLLVMObject.a lib64/libLLVMObjectYAML.a lib64/libLLVMOption.a lib64/libLLVMRemarks.a lib64/libLLVMDebugInfoDWARF.a lib64/libLLVMDebugInfoGSYM.a lib64/libLLVMDebugInfoMSF.a lib64/libLLVMDebugInfoCodeView.a lib64/libLLVMDebugInfoPDB.a lib64/libLLVMSymbolize.a lib64/libLLVMDWP.a lib64/libLLVMExecutionEngine.a lib64/libLLVMInterpreter.a lib64/libLLVMJITLink.a lib64/libLLVMMCJIT.a lib64/libLLVMOrcJIT.a lib64/libLLVMOrcShared.a lib64/libLLVMOrcTargetProcess.a lib64/libLLVMRuntimeDyld.a lib64/libLLVMTarget.a lib64/libLLVMSystemZCodeGen.a lib64/libLLVMSystemZAsmParser.a lib64/libLLVMSystemZDisassembler.a lib64/libLLVMSystemZDesc.a lib64/libLLVMSystemZInfo.a lib64/libLLVMAArch64CodeGen.a lib64/libLLVMAArch64AsmParser.a lib64/libLLVMAArch64Disassembler.a lib64/libLLVMAArch64Desc.a lib64/libLLVMAArch64Info.a lib64/libLLVMAArch64Utils.a lib64/libLLVMWebAssemblyCodeGen.a lib64/libLLVMWebAssemblyAsmParser.a lib64/libLLVMWebAssemblyDisassembler.a lib64/libLLVMWebAssemblyDesc.a lib64/libLLVMWebAssemblyInfo.a lib64/libLLVMWebAssemblyUtils.a lib64/libLLVMAMDGPUCodeGen.a lib64/libLLVMAMDGPUAsmParser.a lib64/libLLVMAMDGPUDisassembler.a lib64/libLLVMAMDGPUTargetMCA.a lib64/libLLVMAMDGPUDesc.a lib64/libLLVMAMDGPUInfo.a lib64/libLLVMAMDGPUUtils.a lib64/libLLVMBPFCodeGen.a lib64/libLLVMBPFAsmParser.a lib64/libLLVMBPFDisassembler.a lib64/libLLVMBPFDesc.a lib64/libLLVMBPFInfo.a lib64/libLLVMMipsCodeGen.a lib64/libLLVMMipsAsmParser.a lib64/libLLVMMipsDisassembler.a lib64/libLLVMMipsDesc.a lib64/libLLVMMipsInfo.a lib64/libLLVMRISCVCodeGen.a lib64/libLLVMRISCVAsmParser.a lib64/libLLVMRISCVDisassembler.a lib64/libLLVMRISCVDesc.a lib64/libLLVMRISCVInfo.a lib64/libLLVMHexagonCodeGen.a lib64/libLLVMHexagonAsmParser.a lib64/libLLVMHexagonDisassembler.a lib64/libLLVMHexagonDesc.a lib64/libLLVMHexagonInfo.a lib64/libLLVMNVPTXCodeGen.a lib64/libLLVMNVPTXDesc.a lib64/libLLVMNVPTXInfo.a lib64/libLLVMPowerPCCodeGen.a lib64/libLLVMPowerPCAsmParser.a lib64/libLLVMPowerPCDisassembler.a lib64/libLLVMPowerPCDesc.a lib64/libLLVMPowerPCInfo.a lib64/libLLVMLanaiCodeGen.a lib64/libLLVMLanaiAsmParser.a lib64/libLLVMLanaiDisassembler.a lib64/libLLVMLanaiDesc.a lib64/libLLVMLanaiInfo.a lib64/libLLVMARMCodeGen.a lib64/libLLVMARMAsmParser.a lib64/libLLVMARMDisassembler.a lib64/libLLVMARMDesc.a lib64/libLLVMARMInfo.a lib64/libLLVMARMUtils.a lib64/libLLVMXCoreCodeGen.a lib64/libLLVMXCoreDisassembler.a lib64/libLLVMXCoreDesc.a lib64/libLLVMXCoreInfo.a lib64/libLLVMMSP430CodeGen.a lib64/libLLVMMSP430Desc.a lib64/libLLVMMSP430Info.a lib64/libLLVMMSP430AsmParser.a lib64/libLLVMMSP430Disassembler.a lib64/libLLVMVECodeGen.a lib64/libLLVMVEAsmParser.a lib64/libLLVMVEDisassembler.a lib64/libLLVMVEInfo.a lib64/libLLVMVEDesc.a lib64/libLLVMSparcCodeGen.a lib64/libLLVMSparcAsmParser.a lib64/libLLVMSparcDisassembler.a lib64/libLLVMSparcDesc.a lib64/libLLVMSparcInfo.a lib64/libLLVMAVRCodeGen.a lib64/libLLVMAVRAsmParser.a lib64/libLLVMAVRDisassembler.a lib64/libLLVMAVRDesc.a lib64/libLLVMAVRInfo.a lib64/libLLVMX86CodeGen.a lib64/libLLVMX86AsmParser.a lib64/libLLVMX86Disassembler.a lib64/libLLVMX86TargetMCA.a lib64/libLLVMX86Desc.a lib64/libLLVMX86Info.a lib64/libLLVMAsmParser.a lib64/libLLVMLineEditor.a lib64/libLLVMProfileData.a lib64/libLLVMCoverage.a lib64/libLLVMPasses.a lib64/libLLVMTextAPI.a lib64/libLLVMDlltoolDriver.a lib64/libLLVMLibDriver.a lib64/libLLVMXRay.a lib64/libLLVMWindowsManifest.a -Wl,--no-whole-archive lib64/libLLVMExtensions.a lib64/libLLVMDebugInfoPDB.a /usr/lib64/libffi.so lib64/libLLVMExecutionEngine.a lib64/libLLVMJITLink.a lib64/libLLVMOrcTargetProcess.a lib64/libLLVMOrcShared.a lib64/libLLVMRuntimeDyld.a lib64/libLLVMMIRParser.a lib64/libLLVMObjCARCOpts.a lib64/libLLVMCoroutines.a lib64/libLLVMipo.a lib64/libLLVMIRReader.a lib64/libLLVMAsmParser.a lib64/libLLVMFrontendOpenMP.a lib64/libLLVMVectorize.a lib64/libLLVMLinker.a lib64/libLLVMMSP430Desc.a lib64/libLLVMMSP430Info.a lib64/libLLVMVEInfo.a lib64/libLLVMAsmPrinter.a lib64/libLLVMDebugInfoMSF.a lib64/libLLVMGlobalISel.a lib64/libLLVMSelectionDAG.a lib64/libLLVMCodeGen.a lib64/libLLVMBitWriter.a lib64/libLLVMScalarOpts.a lib64/libLLVMAggressiveInstCombine.a lib64/libLLVMInstCombine.a lib64/libLLVMInstrumentation.a lib64/libLLVMTransformUtils.a lib64/libLLVMCFGuard.a lib64/libLLVMTarget.a lib64/libLLVMAnalysis.a lib64/libLLVMMCA.a lib64/libLLVMMCDisassembler.a lib64/libLLVMProfileData.a lib64/libLLVMDebugInfoDWARF.a lib64/libLLVMOption.a lib64/libLLVMObject.a lib64/libLLVMBitReader.a lib64/libLLVMCore.a lib64/libLLVMRemarks.a lib64/libLLVMBitstreamReader.a lib64/libLLVMMCParser.a lib64/libLLVMMC.a lib64/libLLVMDebugInfoCodeView.a lib64/libLLVMTextAPI.a lib64/libLLVMBinaryFormat.a lib64/libLLVMSupport.a lib64/libLLVMDemangle.a -lrt -ldl -lm /usr/lib64/libz.so /usr/lib64/libtinfo.so && :
/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h:288: error: type ‘llvm::AccelTableKind’ violates the C++ One Definition Rule [-Werror=odr]
288 | enum class AccelTableKind {
|
/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm/include/llvm/DWARFLinker/DWARFLinker.h:25: note: an enum with different value name is defined in another translation unit
25 | enum class AccelTableKind {
|
/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h:289: note: name ‘Default’ differs from name ‘Apple’ defined in another translation unit
289 | Default, ///< Platform default.
|
/var/tmp/portage/sys-devel/llvm-14.0.5/work/llvm/include/llvm/DWARFLinker/DWARFLinker.h:26: note: mismatching definition
26 | Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
|
```
This is with GCC 11.3.0. Full log: [build.log](https://github.com/llvm/llvm-project/files/8970275/build.log)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNWl1z6jgS_TXkRWWK8HXhIQ8Ekmx2ww1FMuTOvlDCFkZzZcsrySHJr99u2QSYkeS5M1Ozm6Icy6cln261WlLLG5m8Xz0qnvKcCpLIfa6NYjQjrcG1YoVUpjWYtbqjnTGFbvUmre4t_DZlqtspy42UbalSeDIa9EbjQas7JlwTnpM7C5KtkhmZpFIbnkvyRFW52UgC7bX6HaqrIlRqtzqzVmdSXb9Kw2OWkP2O5WRTcpEInqfk4WE1J5d9sudmR1rDTvTClJKq1ZvJREEZW92zVveLYqAH1tAyY0SVua7qmN0ZNQM_pg0BbROeM63JViry8Px4wmfYqX-2eDu5f7iZgRGI4JthH7SG_0gruuy3NahVVQK81R3CD_7dllqhvXgO17fRcD3sR0UcgULlW5TmZQS2u4YfibaL-ymJHrskKnjBSJRRFe9AOagUDfuAKxZLlURpHEca9Il3TMPTXEYJp2mOFo51FEsBSkTbDPShKYsEy1ODzXTgoQCVz6x2UgIsMu8FizKuMwqtn2DgETw2ERWcarRrzRXfrVlGc3hzxHPDVCE1N1zmgL1yzTdccPMOkED7RjueJNCjx3YTalhkOHRS9EKFQOTNKAr_oeUyLzVLooIqmjFoG57uFYcKyCZPQfeXmGoT_aekoqoBzJFetOVMJPBWoAKUP5gC2YIllmclKSSI4QWKPCsEj7mJtkDB7JQs013dHn3fMOBxbCmpgFhQraMMVI9j9Bv7ULGkzPElUSZfWfWsAJRn_ANZHZ_mkr3FrDDW3vAoYQIUhMd59MqVAX2ixGAvvugyTcFFI6iqFE_q-rHMMnBhKIDGwnpvCuqCbQ2t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