public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-16 21:40 [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
  2019-03-16 21:40 ` [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline Stafford Horne
@ 2019-03-16 21:40 ` Stafford Horne
  2019-03-21 22:14   ` Andrew Burgess
  2019-03-17  5:55 ` [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
  2 siblings, 1 reply; 12+ messages in thread
From: Stafford Horne @ 2019-03-16 21:40 UTC (permalink / raw)
  To: GDB patches; +Cc: Simon Marchi, Stafford Horne

During building of several cgen simulator's I notices the below
warnings.  Adding includes fixes these.

Including config.h allows stdio.h to properly configure itself to expose
asprintf().

The other warnings for abort, free, memset, strlen are trivial.

Warnings:

../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’:
../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration]
      if (asprintf (&name, "watch-%s-%s",
          ^~~~~~~~
          vasprintf

../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’:
../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
       char *dup = hw_zalloc (me, strlen (str) + 1);
                                  ^~~~~~

../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’:
../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
   memset (&dummy, 0, sizeof dummy);
   ^~~~~~

../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’:
../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
    free (delete);
    ^~~~

../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’:
../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration]
       abort ();
       ^~~~~

sim/common/ChangeLog:

	* sim-options.c: Include "config.h".
	Include <stdio.h>.
	* sim-watch.c: Include "config.h".
	Include <stdio.h>.
	* hw-device.c: Include <string.h>.
	* hw-events.c: Include <string.h>.
	* hw-handles.c: Include <stdlib.h>.
	* sim-fpu.c: Include <stdlib.h>.
---
 sim/common/hw-device.c   | 4 ++++
 sim/common/hw-events.c   | 3 +++
 sim/common/hw-handles.c  | 3 +++
 sim/common/sim-fpu.c     | 3 +++
 sim/common/sim-options.c | 2 ++
 sim/common/sim-watch.c   | 2 ++
 6 files changed, 17 insertions(+)

diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c
index ee1bfad893..458ee22caa 100644
--- a/sim/common/hw-device.c
+++ b/sim/common/hw-device.c
@@ -27,6 +27,10 @@
 #include <stdlib.h>
 #endif
 
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
 /* Address methods */
 
 const hw_unit *
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index e6523365bd..f78be2aa46 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -23,6 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-events.h"
 
+#if HAVE_STRING_H
+#include <string.h>
+#endif
 
 /* The hw-events object is implemented using sim-events */
 
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index 2848b9bcb5..d05656235d 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -23,6 +23,9 @@
 #include "hw-main.h"
 #include "hw-base.h"
 
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 struct hw_handle_mapping
 {
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index 81cdbf5061..74f5fd488c 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -41,6 +41,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-io.h"
 #include "sim-assert.h"
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 /* Debugging support.
    If digits is -1, then print all digits.  */
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 69aebfe3d0..dc4a71203a 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -17,6 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "config.h"
 #include "sim-main.h"
 #ifdef HAVE_STRING_H
 #include <string.h>
@@ -29,6 +30,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdlib.h>
 #endif
 #include <ctype.h>
+#include <stdio.h>
 #include "libiberty.h"
 #include "sim-options.h"
 #include "sim-io.h"
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 6c357f8267..174336b377 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -17,12 +17,14 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "config.h"
 #include "sim-main.h"
 #include "sim-options.h"
 
 #include "sim-assert.h"
 
 #include <ctype.h>
+#include <stdio.h>
 
 #ifdef HAVE_STRING_H
 #include <string.h>
-- 
2.19.1

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

* [PATCH v2 0/2] Fix build failure with sim-arange inlining
@ 2019-03-16 21:40 Stafford Horne
  2019-03-16 21:40 ` [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline Stafford Horne
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Stafford Horne @ 2019-03-16 21:40 UTC (permalink / raw)
  To: GDB patches; +Cc: Simon Marchi, Stafford Horne

Hello,

When building the OpenRISC sim without CLFAGS set or -O0, I get a failure due to
some bad inlining definitions in sim-arange.  To fix this I have converted
sim-arange inlining to use the more standard sim-inline inlining framework.
This seems to work fine and makes the code a bit easier to follow in my opinion.

I have tested this on a few other targets, nios, arm, lm32 etc and it seems to
not break the build or cause issues.

During the build I also noticed several other warnings.  Which I think is good
to also fix up so I am including these in the series.

Stafford Horne (2):
  sim/common: convert sim-arange to use sim-inline
  sim/common: Fix warnings: "warning: implicit declaration of
    function..."

 sim/common/Make-common.in |  3 +--
 sim/common/hw-device.c    |  4 ++++
 sim/common/hw-events.c    |  3 +++
 sim/common/hw-handles.c   |  3 +++
 sim/common/sim-arange.c   | 21 ++++++++++-----------
 sim/common/sim-arange.h   | 30 +++++++++---------------------
 sim/common/sim-base.h     |  1 +
 sim/common/sim-basics.h   |  1 -
 sim/common/sim-fpu.c      |  3 +++
 sim/common/sim-inline.c   |  5 ++++-
 sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
 sim/common/sim-options.c  |  2 ++
 sim/common/sim-watch.c    |  2 ++
 13 files changed, 74 insertions(+), 36 deletions(-)

-- 
2.19.1

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

* [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline
  2019-03-16 21:40 [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
@ 2019-03-16 21:40 ` Stafford Horne
  2019-03-21 22:12   ` Andrew Burgess
  2019-03-16 21:40 ` [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..." Stafford Horne
  2019-03-17  5:55 ` [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
  2 siblings, 1 reply; 12+ messages in thread
From: Stafford Horne @ 2019-03-16 21:40 UTC (permalink / raw)
  To: GDB patches; +Cc: Simon Marchi, Stafford Horne

This fixes a TODO item and also fixes an error which we get when
building with no optimizations (-O0) in at least gcc 8.2.1.

Tested with sims that use cgen code lm32, or1k, cris, m32r and inlining
is working corretly.

Reference Error:

gcc -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"or1200"' -DWITH_ALIGNMENT=STRICT_ALIGNMENT \
 -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_ADDRESS_BITSIZE=32 \
 -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG   -DDEFAULT_INLINE=0  -DWITH_SCACHE=16384 \
 -I. -I../../../binutils-gdb/sim/or1k -I../common -I../../../binutils-gdb/sim/or1k/../common \
 -I../../include -I../../../binutils-gdb/sim/or1k/../../include -I../../bfd \
 -I../../../binutils-gdb/sim/or1k/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/or1k/../../opcodes \
 -g -o run nrun.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a \
 -ldl  -lz -lm

/usr/bin/ld: libsim.a(mloop.o): in function `extract':
/home/shorne/work/openrisc/gdb-musl/sim/or1k/mloop.c:82: undefined reference to `sim_addr_range_hit_p'
/usr/bin/ld: /home/shorne/work/openrisc/gdb-musl/sim/or1k/mloop.c:83: undefined reference to `sim_addr_range_hit_p'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:305: run] Error 1

sim/common/ChangeLog:

	* Make-common.in (sim-arange_h): Remove sim-arange.c
	* sim-arange.c: Remove SIM_ARANGE_C.
	Add ifdef for _SIM_ARANGE_C_.
	Include "sim-arange.h".
	Remove include for unused "sim-assert.h".
	Remove DEFINE_INLINE_P.  Remove DEFINE_NON_INLINE_P.
	(sim_addr_range_add): Declare as INLINE_SIM_ARANGE.
	(sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
	(sim_addr_range_hit_p): Change from SIM_ARANGE_INLINE to
	INLINE_SIM_ARANGE.
	* sim-arange.h (sim_addr_range_add): Declare as
	INLINE_SIM_ARANGE.
	(sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
	(sim_addr_range_hit_p) Declare as INLINE_SIM_ARANGE.
	Remove definition of SIM_ARANGE_INLINE.
	Remove [HAVE_INLINE].
	Wrap include "sim-arange.c" in H_REVEALS_MODULE_P.
	* sim-base.h: Include "sim-arange.h"
	* sim-basics.h: Remove include of "sim-arange.h"
	* sim-inline.c: Include "sim-arange.c"
	* sim-inline.h: Define INLINE_SIM_ARANGE.
	Define SIM_ARANGE_INLINE.  Define EXTERN_SIM_ARANGE_P.
	Define STATIC_INLINE_SIM_ARANGE.  Define STATIC_SIM_ARANGE.
---
 sim/common/Make-common.in |  3 +--
 sim/common/sim-arange.c   | 21 ++++++++++-----------
 sim/common/sim-arange.h   | 30 +++++++++---------------------
 sim/common/sim-base.h     |  1 +
 sim/common/sim-basics.h   |  1 -
 sim/common/sim-inline.c   |  5 ++++-
 sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
 7 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 1a3bcc9417..5d8ac910af 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -319,8 +319,7 @@ SIM_MAIN_DEPS = \
 	$(sim_main_headers)
 
 sim-alu_h = $(srccom)/sim-alu.h
-sim-arange_h = $(srccom)/sim-arange.h \
-		$(srccom)/sim-arange.c
+sim-arange_h = $(srccom)/sim-arange.h
 sim-assert_h = $(srccom)/sim-assert.h
 sim-base_h = $(srccom)/sim-base.h \
 		$(sim-module_h) \
diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c
index b3488ab564..c75245b94b 100644
--- a/sim/common/sim-arange.c
+++ b/sim/common/sim-arange.c
@@ -17,12 +17,12 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Tell sim-arange.h it's us.  */
-#define SIM_ARANGE_C
+#ifndef _SIM_ARANGE_C_
+#define _SIM_ARANGE_C_
 
 #include "libiberty.h"
 #include "sim-basics.h"
-#include "sim-assert.h"
+#include "sim-arange.h"
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
@@ -32,8 +32,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 #endif
 
-#ifdef SIM_ARANGE_C_INCLUDED
-
 /* Insert a range.  */
 
 static void
@@ -251,7 +249,8 @@ build_search_tree (ADDR_RANGE *ar)
   free (asrtab);
 }
 
-void
+INLINE_SIM_ARANGE\
+(void)
 sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
 {
   frob_range (ar, start, end, 0);
@@ -264,7 +263,8 @@ sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
   build_search_tree (ar);
 }
 
-void
+INLINE_SIM_ARANGE\
+(void)
 sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
 {
   frob_range (ar, start, end, 1);
@@ -277,9 +277,8 @@ sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
   build_search_tree (ar);
 }
 
-#else /* SIM_ARANGE_C_INCLUDED */
-
-SIM_ARANGE_INLINE int
+INLINE_SIM_ARANGE\
+(int)
 sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
 {
   ADDR_RANGE_TREE *t = ar->range_tree;
@@ -296,4 +295,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
   return 0;
 }
 
-#endif /* SIM_ARANGE_C_INCLUDED */
+#endif /* _SIM_ARANGE_C_ */
diff --git a/sim/common/sim-arange.h b/sim/common/sim-arange.h
index f2ac595390..529d1650c2 100644
--- a/sim/common/sim-arange.h
+++ b/sim/common/sim-arange.h
@@ -51,36 +51,24 @@ typedef struct _addr_range {
 } ADDR_RANGE;
 
 /* Add address range START,END to AR.  */
-extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
-				address_word /*start*/,
-				address_word /*end*/);
+INLINE_SIM_ARANGE (void) sim_addr_range_add (ADDR_RANGE * /*ar*/,
+					     address_word /*start*/,
+					     address_word /*end*/);
 
 /* Delete address range START,END from AR.  */
-extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
-				   address_word /*start*/,
-				   address_word /*end*/);
-
-/* TODO: This should get moved into sim-inline.h.  */
-#ifdef HAVE_INLINE
-#ifdef SIM_ARANGE_C
-#define SIM_ARANGE_INLINE INLINE
-#else
-#define SIM_ARANGE_INLINE EXTERN_INLINE
-#endif
-#else
-#define SIM_ARANGE_INLINE extern
-#endif
+INLINE_SIM_ARANGE (void) sim_addr_range_delete (ADDR_RANGE * /*ar*/,
+						address_word /*start*/,
+						address_word /*end*/);
 
 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
    If no range is specified, that is defined to mean "everything".  */
-SIM_ARANGE_INLINE int
-sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
+INLINE_SIM_ARANGE (int) sim_addr_range_hit_p (ADDR_RANGE * /*ar*/,
+					      address_word /*addr*/);
 #define ADDR_RANGE_HIT_P(ar, addr) \
   ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
 
-#ifdef HAVE_INLINE
+#if H_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
 #include "sim-arange.c"
 #endif
-#define SIM_ARANGE_C_INCLUDED
 
 #endif /* SIM_ARANGE_H */
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 3123c07e2b..d07ff2168c 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -82,6 +82,7 @@ typedef struct _sim_cpu sim_cpu;
 
 #include "sim-module.h"
 
+#include "sim-arange.h"
 #include "sim-trace.h"
 #include "sim-core.h"
 #include "sim-events.h"
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index c796b057ce..5aa76db424 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -144,7 +144,6 @@ typedef enum {
 #include "sim-bits.h"
 #include "sim-endian.h"
 #include "sim-signal.h"
-#include "sim-arange.h"
 
 #include "sim-utils.h"
 
diff --git a/sim/common/sim-inline.c b/sim/common/sim-inline.c
index 9021e2a4a9..3a2af7917a 100644
--- a/sim/common/sim-inline.c
+++ b/sim/common/sim-inline.c
@@ -29,6 +29,10 @@
 #include "sim-inline.h"
 #include "sim-main.h"
 
+#if C_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
+#include "sim-arange.c"
+#endif
+
 
 #if C_REVEALS_MODULE_P (SIM_BITS_INLINE)
 #include "sim-bits.c"
@@ -64,7 +68,6 @@
 #include "sim-main.c"
 #endif
 
-
 #if C_REVEALS_MODULE_P (ENGINE_INLINE)
 /* #include "engine.c" - handled by generator */
 #endif
diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
index 11c58b9622..87dfbb5dc4 100644
--- a/sim/common/sim-inline.h
+++ b/sim/common/sim-inline.h
@@ -348,6 +348,38 @@
 
 
 \f
+
+/* sim_arange */
+
+#if !defined (SIM_ARANGE_INLINE) && (DEFAULT_INLINE)
+# define SIM_ARANGE_INLINE (ALL_H_INLINE)
+#endif
+
+#if ((H_REVEALS_MODULE_P (SIM_ARANGE_INLINE) || defined (SIM_INLINE_C)) \
+     && !defined (SIM_ARANGE_C) \
+     && (REVEAL_MODULE_P (SIM_ARANGE_INLINE)))
+# if (SIM_ARANGE_INLINE & INLINE_GLOBALS)
+#  define INLINE_SIM_ARANGE(TYPE) static INLINE TYPE UNUSED
+#  define EXTERN_SIM_ARANGE_P 0
+# else
+#  define INLINE_SIM_ARANGE(TYPE) static TYPE UNUSED
+#  define EXTERN_SIM_ARANGE_P 0
+# endif
+#else
+# define INLINE_SIM_ARANGE(TYPE) TYPE
+# define EXTERN_SIM_ARANGE_P 1
+#endif
+
+#if (SIM_ARANGE_INLINE & INLINE_LOCALS)
+# define STATIC_INLINE_SIM_ARANGE(TYPE) static INLINE TYPE
+#else
+# define STATIC_INLINE_SIM_ARANGE(TYPE) static TYPE
+#endif
+
+#define STATIC_SIM_ARANGE(TYPE) static TYPE
+
+
+
 /* *****
    sim-bits and sim-endian are treated differently from the rest
    of the modules below.  Their default value is ALL_H_INLINE.
-- 
2.19.1

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

* Re: [PATCH v2 0/2] Fix build failure with sim-arange inlining
  2019-03-16 21:40 [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
  2019-03-16 21:40 ` [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline Stafford Horne
  2019-03-16 21:40 ` [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..." Stafford Horne
@ 2019-03-17  5:55 ` Stafford Horne
  2019-03-21 22:17   ` Andrew Burgess
  2 siblings, 1 reply; 12+ messages in thread
From: Stafford Horne @ 2019-03-17  5:55 UTC (permalink / raw)
  To: GDB patches; +Cc: Simon Marchi, Andrew Burgess

Hello,

On the below I forgot to mention what has changed.  This is mainly a resend, the
only change is that I have rebased on the latest master, one of the patches from
series one was not longer needed as it fixed by someone else.

Also, ccing Andrew, congrats on being sim maintainer.  Are you also going to be
the main contact for cgen?

-Stafford


On Sun, Mar 17, 2019 at 06:40:16AM +0900, Stafford Horne wrote:
> Hello,
> 
> When building the OpenRISC sim without CLFAGS set or -O0, I get a failure due to
> some bad inlining definitions in sim-arange.  To fix this I have converted
> sim-arange inlining to use the more standard sim-inline inlining framework.
> This seems to work fine and makes the code a bit easier to follow in my opinion.
> 
> I have tested this on a few other targets, nios, arm, lm32 etc and it seems to
> not break the build or cause issues.
> 
> During the build I also noticed several other warnings.  Which I think is good
> to also fix up so I am including these in the series.
> 
> Stafford Horne (2):
>   sim/common: convert sim-arange to use sim-inline
>   sim/common: Fix warnings: "warning: implicit declaration of
>     function..."
> 
>  sim/common/Make-common.in |  3 +--
>  sim/common/hw-device.c    |  4 ++++
>  sim/common/hw-events.c    |  3 +++
>  sim/common/hw-handles.c   |  3 +++
>  sim/common/sim-arange.c   | 21 ++++++++++-----------
>  sim/common/sim-arange.h   | 30 +++++++++---------------------
>  sim/common/sim-base.h     |  1 +
>  sim/common/sim-basics.h   |  1 -
>  sim/common/sim-fpu.c      |  3 +++
>  sim/common/sim-inline.c   |  5 ++++-
>  sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
>  sim/common/sim-options.c  |  2 ++
>  sim/common/sim-watch.c    |  2 ++
>  13 files changed, 74 insertions(+), 36 deletions(-)
> 
> -- 
> 2.19.1
> 

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

* Re: [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline
  2019-03-16 21:40 ` [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline Stafford Horne
@ 2019-03-21 22:12   ` Andrew Burgess
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Burgess @ 2019-03-21 22:12 UTC (permalink / raw)
  To: Stafford Horne; +Cc: GDB patches, Simon Marchi

* Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:17 +0900]:

> This fixes a TODO item and also fixes an error which we get when
> building with no optimizations (-O0) in at least gcc 8.2.1.
> 
> Tested with sims that use cgen code lm32, or1k, cris, m32r and inlining
> is working corretly.
> 
> Reference Error:
> 
> gcc -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"or1200"' -DWITH_ALIGNMENT=STRICT_ALIGNMENT \
>  -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_ADDRESS_BITSIZE=32 \
>  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG   -DDEFAULT_INLINE=0  -DWITH_SCACHE=16384 \
>  -I. -I../../../binutils-gdb/sim/or1k -I../common -I../../../binutils-gdb/sim/or1k/../common \
>  -I../../include -I../../../binutils-gdb/sim/or1k/../../include -I../../bfd \
>  -I../../../binutils-gdb/sim/or1k/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/or1k/../../opcodes \
>  -g -o run nrun.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a \
>  -ldl  -lz -lm
> 
> /usr/bin/ld: libsim.a(mloop.o): in function `extract':
> /home/shorne/work/openrisc/gdb-musl/sim/or1k/mloop.c:82: undefined reference to `sim_addr_range_hit_p'
> /usr/bin/ld: /home/shorne/work/openrisc/gdb-musl/sim/or1k/mloop.c:83: undefined reference to `sim_addr_range_hit_p'
> collect2: error: ld returned 1 exit status
> make[3]: *** [Makefile:305: run] Error 1
> 
> sim/common/ChangeLog:
> 
> 	* Make-common.in (sim-arange_h): Remove sim-arange.c
> 	* sim-arange.c: Remove SIM_ARANGE_C.
> 	Add ifdef for _SIM_ARANGE_C_.
> 	Include "sim-arange.h".
> 	Remove include for unused "sim-assert.h".
> 	Remove DEFINE_INLINE_P.  Remove DEFINE_NON_INLINE_P.
> 	(sim_addr_range_add): Declare as INLINE_SIM_ARANGE.
> 	(sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
> 	(sim_addr_range_hit_p): Change from SIM_ARANGE_INLINE to
> 	INLINE_SIM_ARANGE.
> 	* sim-arange.h (sim_addr_range_add): Declare as
> 	INLINE_SIM_ARANGE.
> 	(sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
> 	(sim_addr_range_hit_p) Declare as INLINE_SIM_ARANGE.
> 	Remove definition of SIM_ARANGE_INLINE.
> 	Remove [HAVE_INLINE].
> 	Wrap include "sim-arange.c" in H_REVEALS_MODULE_P.
> 	* sim-base.h: Include "sim-arange.h"
> 	* sim-basics.h: Remove include of "sim-arange.h"
> 	* sim-inline.c: Include "sim-arange.c"
> 	* sim-inline.h: Define INLINE_SIM_ARANGE.
> 	Define SIM_ARANGE_INLINE.  Define EXTERN_SIM_ARANGE_P.
> 	Define STATIC_INLINE_SIM_ARANGE.  Define STATIC_SIM_ARANGE.

This looks good thanks.

Andrew


> ---
>  sim/common/Make-common.in |  3 +--
>  sim/common/sim-arange.c   | 21 ++++++++++-----------
>  sim/common/sim-arange.h   | 30 +++++++++---------------------
>  sim/common/sim-base.h     |  1 +
>  sim/common/sim-basics.h   |  1 -
>  sim/common/sim-inline.c   |  5 ++++-
>  sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
>  7 files changed, 57 insertions(+), 36 deletions(-)
> 
> diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
> index 1a3bcc9417..5d8ac910af 100644
> --- a/sim/common/Make-common.in
> +++ b/sim/common/Make-common.in
> @@ -319,8 +319,7 @@ SIM_MAIN_DEPS = \
>  	$(sim_main_headers)
>  
>  sim-alu_h = $(srccom)/sim-alu.h
> -sim-arange_h = $(srccom)/sim-arange.h \
> -		$(srccom)/sim-arange.c
> +sim-arange_h = $(srccom)/sim-arange.h
>  sim-assert_h = $(srccom)/sim-assert.h
>  sim-base_h = $(srccom)/sim-base.h \
>  		$(sim-module_h) \
> diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c
> index b3488ab564..c75245b94b 100644
> --- a/sim/common/sim-arange.c
> +++ b/sim/common/sim-arange.c
> @@ -17,12 +17,12 @@ GNU General Public License for more details.
>  You should have received a copy of the GNU General Public License
>  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> -/* Tell sim-arange.h it's us.  */
> -#define SIM_ARANGE_C
> +#ifndef _SIM_ARANGE_C_
> +#define _SIM_ARANGE_C_
>  
>  #include "libiberty.h"
>  #include "sim-basics.h"
> -#include "sim-assert.h"
> +#include "sim-arange.h"
>  
>  #ifdef HAVE_STDLIB_H
>  #include <stdlib.h>
> @@ -32,8 +32,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  #include <string.h>
>  #endif
>  
> -#ifdef SIM_ARANGE_C_INCLUDED
> -
>  /* Insert a range.  */
>  
>  static void
> @@ -251,7 +249,8 @@ build_search_tree (ADDR_RANGE *ar)
>    free (asrtab);
>  }
>  
> -void
> +INLINE_SIM_ARANGE\
> +(void)
>  sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
>  {
>    frob_range (ar, start, end, 0);
> @@ -264,7 +263,8 @@ sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
>    build_search_tree (ar);
>  }
>  
> -void
> +INLINE_SIM_ARANGE\
> +(void)
>  sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
>  {
>    frob_range (ar, start, end, 1);
> @@ -277,9 +277,8 @@ sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
>    build_search_tree (ar);
>  }
>  
> -#else /* SIM_ARANGE_C_INCLUDED */
> -
> -SIM_ARANGE_INLINE int
> +INLINE_SIM_ARANGE\
> +(int)
>  sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
>  {
>    ADDR_RANGE_TREE *t = ar->range_tree;
> @@ -296,4 +295,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
>    return 0;
>  }
>  
> -#endif /* SIM_ARANGE_C_INCLUDED */
> +#endif /* _SIM_ARANGE_C_ */
> diff --git a/sim/common/sim-arange.h b/sim/common/sim-arange.h
> index f2ac595390..529d1650c2 100644
> --- a/sim/common/sim-arange.h
> +++ b/sim/common/sim-arange.h
> @@ -51,36 +51,24 @@ typedef struct _addr_range {
>  } ADDR_RANGE;
>  
>  /* Add address range START,END to AR.  */
> -extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
> -				address_word /*start*/,
> -				address_word /*end*/);
> +INLINE_SIM_ARANGE (void) sim_addr_range_add (ADDR_RANGE * /*ar*/,
> +					     address_word /*start*/,
> +					     address_word /*end*/);
>  
>  /* Delete address range START,END from AR.  */
> -extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
> -				   address_word /*start*/,
> -				   address_word /*end*/);
> -
> -/* TODO: This should get moved into sim-inline.h.  */
> -#ifdef HAVE_INLINE
> -#ifdef SIM_ARANGE_C
> -#define SIM_ARANGE_INLINE INLINE
> -#else
> -#define SIM_ARANGE_INLINE EXTERN_INLINE
> -#endif
> -#else
> -#define SIM_ARANGE_INLINE extern
> -#endif
> +INLINE_SIM_ARANGE (void) sim_addr_range_delete (ADDR_RANGE * /*ar*/,
> +						address_word /*start*/,
> +						address_word /*end*/);
>  
>  /* Return non-zero if ADDR is in range AR, traversing the entire tree.
>     If no range is specified, that is defined to mean "everything".  */
> -SIM_ARANGE_INLINE int
> -sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
> +INLINE_SIM_ARANGE (int) sim_addr_range_hit_p (ADDR_RANGE * /*ar*/,
> +					      address_word /*addr*/);
>  #define ADDR_RANGE_HIT_P(ar, addr) \
>    ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
>  
> -#ifdef HAVE_INLINE
> +#if H_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
>  #include "sim-arange.c"
>  #endif
> -#define SIM_ARANGE_C_INCLUDED
>  
>  #endif /* SIM_ARANGE_H */
> diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
> index 3123c07e2b..d07ff2168c 100644
> --- a/sim/common/sim-base.h
> +++ b/sim/common/sim-base.h
> @@ -82,6 +82,7 @@ typedef struct _sim_cpu sim_cpu;
>  
>  #include "sim-module.h"
>  
> +#include "sim-arange.h"
>  #include "sim-trace.h"
>  #include "sim-core.h"
>  #include "sim-events.h"
> diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
> index c796b057ce..5aa76db424 100644
> --- a/sim/common/sim-basics.h
> +++ b/sim/common/sim-basics.h
> @@ -144,7 +144,6 @@ typedef enum {
>  #include "sim-bits.h"
>  #include "sim-endian.h"
>  #include "sim-signal.h"
> -#include "sim-arange.h"
>  
>  #include "sim-utils.h"
>  
> diff --git a/sim/common/sim-inline.c b/sim/common/sim-inline.c
> index 9021e2a4a9..3a2af7917a 100644
> --- a/sim/common/sim-inline.c
> +++ b/sim/common/sim-inline.c
> @@ -29,6 +29,10 @@
>  #include "sim-inline.h"
>  #include "sim-main.h"
>  
> +#if C_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
> +#include "sim-arange.c"
> +#endif
> +
>  
>  #if C_REVEALS_MODULE_P (SIM_BITS_INLINE)
>  #include "sim-bits.c"
> @@ -64,7 +68,6 @@
>  #include "sim-main.c"
>  #endif
>  
> -
>  #if C_REVEALS_MODULE_P (ENGINE_INLINE)
>  /* #include "engine.c" - handled by generator */
>  #endif
> diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
> index 11c58b9622..87dfbb5dc4 100644
> --- a/sim/common/sim-inline.h
> +++ b/sim/common/sim-inline.h
> @@ -348,6 +348,38 @@
>  
>  
>  \f
> +
> +/* sim_arange */
> +
> +#if !defined (SIM_ARANGE_INLINE) && (DEFAULT_INLINE)
> +# define SIM_ARANGE_INLINE (ALL_H_INLINE)
> +#endif
> +
> +#if ((H_REVEALS_MODULE_P (SIM_ARANGE_INLINE) || defined (SIM_INLINE_C)) \
> +     && !defined (SIM_ARANGE_C) \
> +     && (REVEAL_MODULE_P (SIM_ARANGE_INLINE)))
> +# if (SIM_ARANGE_INLINE & INLINE_GLOBALS)
> +#  define INLINE_SIM_ARANGE(TYPE) static INLINE TYPE UNUSED
> +#  define EXTERN_SIM_ARANGE_P 0
> +# else
> +#  define INLINE_SIM_ARANGE(TYPE) static TYPE UNUSED
> +#  define EXTERN_SIM_ARANGE_P 0
> +# endif
> +#else
> +# define INLINE_SIM_ARANGE(TYPE) TYPE
> +# define EXTERN_SIM_ARANGE_P 1
> +#endif
> +
> +#if (SIM_ARANGE_INLINE & INLINE_LOCALS)
> +# define STATIC_INLINE_SIM_ARANGE(TYPE) static INLINE TYPE
> +#else
> +# define STATIC_INLINE_SIM_ARANGE(TYPE) static TYPE
> +#endif
> +
> +#define STATIC_SIM_ARANGE(TYPE) static TYPE
> +
> +
> +
>  /* *****
>     sim-bits and sim-endian are treated differently from the rest
>     of the modules below.  Their default value is ALL_H_INLINE.
> -- 
> 2.19.1
> 

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

* Re: [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-16 21:40 ` [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..." Stafford Horne
@ 2019-03-21 22:14   ` Andrew Burgess
  2019-03-28 11:57     ` Alan Hayward
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Burgess @ 2019-03-21 22:14 UTC (permalink / raw)
  To: Stafford Horne; +Cc: GDB patches, Simon Marchi

* Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:18 +0900]:

> During building of several cgen simulator's I notices the below
> warnings.  Adding includes fixes these.
> 
> Including config.h allows stdio.h to properly configure itself to expose
> asprintf().
> 
> The other warnings for abort, free, memset, strlen are trivial.
> 
> Warnings:
> 
> ../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’:
> ../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration]
>       if (asprintf (&name, "watch-%s-%s",
>           ^~~~~~~~
>           vasprintf
> 
> ../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’:
> ../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
>        char *dup = hw_zalloc (me, strlen (str) + 1);
>                                   ^~~~~~
> 
> ../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’:
> ../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
>    memset (&dummy, 0, sizeof dummy);
>    ^~~~~~
> 
> ../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’:
> ../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
>     free (delete);
>     ^~~~
> 
> ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’:
> ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration]
>        abort ();
>        ^~~~~
> 
> sim/common/ChangeLog:
> 
> 	* sim-options.c: Include "config.h".
> 	Include <stdio.h>.
> 	* sim-watch.c: Include "config.h".
> 	Include <stdio.h>.
> 	* hw-device.c: Include <string.h>.
> 	* hw-events.c: Include <string.h>.
> 	* hw-handles.c: Include <stdlib.h>.
> 	* sim-fpu.c: Include <stdlib.h>.

This all looks good.

Thanks,
Andrew


> ---
>  sim/common/hw-device.c   | 4 ++++
>  sim/common/hw-events.c   | 3 +++
>  sim/common/hw-handles.c  | 3 +++
>  sim/common/sim-fpu.c     | 3 +++
>  sim/common/sim-options.c | 2 ++
>  sim/common/sim-watch.c   | 2 ++
>  6 files changed, 17 insertions(+)
> 
> diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c
> index ee1bfad893..458ee22caa 100644
> --- a/sim/common/hw-device.c
> +++ b/sim/common/hw-device.c
> @@ -27,6 +27,10 @@
>  #include <stdlib.h>
>  #endif
>  
> +#if HAVE_STRING_H
> +#include <string.h>
> +#endif
> +
>  /* Address methods */
>  
>  const hw_unit *
> diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
> index e6523365bd..f78be2aa46 100644
> --- a/sim/common/hw-events.c
> +++ b/sim/common/hw-events.c
> @@ -23,6 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "sim-events.h"
>  
> +#if HAVE_STRING_H
> +#include <string.h>
> +#endif
>  
>  /* The hw-events object is implemented using sim-events */
>  
> diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
> index 2848b9bcb5..d05656235d 100644
> --- a/sim/common/hw-handles.c
> +++ b/sim/common/hw-handles.c
> @@ -23,6 +23,9 @@
>  #include "hw-main.h"
>  #include "hw-base.h"
>  
> +#if HAVE_STDLIB_H
> +#include <stdlib.h>
> +#endif
>  
>  struct hw_handle_mapping
>  {
> diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
> index 81cdbf5061..74f5fd488c 100644
> --- a/sim/common/sim-fpu.c
> +++ b/sim/common/sim-fpu.c
> @@ -41,6 +41,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  #include "sim-io.h"
>  #include "sim-assert.h"
>  
> +#ifdef HAVE_STDLIB_H
> +#include <stdlib.h>
> +#endif
>  
>  /* Debugging support.
>     If digits is -1, then print all digits.  */
> diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
> index 69aebfe3d0..dc4a71203a 100644
> --- a/sim/common/sim-options.c
> +++ b/sim/common/sim-options.c
> @@ -17,6 +17,7 @@ GNU General Public License for more details.
>  You should have received a copy of the GNU General Public License
>  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> +#include "config.h"
>  #include "sim-main.h"
>  #ifdef HAVE_STRING_H
>  #include <string.h>
> @@ -29,6 +30,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  #include <stdlib.h>
>  #endif
>  #include <ctype.h>
> +#include <stdio.h>
>  #include "libiberty.h"
>  #include "sim-options.h"
>  #include "sim-io.h"
> diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
> index 6c357f8267..174336b377 100644
> --- a/sim/common/sim-watch.c
> +++ b/sim/common/sim-watch.c
> @@ -17,12 +17,14 @@ GNU General Public License for more details.
>  You should have received a copy of the GNU General Public License
>  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> +#include "config.h"
>  #include "sim-main.h"
>  #include "sim-options.h"
>  
>  #include "sim-assert.h"
>  
>  #include <ctype.h>
> +#include <stdio.h>
>  
>  #ifdef HAVE_STRING_H
>  #include <string.h>
> -- 
> 2.19.1
> 

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

* Re: [PATCH v2 0/2] Fix build failure with sim-arange inlining
  2019-03-17  5:55 ` [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
@ 2019-03-21 22:17   ` Andrew Burgess
  2019-03-26 21:34     ` Stafford Horne
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Burgess @ 2019-03-21 22:17 UTC (permalink / raw)
  To: Stafford Horne; +Cc: GDB patches, Simon Marchi

* Stafford Horne <shorne@gmail.com> [2019-03-17 14:55:34 +0900]:

> Hello,
> 
> On the below I forgot to mention what has changed.  This is mainly a resend, the
> only change is that I have rebased on the latest master, one of the patches from
> series one was not longer needed as it fixed by someone else.
> 
> Also, ccing Andrew, congrats on being sim maintainer.  Are you also going to be
> the main contact for cgen?

Thanks.

Changes to cgen itself should go to the cgen list
(cgen@sourceware.org), changes to the cpu files in binutils-gdb are I
think reviewed through the binutils list.  Then changes to the sim
making use of the generated sim components are reviewed through the
gdb list.

Thanks,
Andrew



> 
> -Stafford
> 
> 
> On Sun, Mar 17, 2019 at 06:40:16AM +0900, Stafford Horne wrote:
> > Hello,
> > 
> > When building the OpenRISC sim without CLFAGS set or -O0, I get a failure due to
> > some bad inlining definitions in sim-arange.  To fix this I have converted
> > sim-arange inlining to use the more standard sim-inline inlining framework.
> > This seems to work fine and makes the code a bit easier to follow in my opinion.
> > 
> > I have tested this on a few other targets, nios, arm, lm32 etc and it seems to
> > not break the build or cause issues.
> > 
> > During the build I also noticed several other warnings.  Which I think is good
> > to also fix up so I am including these in the series.
> > 
> > Stafford Horne (2):
> >   sim/common: convert sim-arange to use sim-inline
> >   sim/common: Fix warnings: "warning: implicit declaration of
> >     function..."
> > 
> >  sim/common/Make-common.in |  3 +--
> >  sim/common/hw-device.c    |  4 ++++
> >  sim/common/hw-events.c    |  3 +++
> >  sim/common/hw-handles.c   |  3 +++
> >  sim/common/sim-arange.c   | 21 ++++++++++-----------
> >  sim/common/sim-arange.h   | 30 +++++++++---------------------
> >  sim/common/sim-base.h     |  1 +
> >  sim/common/sim-basics.h   |  1 -
> >  sim/common/sim-fpu.c      |  3 +++
> >  sim/common/sim-inline.c   |  5 ++++-
> >  sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
> >  sim/common/sim-options.c  |  2 ++
> >  sim/common/sim-watch.c    |  2 ++
> >  13 files changed, 74 insertions(+), 36 deletions(-)
> > 
> > -- 
> > 2.19.1
> > 

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

* Re: [PATCH v2 0/2] Fix build failure with sim-arange inlining
  2019-03-21 22:17   ` Andrew Burgess
@ 2019-03-26 21:34     ` Stafford Horne
  0 siblings, 0 replies; 12+ messages in thread
From: Stafford Horne @ 2019-03-26 21:34 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: GDB patches, Simon Marchi

On Thu, Mar 21, 2019 at 10:17:46PM +0000, Andrew Burgess wrote:
> * Stafford Horne <shorne@gmail.com> [2019-03-17 14:55:34 +0900]:
> 
> > Hello,
> > 
> > On the below I forgot to mention what has changed.  This is mainly a resend, the
> > only change is that I have rebased on the latest master, one of the patches from
> > series one was not longer needed as it fixed by someone else.
> > 
> > Also, ccing Andrew, congrats on being sim maintainer.  Are you also going to be
> > the main contact for cgen?
> 
> Thanks.
> 
> Changes to cgen itself should go to the cgen list
> (cgen@sourceware.org), changes to the cpu files in binutils-gdb are I
> think reviewed through the binutils list.  Then changes to the sim
> making use of the generated sim components are reviewed through the
> gdb list.

Thanks for the review and details, it makes sense.

Sorry, I haven't committed these patches yet. I haven't got the time to sit down
and do it.  Hopefully this weekend.

> Thanks,
> Andrew
> 
> 
> 
> > 
> > -Stafford
> > 
> > 
> > On Sun, Mar 17, 2019 at 06:40:16AM +0900, Stafford Horne wrote:
> > > Hello,
> > > 
> > > When building the OpenRISC sim without CLFAGS set or -O0, I get a failure due to
> > > some bad inlining definitions in sim-arange.  To fix this I have converted
> > > sim-arange inlining to use the more standard sim-inline inlining framework.
> > > This seems to work fine and makes the code a bit easier to follow in my opinion.
> > > 
> > > I have tested this on a few other targets, nios, arm, lm32 etc and it seems to
> > > not break the build or cause issues.
> > > 
> > > During the build I also noticed several other warnings.  Which I think is good
> > > to also fix up so I am including these in the series.
> > > 
> > > Stafford Horne (2):
> > >   sim/common: convert sim-arange to use sim-inline
> > >   sim/common: Fix warnings: "warning: implicit declaration of
> > >     function..."
> > > 
> > >  sim/common/Make-common.in |  3 +--
> > >  sim/common/hw-device.c    |  4 ++++
> > >  sim/common/hw-events.c    |  3 +++
> > >  sim/common/hw-handles.c   |  3 +++
> > >  sim/common/sim-arange.c   | 21 ++++++++++-----------
> > >  sim/common/sim-arange.h   | 30 +++++++++---------------------
> > >  sim/common/sim-base.h     |  1 +
> > >  sim/common/sim-basics.h   |  1 -
> > >  sim/common/sim-fpu.c      |  3 +++
> > >  sim/common/sim-inline.c   |  5 ++++-
> > >  sim/common/sim-inline.h   | 32 ++++++++++++++++++++++++++++++++
> > >  sim/common/sim-options.c  |  2 ++
> > >  sim/common/sim-watch.c    |  2 ++
> > >  13 files changed, 74 insertions(+), 36 deletions(-)
> > > 
> > > -- 
> > > 2.19.1
> > > 

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

* Re: [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-21 22:14   ` Andrew Burgess
@ 2019-03-28 11:57     ` Alan Hayward
  2019-03-28 13:49       ` Andrew Burgess
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Hayward @ 2019-03-28 11:57 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Stafford Horne, GDB patches, Simon Marchi, nd



> On 21 Mar 2019, at 22:14, Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> 
> * Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:18 +0900]:
> 
>> During building of several cgen simulator's I notices the below
>> warnings.  Adding includes fixes these.
>> 
>> Including config.h allows stdio.h to properly configure itself to expose
>> asprintf().

