public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] sim: split sim/callback.h include out
@ 2021-06-16  6:33 Mike Frysinger
  2021-06-16  6:33 ` [PATCH 2/3] sim: drop core libiberty.h include Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-06-16  6:33 UTC (permalink / raw)
  To: gdb-patches

The sim-basics.h is too big and includes too many things.  This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.

Start with splitting out sim/callback.h.
---
 sim/common/cgen-trace.c  | 1 +
 sim/common/nrun.c        | 1 +
 sim/common/sim-basics.h  | 1 -
 sim/common/sim-endian.h  | 1 +
 sim/common/sim-hw.c      | 1 +
 sim/common/sim-io.c      | 1 +
 sim/common/sim-syscall.c | 1 +
 sim/common/sim-syscall.h | 2 ++
 sim/common/sim-trace.c   | 1 +
 sim/common/sim-utils.h   | 1 +
 sim/cris/traps.c         | 1 +
 sim/frv/traps.c          | 1 +
 sim/h8300/compile.c      | 1 +
 sim/m68hc11/sim-main.h   | 1 -
 14 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 66250c09be75..206720ca1395 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -26,6 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "bfd.h"
 #include "sim-main.h"
 #include "sim-fpu.h"
+#include "sim/callback.h"
 
 #ifndef SIZE_INSTRUCTION
 #define SIZE_INSTRUCTION 16
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index e39a0c6ed546..ba293d1ce736 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 
 #include "sim-main.h"
+#include "sim/callback.h"
 
 #include "bfd.h"
 #include "environ.h"
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index ac63aef456ac..13547422d3c3 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -112,7 +112,6 @@ typedef enum {
 /* Basic definitions - ordered so that nothing calls what comes after it.  */
 
 #include "ansidecl.h"
-#include "sim/callback.h"
 #include "sim/sim.h"
 
 #include "sim-config.h"
diff --git a/sim/common/sim-endian.h b/sim/common/sim-endian.h
index 6e9101fa3f02..7b663a3375ce 100644
--- a/sim/common/sim-endian.h
+++ b/sim/common/sim-endian.h
@@ -23,6 +23,7 @@
 #ifndef SIM_ENDIAN_H
 #define SIM_ENDIAN_H
 
+#include "bfd.h"
 
 /* C byte conversion functions */
 
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 95d95042ded4..9a3db171d1b3 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-options.h"
+#include "sim/callback.h"
 
 #include "sim-hw.h"
 
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index b5e874bef794..e09a4af7ba2e 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -24,6 +24,7 @@
 
 #include "sim-main.h"
 #include "sim-io.h"
+#include "sim/callback.h"
 #include "targ-vals.h"
 
 #include <errno.h>
diff --git a/sim/common/sim-syscall.c b/sim/common/sim-syscall.c
index 0f7601cafd73..be3ff8f82e2c 100644
--- a/sim/common/sim-syscall.c
+++ b/sim/common/sim-syscall.c
@@ -24,6 +24,7 @@
 
 #include "sim-main.h"
 #include "sim-syscall.h"
+#include "sim/callback.h"
 #include "targ-vals.h"
 \f
 /* Read/write functions for system call interface.  */
diff --git a/sim/common/sim-syscall.h b/sim/common/sim-syscall.h
index 6f79d9dfce96..562f443cb99a 100644
--- a/sim/common/sim-syscall.h
+++ b/sim/common/sim-syscall.h
@@ -20,6 +20,8 @@
 #ifndef SIM_SYSCALL_H
 #define SIM_SYSCALL_H
 
+struct cb_syscall;
+
 /* Perform a syscall on the behalf of the target program.  The error/result are
    normalized into a single value (like a lot of operating systems do).  If you
    want the split values, see the other function below.
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index b8224e0b8346..2c3798933db3 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-io.h"
 #include "sim-options.h"
 #include "sim-fpu.h"
+#include "sim/callback.h"
 
 #include "bfd.h"
 #include "libiberty.h"
diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h
index 9cc19f5567bc..bfc8ac72d08e 100644
--- a/sim/common/sim-utils.h
+++ b/sim/common/sim-utils.h
@@ -60,6 +60,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, const char *prog_name,
    write the program sections at LMA interpreted as a virtual address.
    This is still accommodated for backward compatibility reasons. */
 
+typedef struct host_callback_struct host_callback;
 typedef int sim_write_fn (SIM_DESC sd, SIM_ADDR mem,
 			  const unsigned char *buf, int length);
 struct bfd *sim_load_file (SIM_DESC sd, const char *myname,
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index a55f7dfb9927..2ad408139d83 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "sim-options.h"
+#include "sim/callback.h"
 #include "bfd.h"
 /* FIXME: get rid of targ-vals.h usage everywhere else.  */
 
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index d5cab2496226..91b424fc7e1e 100644
--- a/sim/frv/traps.c
+++ b/sim/frv/traps.c
@@ -28,6 +28,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "cgen-engine.h"
 #include "cgen-par.h"
 #include "sim-fpu.h"
+#include "sim/callback.h"
 
 #include "bfd.h"
 #include "libiberty.h"
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 01e9766790c8..8b13326a0a9c 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -33,6 +33,7 @@
 #include "sys/stat.h"
 #include "sys/types.h"
 #include "sim-options.h"
+#include "sim/callback.h"
 
 #ifndef SIGTRAP
 # define SIGTRAP 5
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 955c69fb38d4..18a7426011b0 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -28,7 +28,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "opcode/m68hc11.h"
 
-#include "sim/callback.h"
 #include "sim/sim.h"
 #include "opcode/m68hc11.h"
 #include "sim-types.h"
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] sim: drop core libiberty.h include
  2021-06-16  6:33 [PATCH 1/3] sim: split sim/callback.h include out Mike Frysinger
@ 2021-06-16  6:33 ` Mike Frysinger
  2021-06-16  6:33 ` [PATCH 3/3] sim: split sim-signal.h include out Mike Frysinger
  2021-06-20 15:11 ` [PATCH 1/3] sim: split sim/callback.h " Simon Marchi
  2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-06-16  6:33 UTC (permalink / raw)
  To: gdb-patches

