Skip to content

ODR warnings in lld/ELF/Arch/{RISCV,LoongArch} #83529

Closed
@thesamesam

Description

@thesamesam

When building with -flto -Werror=odr to find possible runtime issues w/ LTO:

/var/tmp/portage/sys-devel/lld-17.0.6/work/lld/ELF/Arch/LoongArch.cpp:57:6: error: type ‘Reg’ violates the C++ One Definition Rule [-Werror=odr]
   57 | enum Reg {
      |      ^
/var/tmp/portage/sys-devel/lld-17.0.6/work/lld/ELF/Arch/RISCV.cpp:68:6: note: an enum with different value name is defined in another translation unit
   68 | enum Reg {
      |      ^
/var/tmp/portage/sys-devel/lld-17.0.6/work/lld/ELF/Arch/LoongArch.cpp:58:3: note: name ‘R_ZERO’ differs from name ‘X_RA’ defined in another translation unit
   58 |   R_ZERO = 0,
      |   ^
/var/tmp/portage/sys-devel/lld-17.0.6/work/lld/ELF/Arch/RISCV.cpp:69:3: note: mismatching definition
   69 |   X_RA = 1,
      |   ^
lto1: some warnings being treated as errors

Originally reported downstream at https://bugs.gentoo.org/922353.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions