* [PATCH] sim: ppc: enable use of gnulib
@ 2021-09-09 6:37 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2021-09-09 6:37 UTC (permalink / raw)
To: gdb-patches
All other sim arches are using this now, so finish up the logic in
the ppc arch to enable gnulib usage here too.
---
sim/ppc/Makefile.in | 8 ++++++--
sim/ppc/cpu.c | 3 +++
sim/ppc/defs.h | 12 ++++++++++++
sim/ppc/device.c | 3 +++
sim/ppc/main.c | 2 ++
5 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index b0d2ae99a04e..397e76cbe1e1 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -25,6 +25,10 @@ srccom = $(srcdir)/../common
srcroot = $(srcdir)/../..
srcsim = $(srcdir)/..
+# Helper code from gnulib.
+GNULIB_PARENT_DIR = ../..
+include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
+
# Settings from top-level configure.
include ../arch-subdir.mk
@@ -82,11 +86,11 @@ CONFIG_CFLAGS = \
$(DEVZERO_CFLAGS)
SIM_FPU_CFLAGS = @sim_fpu_cflags@
-STD_CFLAGS = $(CFLAGS) $(WERROR_CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS)
+STD_CFLAGS = $(CFLAGS) $(WERROR_CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(INCGNU) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS)
NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(INCLUDES) $(SIM_FPU_CFLAGS)
BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARN_CFLAGS)
-LIBS = $(COMMON_LIBS) @LIBS@
+LIBS = $(COMMON_LIBS) @LIBS@ $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
diff --git a/sim/ppc/cpu.c b/sim/ppc/cpu.c
index 3169553a5870..1462766e5fe4 100644
--- a/sim/ppc/cpu.c
+++ b/sim/ppc/cpu.c
@@ -21,6 +21,9 @@
#ifndef _CPU_C_
#define _CPU_C_
+/* This must come before any other includes. */
+#include "defs.h"
+
#include <setjmp.h>
#include "cpu.h"
diff --git a/sim/ppc/defs.h b/sim/ppc/defs.h
index 9a89844adb70..c37f8c604854 100644
--- a/sim/ppc/defs.h
+++ b/sim/ppc/defs.h
@@ -20,6 +20,18 @@
#ifndef DEFS_H
#define DEFS_H
+/* Include gnulib's various configure tests. */
+#include "gnulib/config.h"
+
+/* Reset macros that our config.h will provide. */
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_URL
+#undef PACKAGE_VERSION
+
/* Include arch-specific sim's various configure tests. */
#include "config.h"
diff --git a/sim/ppc/device.c b/sim/ppc/device.c
index 4abef6f9e234..aa97e0bfdbf4 100644
--- a/sim/ppc/device.c
+++ b/sim/ppc/device.c
@@ -21,6 +21,9 @@
#ifndef _DEVICE_C_
#define _DEVICE_C_
+/* This must come before any other includes. */
+#include "defs.h"
+
#include <stdio.h>
#include "device_table.h"
diff --git a/sim/ppc/main.c b/sim/ppc/main.c
index 3b82c88db068..d9a40700973d 100644
--- a/sim/ppc/main.c
+++ b/sim/ppc/main.c
@@ -17,6 +17,8 @@
*/
+/* This must come before any other includes. */
+#include "defs.h"
#include <stdarg.h>
#include <stdio.h>
--
2.33.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-09 6:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 6:37 [PATCH] sim: ppc: enable use of gnulib 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).