Stafford, it looks like this breaks AArch64 on both Ubuntu 16.04 and 18.04: 


libsim.a(interp.o): In function `sim_open':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/interp.c:328: undefined reference to `SIM_ASSERT'
libsim.a(cpustate.o): In function `aarch64_get_vec_u64':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:438: undefined reference to `ARRAY_SIZE'
libsim.a(cpustate.o): In function `aarch64_get_vec_u32':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:444: undefined reference to `ARRAY_SIZE'
libsim.a(cpustate.o): In function `aarch64_get_vec_u16':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:450: undefined reference to `ARRAY_SIZE'
libsim.a(cpustate.o): In function `aarch64_get_vec_u8':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:456: undefined reference to `ARRAY_SIZE'
libsim.a(cpustate.o): In function `aarch64_get_vec_s64':
/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/Makefile:271: recipe for target 'run' failed
make[3]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64'
Makefile:129: recipe for target 'all' failed
make[2]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim'
Makefile:8878: recipe for target 'all-sim' failed
binutils-gdb/sim/aarch64/cpustate.c:462: undefined reference to `ARRAY_SIZE'
libsim.a(cpustate.o):/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:468: more undefined references to `ARRAY_SIZE' follow
collect2: error: ld returned 1 exit status


I suspect the AArch64 buildbot will be failing once it catches up
https://gdb-build.sergiodj.net/waterfall?tag=aarch64


Alan.


>> 
>> The other warnings for abort, free, memset, strlen are trivial.
>> 
>> Warnings:
>> 
>> ../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’:
>> ../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration]
>>      if (asprintf (&name, "watch-%s-%s",
>>          ^~~~~~~~
>>          vasprintf
>> 
>> ../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’:
>> ../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
>>       char *dup = hw_zalloc (me, strlen (str) + 1);
>>                                  ^~~~~~
>> 
>> ../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’:
>> ../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
>>   memset (&dummy, 0, sizeof dummy);
>>   ^~~~~~
>> 
>> ../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’:
>> ../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
>>    free (delete);
>>    ^~~~
>> 
>> ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’:
>> ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration]
>>       abort ();
>>       ^~~~~
>> 
>> sim/common/ChangeLog:
>> 
>> 	* sim-options.c: Include "config.h".
>> 	Include <stdio.h>.
>> 	* sim-watch.c: Include "config.h".
>> 	Include <stdio.h>.
>> 	* hw-device.c: Include <string.h>.
>> 	* hw-events.c: Include <string.h>.
>> 	* hw-handles.c: Include <stdlib.h>.
>> 	* sim-fpu.c: Include <stdlib.h>.
> 
> This all looks good.
> 
> Thanks,
> Andrew
> 
> 
>> ---
>> sim/common/hw-device.c   | 4 ++++
>> sim/common/hw-events.c   | 3 +++
>> sim/common/hw-handles.c  | 3 +++
>> sim/common/sim-fpu.c     | 3 +++
>> sim/common/sim-options.c | 2 ++
>> sim/common/sim-watch.c   | 2 ++
>> 6 files changed, 17 insertions(+)
>> 
>> diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c
>> index ee1bfad893..458ee22caa 100644
>> --- a/sim/common/hw-device.c
>> +++ b/sim/common/hw-device.c
>> @@ -27,6 +27,10 @@
>> #include <stdlib.h>
>> #endif
>> 
>> +#if HAVE_STRING_H
>> +#include <string.h>
>> +#endif
>> +
>> /* Address methods */
>> 
>> const hw_unit *
>> diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
>> index e6523365bd..f78be2aa46 100644
>> --- a/sim/common/hw-events.c
>> +++ b/sim/common/hw-events.c
>> @@ -23,6 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> 
>> #include "sim-events.h"
>> 
>> +#if HAVE_STRING_H
>> +#include <string.h>
>> +#endif
>> 
>> /* The hw-events object is implemented using sim-events */
>> 
>> diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
>> index 2848b9bcb5..d05656235d 100644
>> --- a/sim/common/hw-handles.c
>> +++ b/sim/common/hw-handles.c
>> @@ -23,6 +23,9 @@
>> #include "hw-main.h"
>> #include "hw-base.h"
>> 
>> +#if HAVE_STDLIB_H
>> +#include <stdlib.h>
>> +#endif
>> 
>> struct hw_handle_mapping
>> {
>> diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
>> index 81cdbf5061..74f5fd488c 100644
>> --- a/sim/common/sim-fpu.c
>> +++ b/sim/common/sim-fpu.c
>> @@ -41,6 +41,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> #include "sim-io.h"
>> #include "sim-assert.h"
>> 
>> +#ifdef HAVE_STDLIB_H
>> +#include <stdlib.h>
>> +#endif
>> 
>> /* Debugging support.
>>    If digits is -1, then print all digits.  */
>> diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
>> index 69aebfe3d0..dc4a71203a 100644
>> --- a/sim/common/sim-options.c
>> +++ b/sim/common/sim-options.c
>> @@ -17,6 +17,7 @@ GNU General Public License for more details.
>> You should have received a copy of the GNU General Public License
>> along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> 
>> +#include "config.h"
>> #include "sim-main.h"
>> #ifdef HAVE_STRING_H
>> #include <string.h>
>> @@ -29,6 +30,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> #include <stdlib.h>
>> #endif
>> #include <ctype.h>
>> +#include <stdio.h>
>> #include "libiberty.h"
>> #include "sim-options.h"
>> #include "sim-io.h"
>> diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
>> index 6c357f8267..174336b377 100644
>> --- a/sim/common/sim-watch.c
>> +++ b/sim/common/sim-watch.c
>> @@ -17,12 +17,14 @@ GNU General Public License for more details.
>> You should have received a copy of the GNU General Public License
>> along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> 
>> +#include "config.h"
>> #include "sim-main.h"
>> #include "sim-options.h"
>> 
>> #include "sim-assert.h"
>> 
>> #include <ctype.h>
>> +#include <stdio.h>
>> 
>> #ifdef HAVE_STRING_H
>> #include <string.h>
>> -- 
>> 2.19.1
>> 


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

* Re: [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-28 11:57     ` Alan Hayward
@ 2019-03-28 13:49       ` Andrew Burgess
  2019-03-28 15:25         ` Alan Hayward
  2019-03-28 21:31         ` Stafford Horne
  0 siblings, 2 replies; 12+ messages in thread
From: Andrew Burgess @ 2019-03-28 13:49 UTC (permalink / raw)
  To: Alan Hayward; +Cc: Stafford Horne, GDB patches, Simon Marchi, nd

* Alan Hayward <Alan.Hayward@arm.com> [2019-03-28 11:56:59 +0000]:

> 
> 
> > On 21 Mar 2019, at 22:14, Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> > 
> > * Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:18 +0900]:
> > 
> >> During building of several cgen simulator's I notices the below
> >> warnings.  Adding includes fixes these.
> >> 
> >> Including config.h allows stdio.h to properly configure itself to expose
> >> asprintf().
> 
> Stafford, it looks like this breaks AArch64 on both Ubuntu 16.04 and 18.04: 
> 
> 
> libsim.a(interp.o): In function `sim_open':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/interp.c:328: undefined reference to `SIM_ASSERT'
> libsim.a(cpustate.o): In function `aarch64_get_vec_u64':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:438: undefined reference to `ARRAY_SIZE'
> libsim.a(cpustate.o): In function `aarch64_get_vec_u32':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:444: undefined reference to `ARRAY_SIZE'
> libsim.a(cpustate.o): In function `aarch64_get_vec_u16':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:450: undefined reference to `ARRAY_SIZE'
> libsim.a(cpustate.o): In function `aarch64_get_vec_u8':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:456: undefined reference to `ARRAY_SIZE'
> libsim.a(cpustate.o): In function `aarch64_get_vec_s64':
> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/Makefile:271: recipe for target 'run' failed
> make[3]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64'
> Makefile:129: recipe for target 'all' failed
> make[2]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim'
> Makefile:8878: recipe for target 'all-sim' failed
> binutils-gdb/sim/aarch64/cpustate.c:462: undefined reference to `ARRAY_SIZE'
> libsim.a(cpustate.o):/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:468: more undefined references to `ARRAY_SIZE' follow
> collect2: error: ld returned 1 exit status
> 
> 
> I suspect the AArch64 buildbot will be failing once it catches up
> https://gdb-build.sergiodj.net/waterfall?tag=aarch64

I pushed the patch below to fix this issue.

Thanks,
Andrew

--

[PATCH] sim: fix aarch64 sim build

This commit:

  commit ef9866970ce6683d40465fb7c3168f87a1dcd1b7
  Date:   Thu Mar 28 06:40:30 2019 +0900

      sim/common: convert sim-arange to use sim-inline

Broke the simulator build for aarch64 - some required macros are no
longer included where needed, fixed in this commit.

sim/aarch64/ChangeLog:

	* cpustate.c: Add 'libiberty.h' include.
	* interp.c: Add 'sim-assert.h' include.
---
 sim/aarch64/ChangeLog  | 5 +++++
 sim/aarch64/cpustate.c | 1 +
 sim/aarch64/interp.c   | 1 +
 3 files changed, 7 insertions(+)

diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
index 6f5121a76fa..f90b7ad321a 100644
--- a/sim/aarch64/cpustate.c
+++ b/sim/aarch64/cpustate.c
@@ -25,6 +25,7 @@
 #include "sim-main.h"
 #include "cpustate.h"
 #include "simulator.h"
+#include "libiberty.h"
 
 /* Some operands are allowed to access the stack pointer (reg 31).
    For others a read from r31 always returns 0, and a write to r31 is ignored.  */
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index c8a3c28c494..c5cfc4a88e4 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -38,6 +38,7 @@
 #include "sim-options.h"
 #include "memory.h"
 #include "simulator.h"
+#include "sim-assert.h"
 
 /* Filter out (in place) symbols that are useless for disassembly.
    COUNT is the number of elements in SYMBOLS.
-- 
2.14.5



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

* Re: [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-28 13:49       ` Andrew Burgess
@ 2019-03-28 15:25         ` Alan Hayward
  2019-03-28 21:31         ` Stafford Horne
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Hayward @ 2019-03-28 15:25 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Stafford Horne, GDB patches, Simon Marchi, nd



