[v2,2/2] sim/common: Fix warnings: "warning: implicit declaration of function..."

Message ID 20190328134900.GC10887@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess March 28, 2019, 1:49 p.m. UTC
  * 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(+)
  

Comments

Alan Hayward March 28, 2019, 3:25 p.m. UTC | #1
> 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
  
Stafford Horne March 28, 2019, 9:31 p.m. UTC | #2
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
> 
> 
>
  

Patch

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.