public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Some minor sim fixes
@ 2021-05-04 14:58 Tom Tromey
  2021-05-04 14:58 ` [PATCH 1/3] Add config.h to generated_files for sim Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Tom Tromey @ 2021-05-04 14:58 UTC (permalink / raw)
  To: gdb-patches

After some recent changes, parts of the sim failed to build for me.
Patch #2 addresses the main problem, but patch #1 also improved things
somewhat.

Tom



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

* [PATCH 1/3] Add config.h to generated_files for sim
  2021-05-04 14:58 [PATCH 0/3] Some minor sim fixes Tom Tromey
@ 2021-05-04 14:58 ` Tom Tromey
  2021-05-04 17:38   ` Mike Frysinger
  2021-05-04 14:58 ` [PATCH 2/3] Fix igen build Tom Tromey
  2021-05-04 14:58 ` [PATCH 3/3] Add missing stdlib.h includes to sim Tom Tromey
  2 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2021-05-04 14:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that config.h isn't in 'generated_files' in the sim
subdirectories.  This causes it to sometimes be rebuilt too late.

sim/common/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* Make-common.in (generated_files): Add config.h.
---
 sim/common/ChangeLog      | 4 ++++
 sim/common/Make-common.in | 1 +
 2 files changed, 5 insertions(+)

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 0f877490509..c92228bb929 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -420,6 +420,7 @@ endif
 all_object_files = $(LIB_OBJS) $(SIM_RUN_OBJS)
 generated_files = \
 	$(SIM_EXTRA_DEPS) \
+	config.h \
 	hw-config.h \
 	modules.c \
 	targ-map.c \
-- 
2.26.3


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

* [PATCH 2/3] Fix igen build
  2021-05-04 14:58 [PATCH 0/3] Some minor sim fixes Tom Tromey
  2021-05-04 14:58 ` [PATCH 1/3] Add config.h to generated_files for sim Tom Tromey
@ 2021-05-04 14:58 ` Tom Tromey
  2021-05-04 17:38   ` Mike Frysinger
  2021-05-04 14:58 ` [PATCH 3/3] Add missing stdlib.h includes to sim Tom Tromey
  2 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2021-05-04 14:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The igen build fails for me like:

gcc  -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o
In file included from ../../binutils-gdb/sim/igen/igen.c:26:
../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory

This patch fixes the problem by arranging for igen to find the
libiberty includes.

This seems slightly hacky to me, because libiberty is not a "build"
library, so it can't be linked against.  However, since igen currently
only includes the header, it seems relatively safe.

sim/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* Makefile.in: Rebuild.
	* Makefile.am (AM_CPPFLAGS): New variable.
---
 sim/ChangeLog   | 5 +++++
 sim/Makefile.am | 2 ++
 sim/Makefile.in | 1 +
 3 files changed, 8 insertions(+)

diff --git a/sim/Makefile.am b/sim/Makefile.am
index a68a964d87a..6696adc304a 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -35,6 +35,8 @@ CLEANFILES =
 DISTCLEANFILES =
 MOSTLYCLEANFILES = core
 
+AM_CPPFLAGS = -I$(srcroot)/include
+
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 
diff --git a/sim/Makefile.in b/sim/Makefile.in
index 890adab5072..5c997b0c118 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -682,6 +682,7 @@ CLEANFILES = testsuite/common/bits-gen testsuite/common/bits32m0.c \
 DISTCLEANFILES = 
 MOSTLYCLEANFILES = core $(am__append_3) site-srcdir.exp testrun.log \
 	testrun.sum
+AM_CPPFLAGS = -I$(srcroot)/include
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 @SIM_ENABLE_IGEN_TRUE@igen_libigen_a_SOURCES = \
-- 
2.26.3


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

* [PATCH 3/3] Add missing stdlib.h includes to sim
  2021-05-04 14:58 [PATCH 0/3] Some minor sim fixes Tom Tromey
  2021-05-04 14:58 ` [PATCH 1/3] Add config.h to generated_files for sim Tom Tromey
  2021-05-04 14:58 ` [PATCH 2/3] Fix igen build Tom Tromey
@ 2021-05-04 14:58 ` Tom Tromey
  2021-05-04 17:44   ` Mike Frysinger
  2 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2021-05-04 14:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This updates the various "mloop.in" files to emit an include of
stdlib.h, to avoid warnings about 'abort' being undeclared.

One such warning now remains, in mn10300.igen.  I don't know offhand
the best way to fix this one.

sim/cris/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/iq2000/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/lm32/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/m32r/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.

sim/or1k/ChangeLog
2021-05-04  Tom Tromey  <tromey@adacore.com>

	* mloop.in: Include <stdlib.h>.
---
 sim/cris/ChangeLog   | 4 ++++
 sim/cris/mloop.in    | 2 ++
 sim/iq2000/ChangeLog | 4 ++++
 sim/iq2000/mloop.in  | 1 +
 sim/lm32/ChangeLog   | 4 ++++
 sim/lm32/mloop.in    | 1 +
 sim/m32r/ChangeLog   | 4 ++++
 sim/m32r/mloop.in    | 1 +
 sim/or1k/ChangeLog   | 4 ++++
 sim/or1k/mloop.in    | 1 +
 10 files changed, 26 insertions(+)

diff --git a/sim/cris/mloop.in b/sim/cris/mloop.in
index 32f5fef95f3..645d8211606 100644
--- a/sim/cris/mloop.in
+++ b/sim/cris/mloop.in
@@ -42,6 +42,8 @@ case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
+
 /* It seems we don't have a templated header file corresponding to
    cris-tmpl.c, so we have to get out declarations the hackish way.  */
 extern void @cpu@_specific_init (SIM_CPU *current_cpu);
diff --git a/sim/iq2000/mloop.in b/sim/iq2000/mloop.in
index b973fa106ab..7d3a9b5e9a1 100644
--- a/sim/iq2000/mloop.in
+++ b/sim/iq2000/mloop.in
@@ -40,6 +40,7 @@ case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn, ARGBUF *abuf,
diff --git a/sim/lm32/mloop.in b/sim/lm32/mloop.in
index a8db7f51768..574f00a5119 100644
--- a/sim/lm32/mloop.in
+++ b/sim/lm32/mloop.in
@@ -32,6 +32,7 @@ case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,
diff --git a/sim/m32r/mloop.in b/sim/m32r/mloop.in
index 405a7e92736..6b0d0dec616 100644
--- a/sim/m32r/mloop.in
+++ b/sim/m32r/mloop.in
@@ -42,6 +42,7 @@ case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract16 (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,
diff --git a/sim/or1k/mloop.in b/sim/or1k/mloop.in
index 49c42276209..a94b534a9ae 100644
--- a/sim/or1k/mloop.in
+++ b/sim/or1k/mloop.in
@@ -42,6 +42,7 @@ case "x$1" in
 xsupport)
 
 cat <<EOF
+#include <stdlib.h>
 
 static INLINE const IDESC *
 extract (SIM_CPU *current_cpu, PCADDR pc, CGEN_INSN_INT insn,
-- 
2.26.3


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

* Re: [PATCH 1/3] Add config.h to generated_files for sim
  2021-05-04 14:58 ` [PATCH 1/3] Add config.h to generated_files for sim Tom Tromey
