With a ppc64 build, I run into a build breaker due to an ODR violation: ... [ 1304s] ../../../gdb/gdbserver/../arch/ppc-linux-tdesc.h:45:28: error: 'tdesc_powerpc_isa207_vsx64l' violates the C++ One Definition Rule [-Werror=odr] [ 1304s] 45 | extern struct target_desc *tdesc_powerpc_isa207_vsx64l; [ 1304s] | ^ [ 1304s] powerpc-isa207-vsx64l-generated.c:27:27: note: 'tdesc_powerpc_isa207_vsx64l' was previously declared here [ 1304s] 27 | const struct target_desc *tdesc_powerpc_isa207_vsx64l; ... The problem is that regdat.sh generates *tdesc_${name} using const: ... echo "const struct target_desc *tdesc_${name};" ... while ppc-linux-tdesc.h declares it without const.
Is it enough to just remove that 'const' from regdat.sh? That seems like an unobjectionable patch to me.
(In reply to Tom Tromey from comment #1) > Is it enough to just remove that 'const' from regdat.sh? > That seems like an unobjectionable patch to me. It is enough to get PowerPC building again. The question is, would we rather change everything to 'const' instead? While noticeably less trivial, it does work. [Tested on x86_64, aarch64, ppc64le, s390x rawhide scratch-builds enabling LTO.]
See also the generic ODR bug. I don't recall what other violations I knew about when I commented there, but I assume I just did a build with LTO and -Wodr.
(In reply to Keith Seitz from comment #2) > (In reply to Tom Tromey from comment #1) > > Is it enough to just remove that 'const' from regdat.sh? > > That seems like an unobjectionable patch to me. > > It is enough to get PowerPC building again. The question is, > would we rather change everything to 'const' instead? If they are truly unchanging then it definitely seems better.
I think this was fixed by commit ac9b8c676e9f52c5238bbc61a2cdd27e3d59db10 Author: Keith Seitz <keiths@redhat.com> Date: Fri Sep 9 08:44:50 2022 -0700 Constify target_desc declarations