This doesn't need to be included for every sim file, so drop it.
Every C file that needs it seems to already include it.
---
 sim/common/sim-basics.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index 13547422d3c3..a3dd5d93d584 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -125,8 +125,6 @@ typedef enum {
 
 #include "sim-utils.h"
 
-#include "libiberty.h"
-
 /* Note: Only the simpler interfaces are defined here.  More heavy
    weight objects, such as core and events, are defined in the more
    serious sim-base.h header. */
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] sim: split sim-signal.h include out
  2021-06-16  6:33 [PATCH 1/3] sim: split sim/callback.h include out Mike Frysinger
  2021-06-16  6:33 ` [PATCH 2/3] sim: drop core libiberty.h include Mike Frysinger
@ 2021-06-16  6:33 ` Mike Frysinger
  2021-06-20 15:11 ` [PATCH 1/3] sim: split sim/callback.h " Simon Marchi
  2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-06-16  6:33 UTC (permalink / raw)
  To: gdb-patches

The sim-basics.h is too big and includes too many things.  This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.
---
 sim/aarch64/cpustate.c         | 1 +
 sim/aarch64/memory.c           | 1 +
 sim/aarch64/simulator.c        | 2 ++
 sim/avr/interp.c               | 1 +
 sim/bfin/dv-bfin_cec.c         | 1 +
 sim/bfin/sim-main.h            | 1 -
 sim/bpf/bpf.c                  | 1 +
 sim/common/cgen-run.c          | 1 +
 sim/common/cgen-utils.c        | 1 +
 sim/common/nrun.c              | 1 +
 sim/common/sim-basics.h        | 1 -
 sim/common/sim-core.c          | 1 +
 sim/common/sim-engine.c        | 1 +
 sim/common/sim-reason.c        | 1 +
 sim/common/sim-resume.c        | 1 +
 sim/common/sim-signal.c        | 1 +
 sim/common/sim-stop.c          | 1 +
 sim/common/sim-watch.c         | 1 +
 sim/cr16/interp.c              | 1 +
 sim/cr16/simops.c              | 1 +
 sim/cris/traps.c               | 1 +
 sim/d10v/interp.c              | 1 +
 sim/d10v/simops.c              | 1 +
 sim/example-synacor/sim-main.c | 1 +
 sim/frv/interrupts.c           | 1 +
 sim/frv/traps.c                | 1 +
 sim/ft32/interp.c              | 1 +
 sim/h8300/compile.c            | 1 +
 sim/iq2000/iq2000.c            | 1 +
 sim/lm32/traps.c               | 1 +
 sim/m32r/traps-linux.c         | 1 +
 sim/m32r/traps.c               | 1 +
 sim/m68hc11/dv-m68hc11eepr.c   | 1 +
 sim/m68hc11/interrupts.c       | 1 +
 sim/m68hc11/m68hc11_sim.c      | 1 +
 sim/m68hc11/sim-main.h         | 2 +-
 sim/mcore/interp.c             | 1 +
 sim/microblaze/interp.c        | 1 +
 sim/mips/interp.c              | 1 +
 sim/mn10300/interp.c           | 1 +
 sim/mn10300/mn10300_sim.h      | 1 +
 sim/mn10300/op_utils.c         | 1 +
 sim/mn10300/sim-main.h         | 1 -
 sim/moxie/interp.c             | 1 +
 sim/msp430/msp430-sim.c        | 1 +
 sim/msp430/sim-main.h          | 1 -
 sim/or1k/traps.c               | 1 +
 sim/ppc/sim-main.h             | 1 -
 sim/pru/interp.c               | 1 +
 sim/riscv/sim-main.c           | 1 +
 sim/v850/simops.c              | 1 +
 51 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
index 6007d74872d1..45a08623f955 100644
--- a/sim/aarch64/cpustate.c
+++ b/sim/aarch64/cpustate.c
@@ -26,6 +26,7 @@
 #include <math.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "cpustate.h"
 #include "simulator.h"
 #include "libiberty.h"
diff --git a/sim/aarch64/memory.c b/sim/aarch64/memory.c
index 22caf617074d..cd2df334da56 100644
--- a/sim/aarch64/memory.c
+++ b/sim/aarch64/memory.c
@@ -33,6 +33,7 @@
 #include "simulator.h"
 
 #include "sim-core.h"
+#include "sim-signal.h"
 
 static inline void
 mem_error (sim_cpu *cpu, const char *message, uint64_t addr)
diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index be1c2987636a..0970aceda9f2 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -34,6 +34,8 @@
 #include "cpustate.h"
 #include "memory.h"
 
+#include "sim-signal.h"
+
 #define NO_SP 0
 #define SP_OK 1
 
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index 1626fadaa973..7cb17a0d44f0 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -29,6 +29,7 @@
 #include "sim-main.h"
 #include "sim-base.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 /* As AVR is a 8/16 bits processor, define handy types.  */
 typedef unsigned short int word;
diff --git a/sim/bfin/dv-bfin_cec.c b/sim/bfin/dv-bfin_cec.c
index e80616d15d15..7ad3ea068006 100644
--- a/sim/bfin/dv-bfin_cec.c
+++ b/sim/bfin/dv-bfin_cec.c
@@ -24,6 +24,7 @@
 #include <strings.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "devices.h"
 #include "dv-bfin_cec.h"
 #include "dv-bfin_evt.h"
diff --git a/sim/bfin/sim-main.h b/sim/bfin/sim-main.h
index 18d0a00e0d64..0e5d1856621a 100644
--- a/sim/bfin/sim-main.h
+++ b/sim/bfin/sim-main.h
@@ -22,7 +22,6 @@
 #define _BFIN_MAIN_SIM_H_
 
 #include "sim-basics.h"
-#include "sim-signal.h"
 #include "arch.h"
 #include "sim-base.h"
 
diff --git a/sim/bpf/bpf.c b/sim/bpf/bpf.c
index f9cdb824d1a9..9e78960ddcc5 100644
--- a/sim/bpf/bpf.c
+++ b/sim/bpf/bpf.c
@@ -24,6 +24,7 @@
 
 #include "sim-main.h"
 #include "sim-fpu.h"
+#include "sim-signal.h"
 #include "cgen-mem.h"
 #include "cgen-ops.h"
 #include "cpuall.h"
diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c
index 9420942af8ad..1b097e1f1ec8 100644
--- a/sim/common/cgen-run.c
+++ b/sim/common/cgen-run.c
@@ -38,6 +38,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 #ifndef SIM_ENGINE_PREFIX_HOOK
 #define SIM_ENGINE_PREFIX_HOOK(sd)
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 13107904678c..529d80dfb15c 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "bfd.h"
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "dis-asm.h"
 
 #define MEMOPS_DEFINE_INLINE
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index ba293d1ce736..3fd78346f957 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim/callback.h"
 
 #include "bfd.h"
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index a3dd5d93d584..32995a870d13 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -121,7 +121,6 @@ typedef enum {
 #include "sim-types.h"
 #include "sim-bits.h"
 #include "sim-endian.h"
-#include "sim-signal.h"
 
 #include "sim-utils.h"
 
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index 6604f31ea97b..2c568dc3e364 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -28,6 +28,7 @@
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 #include "libiberty.h"
 
 #if (WITH_HW)
diff --git a/sim/common/sim-engine.c b/sim/common/sim-engine.c
index a5f84af2801b..83f41f07deb7 100644
--- a/sim/common/sim-engine.c
+++ b/sim/common/sim-engine.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/common/sim-reason.c b/sim/common/sim-reason.c
index 73a57654c246..fa3683793d2d 100644
--- a/sim/common/sim-reason.c
+++ b/sim/common/sim-reason.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 #include <stdlib.h>
 
diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c
index 8f854da84751..93b198aed056 100644
--- a/sim/common/sim-resume.c
+++ b/sim/common/sim-resume.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 /* Halt the simulator after just one instruction */
 
diff --git a/sim/common/sim-signal.c b/sim/common/sim-signal.c
index f9fef4c24c64..d51860438240 100644
--- a/sim/common/sim-signal.c
+++ b/sim/common/sim-signal.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <signal.h>
 #include "sim-main.h"
+#include "sim-signal.h"
 
 /* Convert SIM_SIGFOO to SIGFOO.
    What to do when the host doesn't have SIGFOO is handled on a case by case
diff --git a/sim/common/sim-stop.c b/sim/common/sim-stop.c
index aa48fc3e6f36..076d43d81019 100644
--- a/sim/common/sim-stop.c
+++ b/sim/common/sim-stop.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 /* Generic implementation of sim_stop.  */
 
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index fa035b380549..bc6c44bcfd17 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 #include "libiberty.h"
 
 #include "sim-assert.h"
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 7f6b07fe286a..54536a4a23d1 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -30,6 +30,7 @@
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 #include "gdb/sim-cr16.h"
 #include "gdb/signals.h"
diff --git a/sim/cr16/simops.c b/sim/cr16/simops.c
index b383dfa1f926..afd870e595fa 100644
--- a/sim/cr16/simops.c
+++ b/sim/cr16/simops.c
@@ -32,6 +32,7 @@
 #include <sys/time.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "simops.h"
 #include "targ-vals.h"
 
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index 2ad408139d83..130a38053d1f 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 #include "sim/callback.h"
 #include "bfd.h"
 /* FIXME: get rid of targ-vals.h usage everywhere else.  */
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index c0cdc034700d..c48e39a27d6b 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -9,6 +9,7 @@
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 #include "gdb/sim-d10v.h"
 #include "gdb/signals.h"
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index af725ad9bb99..64c888c4c429 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -11,6 +11,7 @@
 #include <string.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "simops.h"
 #include "targ-vals.h"
 
diff --git a/sim/example-synacor/sim-main.c b/sim/example-synacor/sim-main.c
index d7a68b38bf46..ccefe1b759b5 100644
--- a/sim/example-synacor/sim-main.c
+++ b/sim/example-synacor/sim-main.c
@@ -25,6 +25,7 @@
 #include "defs.h"
 
 #include "sim-main.h"
+#include "sim-signal.h"
 \f
 /* Get the register number from the number.  */
 static unsigned16
diff --git a/sim/frv/interrupts.c b/sim/frv/interrupts.c
index a657c68e2417..99b27cffa948 100644
--- a/sim/frv/interrupts.c
+++ b/sim/frv/interrupts.c
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define WANT_CPU_FRVBF
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "bfd.h"
 #include <stdlib.h>
 
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index 91b424fc7e1e..46cb8d92f29e 100644
--- a/sim/frv/traps.c
+++ b/sim/frv/traps.c
@@ -28,6 +28,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "cgen-engine.h"
 #include "cgen-par.h"
 #include "sim-fpu.h"
+#include "sim-signal.h"
 #include "sim/callback.h"
 
 #include "bfd.h"
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 8a44a472f605..be2c3e55aff4 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -33,6 +33,7 @@
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 #include "opcode/ft32.h"
 
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 8b13326a0a9c..3f637ff5bfe5 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -33,6 +33,7 @@
 #include "sys/stat.h"
 #include "sys/types.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 #include "sim/callback.h"
 
 #ifndef SIGTRAP
diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c
index 018c6a63a3f3..362cc4acb192 100644
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -24,6 +24,7 @@
 #define WANT_CPU_IQ2000BF
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "cgen-mem.h"
 #include "cgen-ops.h"
 #include "targ-vals.h"
diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c
index 5b010f9d3fed..77b4accef4ee 100644
--- a/sim/lm32/traps.c
+++ b/sim/lm32/traps.c
@@ -25,6 +25,7 @@
 #define WANT_CPU_LM32BF
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "lm32-sim.h"
 #include "targ-vals.h"
diff --git a/sim/m32r/traps-linux.c b/sim/m32r/traps-linux.c
index 1e3a08497e90..8ff046590d40 100644
--- a/sim/m32r/traps-linux.c
+++ b/sim/m32r/traps-linux.c
@@ -22,6 +22,7 @@
 
 #include "portability.h"
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "syscall.h"
 #include "targ-vals.h"
diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c
index ffa09f1527f0..4cec5c0d45ce 100644
--- a/sim/m32r/traps.c
+++ b/sim/m32r/traps.c
@@ -21,6 +21,7 @@
 #include "defs.h"
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "targ-vals.h"
 #include <stdlib.h>
diff --git a/sim/m68hc11/dv-m68hc11eepr.c b/sim/m68hc11/dv-m68hc11eepr.c
index 1e4cb5eab054..ac67bf9e76aa 100644
--- a/sim/m68hc11/dv-m68hc11eepr.c
+++ b/sim/m68hc11/dv-m68hc11eepr.c
@@ -25,6 +25,7 @@
 #include "hw-main.h"
 #include "sim-assert.h"
 #include "sim-events.h"
+#include "sim-signal.h"
 
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c
index 1adce5082190..e6a9d7399727 100644
--- a/sim/m68hc11/interrupts.c
+++ b/sim/m68hc11/interrupts.c
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 static const char *interrupt_names[] = {
   "R1",
diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c
index 3c619c14ab0b..bdf69e2ac2c2 100644
--- a/sim/m68hc11/m68hc11_sim.c
+++ b/sim/m68hc11/m68hc11_sim.c
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-assert.h"
 #include "sim-module.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 
 #include <stdlib.h>
 
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 18a7426011b0..a48d7f4c8f1d 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -21,7 +21,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define _SIM_MAIN_H
 
 #include "sim-basics.h"
-#include "sim-signal.h"
 #include "sim-base.h"
 
 #include "bfd.h"
@@ -30,6 +29,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim/sim.h"
 #include "opcode/m68hc11.h"
+#include "sim-signal.h"
 #include "sim-types.h"
 
 typedef unsigned8 uint8;
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 3517068abf5b..138dcccea4d3 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -32,6 +32,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-main.h"
 #include "sim-base.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "sim-options.h"
 
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index e451f2d68d14..94f50f1e4cd9 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -30,6 +30,7 @@
 
 #include "sim-main.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 
 #include "microblaze-dis.h"
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index a6f504acc764..4ab908d4f7a0 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -31,6 +31,7 @@ code on the hardware.
 #include "sim-options.h"
 #include "sim-assert.h"
 #include "sim-hw.h"
+#include "sim-signal.h"
 
 #include "itable.h"
 
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 541d4b14668c..c79ce0155340 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -9,6 +9,7 @@
 
 #include "bfd.h"
 #include "sim-assert.h"
+#include "sim-signal.h"
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h
index c63efaa6c769..7a0d857cc58e 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300_sim.h
@@ -7,6 +7,7 @@
 #include "sim/sim.h"
 #include "bfd.h"
 #include "sim-fpu.h"
+#include "sim-signal.h"
 
 extern SIM_DESC simulator;
 
diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c
index cd0f1a667e49..df95be3b1ac4 100644
--- a/sim/mn10300/op_utils.c
+++ b/sim/mn10300/op_utils.c
@@ -2,6 +2,7 @@
 #include "defs.h"
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "targ-vals.h"
 
diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
index 875072941839..101586e5c70d 100644
--- a/sim/mn10300/sim-main.h
+++ b/sim/mn10300/sim-main.h
@@ -25,7 +25,6 @@
 #define SIM_ENGINE_HALT_HOOK(SD,LAST_CPU,CIA) /* disable this hook */
 
 #include "sim-basics.h"
-#include "sim-signal.h"
 
 #include <signal.h> /* For kill() in insns:do_trap */
 
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index caf9e43deda5..8f3a85ca16d7 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -34,6 +34,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-base.h"
 #include "sim-options.h"
 #include "sim-io.h"
+#include "sim-signal.h"
 #include "targ-vals.h"
 
 typedef int word;
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index 58a54698993f..4f270a099da1 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -30,6 +30,7 @@
 #include <assert.h>
 #include "opcode/msp430-decode.h"
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "targ-vals.h"
 
diff --git a/sim/msp430/sim-main.h b/sim/msp430/sim-main.h
index fdfa5d094560..68910046997b 100644
--- a/sim/msp430/sim-main.h
+++ b/sim/msp430/sim-main.h
@@ -22,7 +22,6 @@
 #define _MSP430_MAIN_SIM_H_
 
 #include "sim-basics.h"
-#include "sim-signal.h"
 #include "msp430-sim.h"
 #include "sim-base.h"
 
diff --git a/sim/or1k/traps.c b/sim/or1k/traps.c
index bb428fa4a886..91f0d2bdd136 100644
--- a/sim/or1k/traps.c
+++ b/sim/or1k/traps.c
@@ -23,6 +23,7 @@
 #define WANT_CPU
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "cgen-ops.h"
 
 /* Implement the sim invalid instruction function.  This will set the error
diff --git a/sim/ppc/sim-main.h b/sim/ppc/sim-main.h
index 1e565c119ed4..047b36cbce4b 100644
--- a/sim/ppc/sim-main.h
+++ b/sim/ppc/sim-main.h
@@ -1,5 +1,4 @@
 #include "sim-basics.h"
-#include "sim-signal.h"
 
 typedef unsigned32 sim_cia;
 
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index 38269df44ce7..194022d486de 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -31,6 +31,7 @@
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-options.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 #include "pru.h"
 
diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index a09ae033cac2..0faf9395ae52 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -28,6 +28,7 @@
 #include <time.h>
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "sim-syscall.h"
 
 #include "opcode/riscv.h"
diff --git a/sim/v850/simops.c b/sim/v850/simops.c
index 800a5904ea44..6a111044f652 100644
--- a/sim/v850/simops.c
+++ b/sim/v850/simops.c
@@ -2,6 +2,7 @@
 #include "defs.h"
 
 #include "sim-main.h"
+#include "sim-signal.h"
 #include "v850_sim.h"
 #include "simops.h"
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] sim: split sim/callback.h include out
  2021-06-16  6:33 [PATCH 1/3] sim: split sim/callback.h include out Mike Frysinger
  2021-06-16  6:33 ` [PATCH 2/3] sim: drop core libiberty.h include Mike Frysinger
  2021-06-16  6:33 ` [PATCH 3/3] sim: split sim-signal.h include out Mike Frysinger
@ 2021-06-20 15:11 ` Simon Marchi
  2021-06-20 20:56   ` Mike Frysinger
  2 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-06-20 15:11 UTC (permalink / raw)
  To: Mike Frysinger, gdb-patches



On 2021-06-16 2:33 a.m., Mike Frysinger via Gdb-patches wrote:
> The sim-basics.h is too big and includes too many things.  This leads
> to some arch's sim-main.h having circular loop issues with defs, and
> makes it hard to separate out common objects from arch-specific defs.
> By splitting up sim-basics.h and killing off sim-main.h, it'll make
> it easier to separate out the two.
> 
> Start with splitting out sim/callback.h.

Starting with this patch (according to bisect), I get this link error:


make[3]: Entering directory '/home/simark/build/binutils-gdb/sim/erc32'
ccache gcc -DHAVE_CONFIG_H     -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration   -I. -I/home/simark/src/binutils-gdb/sim/erc32 -I../common -I/home/simark/src/binutils-gdb/sim/erc32/../common -I../../include -I/home/simark/src/binutils-gdb/sim/erc32/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/erc32/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/erc32/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/erc32/../../gnulib/import -I../../gnulib/import  -DFAST_UART -I/home/simark/src/binutils-gdb/sim/erc32/../.. -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -o sis \
  sis.o exec.o erc32.o func.o help.o float.o ../common/common_libcommon_a-portability.o ../common/common_libcommon_a-sim-load.o ../common/common_libcommon_a-version.o ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a -lm -ltinfo -ldl -lnsl  -lz -lreadline -ltinfo -lm  ../../gnulib/import/libgnu.a 
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: warning: relocation against `current_target_byte_order' in read-only section `.text'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `LSEXTRACTED':
/home/simark/src/binutils-gdb/sim/common/sim-bits.c:64: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `MSEXTRACTED':
/home/simark/src/binutils-gdb/sim/common/sim-bits.c:99: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `LSINSERTED':
/home/simark/src/binutils-gdb/sim/common/sim-bits.c:134: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `MSINSERTED':
/home/simark/src/binutils-gdb/sim/common/sim-bits.c:170: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `LSSEXT':
/home/simark/src/binutils-gdb/sim/common/sim-bits.c:207: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o:/home/simark/src/binutils-gdb/sim/common/sim-bits.c:234: more undefined references to `sim_io_error' follow
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_t2h_1':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_h2t_1':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `offset_1':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:145: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:146: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:147: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_t2h_2':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_h2t_2':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `offset_2':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:145: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:146: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:147: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_t2h_4':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_h2t_4':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `offset_4':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:145: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:146: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:147: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_t2h_8':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_h2t_8':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `offset_8':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:145: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:146: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:147: undefined reference to `sim_io_error'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_t2h_16':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:47: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `endian_h2t_16':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:61: undefined reference to `current_target_byte_order'
/usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `offset_16':
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:145: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:146: undefined reference to `sim_io_error'
/usr/bin/ld: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:147: undefined reference to `sim_io_error'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] sim: split sim/callback.h include out
  2021-06-20 15:11 ` [PATCH 1/3] sim: split sim/callback.h " Simon Marchi
