Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/5] sim: hw: move cfi & glue to common code
Date: Sun, 20 Jun 2021 01:55:19 -0400	[thread overview]
Message-ID: <20210620055519.22229-5-vapier@gentoo.org> (raw)
In-Reply-To: <20210620055519.22229-1-vapier@gentoo.org>

These don't depend on any arch state, so move them to the common
build code so we only build them once across all subdirs.
---
 sim/Makefile.in           | 61 +++++++++++++++++++++++++++++++--------
 sim/common/Make-common.in |  8 +++--
 sim/common/dv-cfi.c       |  2 +-
 sim/common/hw-base.h      |  2 ++
 sim/common/local.mk       |  6 ++++
 5 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 4bf1e2e21e27..2701462ba096 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -216,7 +216,8 @@ BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(CSEARCH)
 
 COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(SIM_EXTRA_CFLAGS)
 
-SIM_HW_DEVICES = cfi core pal glue $(SIM_EXTRA_HW_DEVICES)
+SIM_HW_DEVICES = core pal $(SIM_EXTRA_HW_DEVICES)
+SIM_HW_DEVICES_COMMON = cfi glue
 
 ZLIB = $(zlibdir) -lz
 LIBIBERTY_LIB = ../../libiberty/libiberty.a
@@ -228,6 +229,7 @@ EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
 	$(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
 
 COMMON_OBJS_NAMES = \
+	$(SIM_HW_DEVICES_COMMON:%=dv-%.o) \
 	portability.o \
 	sim-load.o \
 	version.o
@@ -419,12 +421,12 @@ hw-config.h: stamp-hw ; @true
 stamp-hw: Makefile.in $(srccom)/Make-common.in $(config.status) Makefile
 	rm -f tmp-hw.h
 	echo "/* generated by Makefile */" > tmp-hw.h
-	sim_hw="$(SIM_HW_DEVICES)"; \
+	sim_hw="$(SIM_HW_DEVICES) $(SIM_HW_DEVICES_COMMON)"; \
 	for hw in $$sim_hw ; do \
 	  echo "extern const struct hw_descriptor dv_$${hw}_descriptor[];" ; \
 	done >> tmp-hw.h
 	echo "const struct hw_descriptor *hw_descriptors[] = {" >> tmp-hw.h
-	sim_hw="$(SIM_HW_DEVICES)"; \
+	sim_hw="$(SIM_HW_DEVICES) $(SIM_HW_DEVICES_COMMON)"; \
 	for hw in $$sim_hw ; do \
 	  echo "  dv_$${hw}_descriptor," ; \
 	done >> tmp-hw.h
diff --git a/sim/common/dv-cfi.c b/sim/common/dv-cfi.c
index 02a2cedd558b..008a3904771b 100644
--- a/sim/common/dv-cfi.c
+++ b/sim/common/dv-cfi.c
@@ -34,10 +34,10 @@
 #include <sys/mman.h>
 #endif
 
-#include "sim-main.h"
 #include "hw-base.h"
 #include "hw-main.h"
 #include "dv-cfi.h"
+#include "libiberty.h"
 
 /* Flashes are simple state machines, so here we cover all the
    different states a device might be in at any particular time.  */
diff --git a/sim/common/hw-base.h b/sim/common/hw-base.h
index f1cf989357b7..6980834c6874 100644
--- a/sim/common/hw-base.h
+++ b/sim/common/hw-base.h
@@ -23,6 +23,8 @@
 #ifndef HW_BASE
 #define HW_BASE
 
+struct sim_state;
+
 /* Create a primative device */
 
 struct hw *hw_create
diff --git a/sim/common/local.mk b/sim/common/local.mk
index 25c7e5beb1f9..bc562c6e5e5e 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -38,6 +38,12 @@ noinst_LIBRARIES += %D%/libcommon.a
 	%D%/sim-load.c \
 	%D%/version.c
 
+if SIM_ENABLE_HW
+%C%_libcommon_a_SOURCES += \
+	%D%/dv-cfi.c \
+	%D%/dv-glue.c
+endif
+
 %D%/version.c: %D%/version.c-stamp ; @true
 %D%/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh
 	$(AM_V_GEN)$(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp
-- 
2.31.1


      parent reply	other threads:[~2021-06-20  5:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20  5:55 [PATCH 1/5] sim: hw: rework configure option & device selection Mike Frysinger via Gdb-patches
2021-06-20  5:55 ` [PATCH 2/5] sim: unify hardware settings Mike Frysinger via Gdb-patches
2021-06-20  5:55 ` [PATCH 3/5] sim: drop configure scripts for simple ports Mike Frysinger via Gdb-patches
2021-06-23  1:05   ` Simon Marchi via Gdb-patches
2021-06-23  2:09     ` Mike Frysinger via Gdb-patches
2021-06-23  2:59     ` [PATCH] sim: switch common srcdir to abs_srcdir Mike Frysinger via Gdb-patches
2021-06-23 13:01       ` Simon Marchi via Gdb-patches
2021-06-20  5:55 ` [PATCH 4/5] sim: rx: merge with common configure script Mike Frysinger via Gdb-patches
2021-06-20  5:55 ` Mike Frysinger via Gdb-patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210620055519.22229-5-vapier@gentoo.org \
    --to=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox