Do not accidentally include in-tree readline headers
Commit Message
PR build/17077 points out that when --with-system-readline is given,
gdb will still pick up the in-tree readline headers. Normally this is
not a big problem, because readline is very stable and so the ABI does
not change much; but it is clearly a bug to do this, and could bite at
some point.
The basic problem is that OPCODES_CFLAGS uses -I$(OPCODES_SRC)/.. so
that #include "opcodes/..." works. However, this also makes it so
the srcdir.
This patch fixes the problem in a mildly hacky way: remove the
offending -I option, and change gdb to use #include "../opcodes/..."
instead. This continues to make it clear where the header comes from,
without allowing incorrect behavior.
Tested by rebuilding and then looking at the *.Po files.
gdb/ChangeLog
2018-09-26 Tom Tromey <tom@tromey.com>
PR build/17077:
* Makefile.in (OPCODES_CFLAGS): Remove "-I$(OPCODES_SRC)/..".
* gdb/aarch64-tdep.c, gdb/amd64-tdep.c, gdb/arc-tdep.c,
gdb/cris-tdep.c, gdb/csky-tdep.c, gdb/frv-tdep.c, gdb/ft32-tdep.c,
gdb/i386-tdep.c, gdb/lm32-tdep.c, gdb/m68hc11-tdep.c,
gdb/mep-tdep.c, gdb/microblaze-tdep.c, gdb/mips-tdep.c,
gdb/msp430-tdep.c, gdb/nds32-tdep.c, gdb/nios2-tdep.h,
gdb/or1k-tdep.h, gdb/riscv-tdep.c, gdb/riscv-tdep.h,
gdb/rl78-tdep.c, gdb/rx-tdep.c, gdb/tilegx-tdep.c: Use ../opcode,
not opcode, in #include.
---
gdb/ChangeLog | 13 +++++++++++++
gdb/Makefile.in | 3 +--
gdb/aarch64-tdep.c | 2 +-
gdb/amd64-tdep.c | 2 +-
gdb/arc-tdep.c | 4 ++--
gdb/cris-tdep.c | 2 +-
gdb/csky-tdep.c | 2 +-
gdb/frv-tdep.c | 2 +-
gdb/ft32-tdep.c | 2 +-
gdb/i386-tdep.c | 2 +-
gdb/lm32-tdep.c | 2 +-
gdb/m68hc11-tdep.c | 2 +-
gdb/mep-tdep.c | 4 ++--
gdb/microblaze-tdep.c | 4 ++--
gdb/mips-tdep.c | 2 +-
gdb/msp430-tdep.c | 2 +-
gdb/nds32-tdep.c | 2 +-
gdb/nios2-tdep.h | 2 +-
gdb/or1k-tdep.h | 4 ++--
gdb/riscv-tdep.c | 8 ++++----
gdb/riscv-tdep.h | 2 +-
gdb/rl78-tdep.c | 2 +-
gdb/rx-tdep.c | 2 +-
gdb/tilegx-tdep.c | 2 +-
24 files changed, 43 insertions(+), 31 deletions(-)
Comments
On Sep 26 2018, Tom Tromey <tom@tromey.com> wrote:
> This patch fixes the problem in a mildly hacky way: remove the
> offending -I option, and change gdb to use #include "../opcodes/..."
> instead. This continues to make it clear where the header comes from,
> without allowing incorrect behavior.
Most of these headers are "opcode/...", not "opcodes/...".
Andreas.
Tom> gdb/ChangeLog
Tom> 2018-09-26 Tom Tromey <tom@tromey.com>
Tom> PR build/17077:
Tom> * Makefile.in (OPCODES_CFLAGS): Remove "-I$(OPCODES_SRC)/..".
Tom> * gdb/aarch64-tdep.c, gdb/amd64-tdep.c, gdb/arc-tdep.c,
Tom> gdb/cris-tdep.c, gdb/csky-tdep.c, gdb/frv-tdep.c, gdb/ft32-tdep.c,
Tom> gdb/i386-tdep.c, gdb/lm32-tdep.c, gdb/m68hc11-tdep.c,
Tom> gdb/mep-tdep.c, gdb/microblaze-tdep.c, gdb/mips-tdep.c,
Tom> gdb/msp430-tdep.c, gdb/nds32-tdep.c, gdb/nios2-tdep.h,
Tom> gdb/or1k-tdep.h, gdb/riscv-tdep.c, gdb/riscv-tdep.h,
Tom> gdb/rl78-tdep.c, gdb/rx-tdep.c, gdb/tilegx-tdep.c: Use ../opcode,
Tom> not opcode, in #include.
I'm checking this in now.
Tom
@@ -446,8 +446,7 @@ OPCODES = $(OPCODES_DIR)/libopcodes.a
# Where are the other opcode tables which only have header file
# versions?
OP_INCLUDE = $(INCLUDE_DIR)/opcode
-# Some source files like to use #include "opcodes/file.h"
-OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
+OPCODES_CFLAGS = -I$(OP_INCLUDE)
# The simulator is usually nonexistent; targets that include one
# should set this to list all the .o or .a files to be linked in.
@@ -56,7 +56,7 @@
#include "record-full.h"
#include "arch/aarch64-insn.h"
-#include "opcode/aarch64.h"
+#include "../opcode/aarch64.h"
#include <algorithm>
#define submask(x) ((1L << ((x) + 1)) - 1)
@@ -20,7 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "opcode/i386.h"
+#include "../opcode/i386.h"
#include "dis-asm.h"
#include "arch-utils.h"
#include "block.h"
@@ -32,8 +32,8 @@
#include "trad-frame.h"
/* ARC header files. */
-#include "opcode/arc.h"
-#include "opcodes/arc-dis.h"
+#include "../opcode/arc.h"
+#include "../opcodes/arc-dis.h"
#include "arc-tdep.h"
/* Standard headers. */
@@ -33,7 +33,7 @@
#include "gdbcmd.h"
#include "target.h"
#include "value.h"
-#include "opcode/cris.h"
+#include "../opcode/cris.h"
#include "osabi.h"
#include "arch-utils.h"
#include "regcache.h"
@@ -56,7 +56,7 @@
#include "csky-tdep.h"
#include "regset.h"
#include "block.h"
-#include "opcode/csky.h"
+#include "../opcode/csky.h"
#include <algorithm>
#include <vector>
@@ -29,7 +29,7 @@
#include "dis-asm.h"
#include "sim-regno.h"
#include "gdb/sim-frv.h"
-#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */
+#include "../opcodes/frv-desc.h" /* for the H_SPR_... enums */
#include "symtab.h"
#include "elf-bfd.h"
#include "elf/frv.h"
@@ -37,7 +37,7 @@
#include "dis-asm.h"
#include "record.h"
-#include "opcode/ft32.h"
+#include "../opcode/ft32.h"
#include "ft32-tdep.h"
#include "gdb/sim-ft32.h"
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "opcode/i386.h"
+#include "../opcode/i386.h"
#include "arch-utils.h"
#include "command.h"
#include "dummy-frame.h"
@@ -35,7 +35,7 @@
#include "regcache.h"
#include "trad-frame.h"
#include "reggroups.h"
-#include "opcodes/lm32-desc.h"
+#include "../opcodes/lm32-desc.h"
#include <algorithm>
/* Macros to extract fields from an instruction. */
@@ -40,7 +40,7 @@
#include "reggroups.h"
#include "target.h"
-#include "opcode/m68hc11.h"
+#include "../opcode/m68hc11.h"
#include "elf/m68hc11.h"
#include "elf-bfd.h"
@@ -48,8 +48,8 @@
/* Get the user's customized MeP coprocessor register names from
libopcodes. */
-#include "opcodes/mep-desc.h"
-#include "opcodes/mep-opc.h"
+#include "../opcodes/mep-desc.h"
+#include "../opcodes/mep-opc.h"
/* The gdbarch_tdep structure. */
@@ -34,8 +34,8 @@
#include "dwarf2-frame.h"
#include "osabi.h"
#include "target-descriptions.h"
-#include "opcodes/microblaze-opcm.h"
-#include "opcodes/microblaze-dis.h"
+#include "../opcodes/microblaze-opcm.h"
+#include "../opcodes/microblaze-dis.h"
#include "microblaze-tdep.h"
#include "remote.h"
@@ -38,7 +38,7 @@
#include "mips-tdep.h"
#include "block.h"
#include "reggroups.h"
-#include "opcode/mips.h"
+#include "../opcode/mips.h"
#include "elf/mips.h"
#include "elf-bfd.h"
#include "symcat.h"
@@ -36,7 +36,7 @@
#include "reggroups.h"
#include "elf/msp430.h"
-#include "opcode/msp430-decode.h"
+#include "../opcode/msp430-decode.h"
#include "elf-bfd.h"
/* Register Numbers. */
@@ -40,7 +40,7 @@
#include "nds32-tdep.h"
#include "elf/nds32.h"
-#include "opcode/nds32.h"
+#include "../opcode/nds32.h"
#include <algorithm>
#include "features/nds32.c"
@@ -21,7 +21,7 @@
#define NIOS2_TDEP_H
/* Nios II ISA specific encodings and macros. */
-#include "opcode/nios2.h"
+#include "../opcode/nios2.h"
/* Registers. */
#define NIOS2_Z_REGNUM 0 /* Zero */
@@ -24,8 +24,8 @@
#define TARGET_OR1K
#endif
-#include "opcodes/or1k-desc.h"
-#include "opcodes/or1k-opc.h"
+#include "../opcodes/or1k-desc.h"
+#include "../opcodes/or1k-opc.h"
/* General Purpose Registers */
#define OR1K_ZERO_REGNUM 0
@@ -35,7 +35,7 @@
#include "riscv-tdep.h"
#include "block.h"
#include "reggroups.h"
-#include "opcode/riscv.h"
+#include "../opcode/riscv.h"
#include "elf/riscv.h"
#include "elf-bfd.h"
#include "symcat.h"
@@ -51,7 +51,7 @@
#include "user-regs.h"
#include "valprint.h"
#include "common-defs.h"
-#include "opcode/riscv-opc.h"
+#include "../opcode/riscv-opc.h"
#include "cli/cli-decode.h"
#include "observable.h"
#include "prologue-value.h"
@@ -69,7 +69,7 @@ static inline bool is_ ## INSN_NAME ## _insn (long insn) \
{ \
return (insn & INSN_MASK) == INSN_MATCH; \
}
-#include "opcode/riscv-opc.h"
+#include "../opcode/riscv-opc.h"
#undef DECLARE_INSN
/* Cached information about a frame. */
@@ -193,7 +193,7 @@ static const struct register_alias riscv_register_aliases[] =
{ "ft10", 63 },
{ "ft11", 64 },
#define DECLARE_CSR(name, num) { #name, (num) + 65 },
-#include "opcode/riscv-opc.h"
+#include "../opcode/riscv-opc.h"
#undef DECLARE_CSR
};
@@ -44,7 +44,7 @@ enum
RISCV_FIRST_CSR_REGNUM = 65, /* First CSR */
#define DECLARE_CSR(name, num) \
RISCV_ ## num ## _REGNUM = RISCV_FIRST_CSR_REGNUM + num,
-#include "opcode/riscv-opc.h"
+#include "../opcode/riscv-opc.h"
#undef DECLARE_CSR
RISCV_LAST_CSR_REGNUM = 4160,
RISCV_CSR_LEGACY_MISA_REGNUM = 0xf10 + RISCV_FIRST_CSR_REGNUM,
@@ -24,7 +24,7 @@
#include "prologue-value.h"
#include "target.h"
#include "regcache.h"
-#include "opcode/rl78.h"
+#include "../opcode/rl78.h"
#include "dis-asm.h"
#include "gdbtypes.h"
#include "frame.h"
@@ -24,7 +24,7 @@
#include "prologue-value.h"
#include "target.h"
#include "regcache.h"
-#include "opcode/rx.h"
+#include "../opcode/rx.h"
#include "dis-asm.h"
#include "gdbtypes.h"
#include "frame.h"
@@ -38,7 +38,7 @@
#include "objfiles.h"
#include "solib-svr4.h"
#include "tilegx-tdep.h"
-#include "opcode/tilegx.h"
+#include "../opcode/tilegx.h"
#include <algorithm>
#include "common/byte-vector.h"