Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917536 - sys-devel/llvm-17.0.5 fails to compile (lto): ARMAsmParser.cpp:73:8: error: type ‘struct ARMInstrTable’ violates the C++ One Definition Rule [-Werror=odr]
Summary: sys-devel/llvm-17.0.5 fails to compile (lto): ARMAsmParser.cpp:73:8: error: t...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
: 922188 (view as bug list)
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2023-11-17 23:24 UTC by ppw0
Modified: 2024-05-13 04:34 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (sys-devel:llvm-17.0.5:20231117-223413.log.gz,149.00 KB, application/gzip)
2023-11-17 23:24 UTC, ppw0
Details
emerge --info (emerge_info.log,7.67 KB, text/x-log)
2023-11-17 23:25 UTC, ppw0
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2023-11-17 23:24:48 UTC
Created attachment 875032 [details]
build log

In a stricter lto (-flto -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch) environment, sys-devel/llvm-17.0.5 will fail to compile with the following errors:
```
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:73:8: error: type ‘struct ARMInstrTable’ violates the C++ One Definition Rule [-Werror=odr]
   73 | struct ARMInstrTable {
      |        ^
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/ARM/ARMGenInstrInfo.inc:5751: note: a different type is defined in another translation unit
 5751 | struct ARMInstrTable {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:74:15: note: the first difference of corresponding definitions is field ‘Insts’
   74 |   MCInstrDesc Insts[4445];
      |               ^
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/ARM/ARMGenInstrInfo.inc:5752: note: a field of same name but different type is defined in another translation unit
 5752 |   MCInstrDesc Insts[4450];
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:73:8: note: array types have different bounds
   73 | struct ARMInstrTable {
      |        ^
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:78:28: error: ‘ARMDescs’ violates the C++ One Definition Rule [-Werror=odr]
   78 | extern const ARMInstrTable ARMDescs;
      |                            ^
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/ARM/ARMGenInstrInfo.inc:5769: note: type ‘const struct ARMInstrTable’ itself violates the C++ One Definition Rule
 5769 | extern const ARMInstrTable ARMDescs = {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/ARM/ARMGenInstrInfo.inc:5769: note: ‘ARMDescs’ was previously declared here
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/SystemZ/SystemZGenAsmMatcher.inc:56: error: type ‘SubtargetFeatureBits’ violates the C++ One Definition Rule [-Werror=odr]
   56 | enum SubtargetFeatureBits : uint8_t {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/LoongArch/LoongArchGenAsmMatcher.inc:94: note: an enum with different value name is defined in another translation unit
   94 | enum SubtargetFeatureBits : uint8_t {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/SystemZ/SystemZGenAsmMatcher.inc:57: note: name ‘Feature_FeatureSoftFloatBit’ differs from name ‘Feature_IsLA64Bit’ defined in another translation unit
   57 |   Feature_FeatureSoftFloatBit = 33,
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm_build-abi_x86_64.amd64/lib/Target/LoongArch/LoongArchGenAsmMatcher.inc:95: note: mismatching definition
   95 |   Feature_IsLA64Bit = 4,
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/include/llvm/CodeGen/MachineScheduler.h:1066: error: virtual table of type ‘struct GenericSchedulerBase’ violates one definition rule [-Werror=odr]
 1066 | class GenericSchedulerBase : public MachineSchedStrategy {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/include/llvm/CodeGen/MachineScheduler.h:1066: note: the conflicting type defined in another translation unit
 1066 | class GenericSchedulerBase : public MachineSchedStrategy {
      | 
/var/tmp/portage/sys-devel/llvm-17.0.5/work/llvm/include/llvm/CodeGen/MachineScheduler.h:257:16: note: virtual method ‘scheduleTree’
  257 |   virtual void scheduleTree(unsigned SubtreeID) {}
      |                ^
<built-in>: note: ought to match virtual method ‘__cxa_pure_virtual’ but does not
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```

Attaching logs.
Comment 1 ppw0 2023-11-17 23:25:12 UTC
Created attachment 875033 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-17 04:11:59 UTC
*** Bug 922188 has been marked as a duplicate of this bug. ***
Comment 3 Pietro 2024-01-22 12:37:15 UTC
Also affecting 17.0.6, see https://bugs.gentoo.org/922188 .
Comment 4 Pietro 2024-02-02 10:38:53 UTC
I am not trying to push this, but I was wondering if anyone is looking at it. 

Thanks
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-11 18:08:58 UTC
I reported it upstream in bug 926529 where there's a bunch of diff. ones.
Comment 6 Larry the Git Cow gentoo-dev 2024-03-12 08:00:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b08335ec801c4736369fa57bce00c1c8669682d

commit 3b08335ec801c4736369fa57bce00c1c8669682d
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-12 07:57:41 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-12 08:00:18 +0000

    sys-devel/llvm: filter LTO for GCC again
    
    These failures aren't GCC specific but only GCC has these warnings implemented
    and it's less likely that LLVM will miscompile itself because people will test
    it more, even if the issue is UB in LLVM.
    
    Filter to avoid people hitting roadblocks on a common package when using
    safe LTO flags (-Werror=...).
    
    Closes: https://bugs.gentoo.org/917536
    Closes: https://bugs.gentoo.org/926529
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/llvm/llvm-17.0.6.ebuild             | 7 ++++++-
 sys-devel/llvm/llvm-18.1.0.ebuild             | 7 ++++++-
 sys-devel/llvm/llvm-19.0.0.9999.ebuild        | 7 ++++++-
 sys-devel/llvm/llvm-19.0.0_pre20240302.ebuild | 7 ++++++-
 sys-devel/llvm/llvm-19.0.0_pre20240309.ebuild | 7 ++++++-
 5 files changed, 30 insertions(+), 5 deletions(-)