> On 28 Mar 2019, at 13:49, Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> 
> * Alan Hayward <Alan.Hayward@arm.com> [2019-03-28 11:56:59 +0000]:
> 
>> 
>> 
>>> On 21 Mar 2019, at 22:14, Andrew Burgess <andrew.burgess@embecosm.com> wrote:
>>> 
>>> * Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:18 +0900]:
>>> 
>>>> During building of several cgen simulator's I notices the below
>>>> warnings.  Adding includes fixes these.
>>>> 
>>>> Including config.h allows stdio.h to properly configure itself to expose
>>>> asprintf().
>> 
>> Stafford, it looks like this breaks AArch64 on both Ubuntu 16.04 and 18.04: 
>> 
>> 
>> libsim.a(interp.o): In function `sim_open':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/interp.c:328: undefined reference to `SIM_ASSERT'
>> libsim.a(cpustate.o): In function `aarch64_get_vec_u64':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:438: undefined reference to `ARRAY_SIZE'
>> libsim.a(cpustate.o): In function `aarch64_get_vec_u32':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:444: undefined reference to `ARRAY_SIZE'
>> libsim.a(cpustate.o): In function `aarch64_get_vec_u16':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:450: undefined reference to `ARRAY_SIZE'
>> libsim.a(cpustate.o): In function `aarch64_get_vec_u8':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:456: undefined reference to `ARRAY_SIZE'
>> libsim.a(cpustate.o): In function `aarch64_get_vec_s64':
>> /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/Makefile:271: recipe for target 'run' failed
>> make[3]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64'
>> Makefile:129: recipe for target 'all' failed
>> make[2]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim'
>> Makefile:8878: recipe for target 'all-sim' failed
>> binutils-gdb/sim/aarch64/cpustate.c:462: undefined reference to `ARRAY_SIZE'
>> libsim.a(cpustate.o):/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:468: more undefined references to `ARRAY_SIZE' follow
>> collect2: error: ld returned 1 exit status
>> 
>> 
>> I suspect the AArch64 buildbot will be failing once it catches up
>> https://gdb-build.sergiodj.net/waterfall?tag=aarch64
> 
> I pushed the patch below to fix this issue.


Works again for me now. Thanks for fixing!


Alan.



> 
> Thanks,
> Andrew
> 
> --
> 
> [PATCH] sim: fix aarch64 sim build
> 
> This commit:
> 
>  commit ef9866970ce6683d40465fb7c3168f87a1dcd1b7
>  Date:   Thu Mar 28 06:40:30 2019 +0900
> 
>      sim/common: convert sim-arange to use sim-inline
> 
> Broke the simulator build for aarch64 - some required macros are no
> longer included where needed, fixed in this commit.
> 
> sim/aarch64/ChangeLog:
> 
> 	* cpustate.c: Add 'libiberty.h' include.
> 	* interp.c: Add 'sim-assert.h' include.
> ---
> sim/aarch64/ChangeLog  | 5 +++++
> sim/aarch64/cpustate.c | 1 +
> sim/aarch64/interp.c   | 1 +
> 3 files changed, 7 insertions(+)
> 
> diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
> index 6f5121a76fa..f90b7ad321a 100644
> --- a/sim/aarch64/cpustate.c
> +++ b/sim/aarch64/cpustate.c
> @@ -25,6 +25,7 @@
> #include "sim-main.h"
> #include "cpustate.h"
> #include "simulator.h"
> +#include "libiberty.h"
> 
> /* Some operands are allowed to access the stack pointer (reg 31).
>    For others a read from r31 always returns 0, and a write to r31 is ignored.  */
> diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
> index c8a3c28c494..c5cfc4a88e4 100644
> --- a/sim/aarch64/interp.c
> +++ b/sim/aarch64/interp.c
> @@ -38,6 +38,7 @@
> #include "sim-options.h"
> #include "memory.h"
> #include "simulator.h"
> +#include "sim-assert.h"
> 
> /* Filter out (in place) symbols that are useless for disassembly.
>    COUNT is the number of elements in SYMBOLS.
> -- 
> 2.14.5

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

* Re: [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."
  2019-03-28 13:49       ` Andrew Burgess
  2019-03-28 15:25         ` Alan Hayward
@ 2019-03-28 21:31         ` Stafford Horne
  1 sibling, 0 replies; 12+ messages in thread
