diff options
author | Tom de Vries <tdevries@suse.de> | 2023-08-22 19:35:52 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-08-22 19:35:52 +0200 |
commit | 883d90a0ff6b1dbacf654f5a8db2350030b4df00 (patch) | |
tree | 36fb5f6951bf34e256216fa815943ea31ec50b0a /gdb/frv-tdep.c | |
parent | 72275f1e6a2566569ac23fb8a2b2f6dbcf535408 (diff) | |
download | gdb-883d90a0ff6b1dbacf654f5a8db2350030b4df00.zip gdb-883d90a0ff6b1dbacf654f5a8db2350030b4df00.tar.gz gdb-883d90a0ff6b1dbacf654f5a8db2350030b4df00.tar.bz2 |
[gdb/build] Work around cgen odr violations
When building gdb with -flto -O2, I run into:
...
opcodes/mep-desc.h:250:14: warning: type 'cgen_operand_type' violates the \
C++ One Definition Rule [-Wodr]
typedef enum cgen_operand_type {
^
opcodes/or1k-desc.h:624:14: note: an enum with different value name is \
defined in another translation unit
typedef enum cgen_operand_type {
^
opcodes/mep-desc.h:212:14: warning: type 'cgen_hw_type' violates the C++ One \
Definition Rule [-Wodr]
typedef enum cgen_hw_type {
^
opcodes/or1k-desc.h:433:14: note: an enum with different value name is \
defined in another translation unit
typedef enum cgen_hw_type {
^
...
Fix this by making the conflicting type names unique, adding a target-specific
prefix using a define before the include:
...
#define cgen_operand_type <target-name>_cgen_operand_type
#define cgen_hw_type <target-name>_cgen_hw_type
#include "opcodes/<target-name>-desc.h"
...
and move those defines into a new file cgen-remap.h, similar to how that's
done for yacc in yy-remap.h.
Likewise for targets frv and lm32, the two other targets that include
opcodes/<target-name>-desc.h.
Likewise for more cgen symbols that I got the same warning for when using
-flto-partition=one.
A PR has been filed to take care of this in the opcodes dir instead (PR30758).
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR build/30757
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30757
Diffstat (limited to 'gdb/frv-tdep.c')
-rw-r--r-- | gdb/frv-tdep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 6c6050a..273a5bd 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -29,7 +29,6 @@ #include "dis-asm.h" #include "sim-regno.h" #include "sim/sim-frv.h" -#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */ #include "symtab.h" #include "elf-bfd.h" #include "elf/frv.h" @@ -40,6 +39,11 @@ #include "objfiles.h" #include "gdbarch.h" +/* Make cgen names unique to prevent ODR conflicts with other targets. */ +#define GDB_CGEN_REMAP_PREFIX frv +#include "cgen-remap.h" +#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */ + struct frv_unwind_cache /* was struct frame_extra_info */ { /* The previous frame's inner-most stack address. Used as this |