@ 2021-06-20 20:56   ` Mike Frysinger
  2021-06-21 17:38     ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2021-06-20 20:56 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 20 Jun 2021 11:11, Simon Marchi wrote:
> On 2021-06-16 2:33 a.m., Mike Frysinger via Gdb-patches wrote:
> > The sim-basics.h is too big and includes too many things.  This leads
> > to some arch's sim-main.h having circular loop issues with defs, and
> > makes it hard to separate out common objects from arch-specific defs.
> > By splitting up sim-basics.h and killing off sim-main.h, it'll make
> > it easier to separate out the two.
> > 
> > Start with splitting out sim/callback.h.
> 
> Starting with this patch (according to bisect), I get this link error:

bisecting is why i've been doing small/medium patches and not giant dumps :).

> make[3]: Entering directory '/home/simark/build/binutils-gdb/sim/erc32'
> ccache gcc -DHAVE_CONFIG_H     -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration   -I. -I/home/simark/src/binutils-gdb/sim/erc32 -I../common -I/home/simark/src/binutils-gdb/sim/erc32/../common -I../../include -I/home/simark/src/binutils-gdb/sim/erc32/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/erc32/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/erc32/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/erc32/../../gnulib/import -I../../gnulib/import  -DFAST_UART -I/home/simark/src/binutils-gdb/sim/erc32/../.. -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -o sis \
>   sis.o exec.o erc32.o func.o help.o float.o ../common/common_libcommon_a-portability.o ../common/common_libcommon_a-sim-load.o ../common/common_libcommon_a-version.o ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a -lm -ltinfo -ldl -lnsl  -lz -lreadline -ltinfo -lm  ../../gnulib/import/libgnu.a 
> /usr/bin/ld: ../common/common_libcommon_a-sim-load.o: warning: relocation against `current_target_byte_order' in read-only section `.text'
> /usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `LSEXTRACTED':
> /home/simark/src/binutils-gdb/sim/common/sim-bits.c:64: undefined reference to `sim_io_error'

