Do not accidentally include in-tree readline headers
authorTom Tromey <tom@tromey.com>
Wed, 26 Sep 2018 12:54:17 +0000 (06:54 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 7 Oct 2018 04:46:56 +0000 (22:46 -0600)
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

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-10-06  Tom Tromey  <tom@tromey.com>

PR build/17077:
* Makefile.in (OPCODES_CFLAGS): Remove "-I$(OPCODES_SRC)/..".
* arc-tdep.c, frv-tdep.c, lm32-tdep.c, mep-tdep.c,
microblaze-tdep.c, or1k-tdep.h: Use ../opcodes, not opcodes, in
#include.

gdb/ChangeLog
gdb/Makefile.in
gdb/arc-tdep.c
gdb/frv-tdep.c
gdb/lm32-tdep.c
gdb/mep-tdep.c
gdb/microblaze-tdep.c
gdb/or1k-tdep.h

index e6f821d..0454d15 100644 (file)
@@ -1,5 +1,13 @@
 2018-10-06  Tom Tromey  <tom@tromey.com>
 
+       PR build/17077:
+       * Makefile.in (OPCODES_CFLAGS): Remove "-I$(OPCODES_SRC)/..".
+       * arc-tdep.c, frv-tdep.c, lm32-tdep.c, mep-tdep.c,
+       microblaze-tdep.c, or1k-tdep.h: Use ../opcodes, not opcodes, in
+       #include.
+
+2018-10-06  Tom Tromey  <tom@tromey.com>
+
        * python/py-breakpoint.c (bppy_get_location): Handle a
        bp_breakpoint without a location.
 
index 8d780ac..5b3a952 100644 (file)
@@ -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.
index fad9170..b9dcbbc 100644 (file)
@@ -33,7 +33,7 @@
 
 /* ARC header files.  */
 #include "opcode/arc.h"
-#include "opcodes/arc-dis.h"
+#include "../opcodes/arc-dis.h"
 #include "arc-tdep.h"
 
 /* Standard headers.  */
index 1eed441..dafab75 100644 (file)
@@ -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"
index 9428521..694d30e 100644 (file)
@@ -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.  */
index 4b5bfcb..ae9c4de 100644 (file)
@@ -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"
 
 \f
 /* The gdbarch_tdep structure.  */
index 4dbfd1b..018b713 100644 (file)
@@ -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"
 
index 4a93540..b630c77 100644 (file)
@@ -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