From: Stafford Horne @ 2019-03-28 21:31 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Alan Hayward, GDB patches, Simon Marchi, nd

On Thu, Mar 28, 2019 at 01:49:01PM +0000, Andrew Burgess wrote:
> * Alan Hayward <Alan.Hayward@arm.com> [2019-03-28 11:56:59 +0000]:
> 
> > 
> > 
> > > On 21 Mar 2019, at 22:14, Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> > > 
> > > * Stafford Horne <shorne@gmail.com> [2019-03-17 06:40:18 +0900]:
> > > 
> > >> During building of several cgen simulator's I notices the below
> > >> warnings.  Adding includes fixes these.
> > >> 
> > >> Including config.h allows stdio.h to properly configure itself to expose
> > >> asprintf().
> > 
> > Stafford, it looks like this breaks AArch64 on both Ubuntu 16.04 and 18.04: 
> > 
> > 
> > libsim.a(interp.o): In function `sim_open':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/interp.c:328: undefined reference to `SIM_ASSERT'
> > libsim.a(cpustate.o): In function `aarch64_get_vec_u64':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:438: undefined reference to `ARRAY_SIZE'
> > libsim.a(cpustate.o): In function `aarch64_get_vec_u32':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:444: undefined reference to `ARRAY_SIZE'
> > libsim.a(cpustate.o): In function `aarch64_get_vec_u16':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:450: undefined reference to `ARRAY_SIZE'
> > libsim.a(cpustate.o): In function `aarch64_get_vec_u8':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:456: undefined reference to `ARRAY_SIZE'
> > libsim.a(cpustate.o): In function `aarch64_get_vec_s64':
> > /work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/Makefile:271: recipe for target 'run' failed
> > make[3]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64'
> > Makefile:129: recipe for target 'all' failed
> > make[2]: Leaving directory '/work/alahay01/gdb-HEAD/build-aarch64/sim'
> > Makefile:8878: recipe for target 'all-sim' failed
> > binutils-gdb/sim/aarch64/cpustate.c:462: undefined reference to `ARRAY_SIZE'
> > libsim.a(cpustate.o):/work/alahay01/gdb-HEAD/build-aarch64/sim/aarch64/../../../src/binutils-gdb/sim/aarch64/cpustate.c:468: more undefined references to `ARRAY_SIZE' follow
> > collect2: error: ld returned 1 exit status
> > 
> > 
> > I suspect the AArch64 buildbot will be failing once it catches up
> > https://gdb-build.sergiodj.net/waterfall?tag=aarch64
> 
> I pushed the patch below to fix this issue.

Thanks for covering on this.  I did test on several target but not all.

The breaking change was removing (unused) sim-assert.h from sim-arange.h in the
previous patch; that also brings in libiberty.h.

Sorry for the trouble.

-Stafford

> Thanks,
> Andrew
> 
> --
> 
> [PATCH] sim: fix aarch64 sim build
> 
> This commit:
> 
>   commit ef9866970ce6683d40465fb7c3168f87a1dcd1b7
>   Date:   Thu Mar 28 06:40:30 2019 +0900
> 
>       sim/common: convert sim-arange to use sim-inline
> 
> Broke the simulator build for aarch64 - some required macros are no
> longer included where needed, fixed in this commit.
> 
> sim/aarch64/ChangeLog:
> 
> 	* cpustate.c: Add 'libiberty.h' include.
> 	* interp.c: Add 'sim-assert.h' include.
> ---
>  sim/aarch64/ChangeLog  | 5 +++++
>  sim/aarch64/cpustate.c | 1 +
>  sim/aarch64/interp.c   | 1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
> index 6f5121a76fa..f90b7ad321a 100644
> --- a/sim/aarch64/cpustate.c
> +++ b/sim/aarch64/cpustate.c
> @@ -25,6 +25,7 @@
>  #include "sim-main.h"
>  #include "cpustate.h"
>  #include "simulator.h"
> +#include "libiberty.h"
>  
>  /* Some operands are allowed to access the stack pointer (reg 31).
>     For others a read from r31 always returns 0, and a write to r31 is ignored.  */
> diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
> index c8a3c28c494..c5cfc4a88e4 100644
> --- a/sim/aarch64/interp.c
> +++ b/sim/aarch64/interp.c
> @@ -38,6 +38,7 @@
>  #include "sim-options.h"
>  #include "memory.h"
>  #include "simulator.h"
> +#include "sim-assert.h"
>  
>  /* Filter out (in place) symbols that are useless for disassembly.
>     COUNT is the number of elements in SYMBOLS.
> -- 
> 2.14.5
> 
> 
> 

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

end of thread, other threads:[~2019-03-28 21:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-16 21:40 [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
2019-03-16 21:40 ` [PATCH v2 1/2] sim/common: convert sim-arange to use sim-inline Stafford Horne
2019-03-21 22:12   ` Andrew Burgess
2019-03-16 21:40 ` [PATCH v2 2/2] sim/common: Fix warnings: "warning: implicit declaration of function..." Stafford Horne
2019-03-21 22:14   ` Andrew Burgess
2019-03-28 11:57     ` Alan Hayward
2019-03-28 13:49       ` Andrew Burgess
2019-03-28 15:25         ` Alan Hayward
2019-03-28 21:31         ` Stafford Horne
2019-03-17  5:55 ` [PATCH v2 0/2] Fix build failure with sim-arange inlining Stafford Horne
2019-03-21 22:17   ` Andrew Burgess
2019-03-26 21:34     ` Stafford Horne

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