this is weird.  it builds fine for me with -O0.  i just tried with sanitizers
enabled too and still passes.  all with gcc-11.1.

but let's focus on the error.

LSEXTRACTED doesn't call sim_io_error.  it does call the ASSERT macro which
might expand to calling sim_io_error, but that includes sim-io.h before using
the func.  so that part looks ok.

sim_io_error is defined in sim-io.o.  but erc32 doesn't link that in.  but it
also doesn't use it in general ...

why does your sim-load have references to LSEXTRACTED et al in the first place ?
sim-load doesn't use any of those APIs.  i guess this gets back to your system
not handling static/inline the way others are for some reason ?

$ readelf -sW common/common_libcommon_a-sim-load.o  | grep sim
  1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS sim-load.c
 17: 0000000000000127   990 FUNC    GLOBAL DEFAULT    1 sim_load_file
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] sim: split sim/callback.h include out
  2021-06-20 20:56   ` Mike Frysinger
@ 2021-06-21 17:38     ` Simon Marchi
  2021-06-21 23:48       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-06-21 17:38 UTC (permalink / raw)
  To: gdb-patches

On 2021-06-20 4:56 p.m., Mike Frysinger wrote:
> On 20 Jun 2021 11:11, Simon Marchi wrote:
>> On 2021-06-16 2:33 a.m., Mike Frysinger via Gdb-patches wrote:
>>> The sim-basics.h is too big and includes too many things.  This leads
>>> to some arch's sim-main.h having circular loop issues with defs, and
>>> makes it hard to separate out common objects from arch-specific defs.
>>> By splitting up sim-basics.h and killing off sim-main.h, it'll make
>>> it easier to separate out the two.
>>>
>>> Start with splitting out sim/callback.h.
>>
>> Starting with this patch (according to bisect), I get this link error:
> 
> bisecting is why i've been doing small/medium patches and not giant dumps :).
> 
>> make[3]: Entering directory '/home/simark/build/binutils-gdb/sim/erc32'
>> ccache gcc -DHAVE_CONFIG_H     -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration   -I. -I/home/simark/src/binutils-gdb/sim/erc32 -I../common -I/home/simark/src/binutils-gdb/sim/erc32/../common -I../../include -I/home/simark/src/binutils-gdb/sim/erc32/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/erc32/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/erc32/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/erc32/../../gnulib/import -I../../gnulib/import  -DFAST_UART -I/home/simark/src/binutils-gdb/sim/erc32/../.. -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -o sis \
>>   sis.o exec.o erc32.o func.o help.o float.o ../common/common_libcommon_a-portability.o ../common/common_libcommon_a-sim-load.o ../common/common_libcommon_a-version.o ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a -lm -ltinfo -ldl -lnsl  -lz -lreadline -ltinfo -lm  ../../gnulib/import/libgnu.a 
>> /usr/bin/ld: ../common/common_libcommon_a-sim-load.o: warning: relocation against `current_target_byte_order' in read-only section `.text'
>> /usr/bin/ld: ../common/common_libcommon_a-sim-load.o: in function `LSEXTRACTED':
>> /home/simark/src/binutils-gdb/sim/common/sim-bits.c:64: undefined reference to `sim_io_error'
> 
> this is weird.  it builds fine for me with -O0.  i just tried with sanitizers
> enabled too and still passes.  all with gcc-11.1.
> 
> but let's focus on the error.
> 
> LSEXTRACTED doesn't call sim_io_error.  it does call the ASSERT macro which
> might expand to calling sim_io_error, but that includes sim-io.h before using
> the func.  so that part looks ok.
> 
> sim_io_error is defined in sim-io.o.  but erc32 doesn't link that in.  but it
> also doesn't use it in general ...
> 
> why does your sim-load have references to LSEXTRACTED et al in the first place ?
> sim-load doesn't use any of those APIs.  i guess this gets back to your system
> not handling static/inline the way others are for some reason ?
> 
> $ readelf -sW common/common_libcommon_a-sim-load.o  | grep sim
>   1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS sim-load.c
>  17: 0000000000000127   990 FUNC    GLOBAL DEFAULT    1 sim_load_file
> -mike
> 