@ 2021-05-04 17:38   ` Mike Frysinger
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2021-05-04 17:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04 May 2021 08:58, Tom Tromey wrote:
> I noticed that config.h isn't in 'generated_files' in the sim
> subdirectories.  This causes it to sometimes be rebuilt too late.

lgtm, thanks
-mike

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

* Re: [PATCH 2/3] Fix igen build
  2021-05-04 14:58 ` [PATCH 2/3] Fix igen build Tom Tromey
@ 2021-05-04 17:38   ` Mike Frysinger
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2021-05-04 17:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04 May 2021 08:58, Tom Tromey wrote:
> The igen build fails for me like:
> 
> gcc  -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o
> In file included from ../../binutils-gdb/sim/igen/igen.c:26:
> ../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory
> 
> This patch fixes the problem by arranging for igen to find the
> libiberty includes.
> 
> This seems slightly hacky to me, because libiberty is not a "build"
> library, so it can't be linked against.  However, since igen currently
> only includes the header, it seems relatively safe.

since it's only hitting srcroot i think it's OK.  if it was hitting the
build paths, then we'd be in trouble.
-mike

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

* Re: [PATCH 3/3] Add missing stdlib.h includes to sim
  2021-05-04 14:58 ` [PATCH 3/3] Add missing stdlib.h includes to sim Tom Tromey
@ 2021-05-04 17:44   ` Mike Frysinger
  2021-05-04 19:17     ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2021-05-04 17:44 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04 May 2021 08:58, Tom Tromey wrote:
> This updates the various "mloop.in" files to emit an include of
> stdlib.h, to avoid warnings about 'abort' being undeclared.

i was debating how to approach this.  the mloop code that gets inserted here
is in the middle of the file, so there's a couple of funcs defined before this
include is hit.  things are generally namespaced, so maybe it's not a big deal,
but still felt a bit off which is why i was sitting on it.  the alternative is
to add a new callback point just for early headers and then the script would
emit stdlib.h and such then.

but maybe i'm being too ornery and your fix is fine.  feel free to merge.
-mike

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

* Re: [PATCH 3/3] Add missing stdlib.h includes to sim
  2021-05-04 17:44   ` Mike Frysinger
@ 2021-05-04 19:17     ` Tom Tromey
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2021-05-04 19:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> On 04 May 2021 08:58, Tom Tromey wrote:
>> This updates the various "mloop.in" files to emit an include of
>> stdlib.h, to avoid warnings about 'abort' being undeclared.

Mike> i was debating how to approach this.  the mloop code that gets inserted here
Mike> is in the middle of the file, so there's a couple of funcs defined before this
Mike> include is hit.  things are generally namespaced, so maybe it's not a big deal,
Mike> but still felt a bit off which is why i was sitting on it.  the alternative is
Mike> to add a new callback point just for early headers and then the script would
Mike> emit stdlib.h and such then.

Or it could just unconditionally emit <stdlib.h>.

Mike> but maybe i'm being too ornery and your fix is fine.  feel free to merge.

I guess I'll just do it.  It can always be changed again, easy enough to
do.

Tom

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

end of thread, other threads:[~2021-05-04 19:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 14:58 [PATCH 0/3] Some minor sim fixes Tom Tromey
2021-05-04 14:58 ` [PATCH 1/3] Add config.h to generated_files for sim Tom Tromey
2021-05-04 17:38   ` Mike Frysinger
2021-05-04 14:58 ` [PATCH 2/3] Fix igen build Tom Tromey
2021-05-04 17:38   ` Mike Frysinger
2021-05-04 14:58 ` [PATCH 3/3] Add missing stdlib.h includes to sim Tom Tromey
2021-05-04 17:44   ` Mike Frysinger
2021-05-04 19:17     ` Tom Tromey

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).