Well, it builds fine now, I probably was just in a bad state.  Sorry for
the noise.

Simon


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] sim: split sim/callback.h include out
  2021-06-21 17:38     ` Simon Marchi
@ 2021-06-21 23:48       ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-06-21 23:48 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 21 Jun 2021 13:38, Simon Marchi via Gdb-patches wrote:
> Well, it builds fine now, I probably was just in a bad state.  Sorry for
> the noise.

np.  i've been a bit unhappy with the build in general and it detecting
changes.  i'm hoping the move to automake will help more with that, and
with getting more knobs out of CPPFLAGS and into config.h (or doing it
at runtime).

i've gotten a bit in the habit of doing `make clean` and leaning on ccache
to keep rebuilds fast.
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-21 23:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  6:33 [PATCH 1/3] sim: split sim/callback.h include out Mike Frysinger
2021-06-16  6:33 ` [PATCH 2/3] sim: drop core libiberty.h include Mike Frysinger
2021-06-16  6:33 ` [PATCH 3/3] sim: split sim-signal.h include out Mike Frysinger
2021-06-20 15:11 ` [PATCH 1/3] sim: split sim/callback.h " Simon Marchi
2021-06-20 20:56   ` Mike Frysinger
2021-06-21 17:38     ` Simon Marchi
2021-06-21 23:48       ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).