All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] gdb: fix sim support for ARM
@ 2016-07-31 11:27 Waldemar Brodkorb
  2016-08-01 21:23 ` Romain Naour
  2016-08-04 22:20 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Waldemar Brodkorb @ 2016-07-31 11:27 UTC (permalink / raw)
  To: buildroot

It seems the old fix breaks compilation for other
architectures then bfin.
Fixes:
http://autobuild.buildroot.net/results/3b82c44ee853fab0e0c63881f0705bb659412917/
http://autobuild.buildroot.net/results/dafbb93ab38a4285ce42436219d552cceb14828b/

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---

@Thomas Petazzoni: Can you check if it still works on your old
Debian system with gcc 4.4 on the host. Thanks.

---
 package/gdb/7.10.1/0005-fix-sim-compile.patch |   16 ----------------
 package/gdb/7.10.1/0006-fix-sim-compile.patch |   22 ++++++++++++++++++++++
 package/gdb/7.11.1/0001-fix-sim-compile.patch |   18 ++++++++++++------
 3 files changed, 34 insertions(+), 22 deletions(-)
 delete mode 100644 package/gdb/7.10.1/0005-fix-sim-compile.patch
 create mode 100644 package/gdb/7.10.1/0006-fix-sim-compile.patch

diff --git a/package/gdb/7.10.1/0005-fix-sim-compile.patch b/package/gdb/7.10.1/0005-fix-sim-compile.patch
deleted file mode 100644
index c886363..0000000
--- a/package/gdb/7.10.1/0005-fix-sim-compile.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Fix compile on older systems with gcc 4.4.x.
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
-
-diff -Nur gdb-7.10.1.orig//sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
---- gdb-7.10.1.orig//sim/common/sim-base.h	2015-05-13 13:03:56.000000000 -0500
-+++ gdb-7.10.1/sim/common/sim-base.h	2016-07-08 07:44:17.000000000 -0500
-@@ -72,8 +72,6 @@
- #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
- #endif
- 
--/* TODO: Probably should just delete SIM_CPU.  */
--typedef struct _sim_cpu SIM_CPU;
- typedef struct _sim_cpu sim_cpu;
- 
- #include "sim-module.h"
diff --git a/package/gdb/7.10.1/0006-fix-sim-compile.patch b/package/gdb/7.10.1/0006-fix-sim-compile.patch
new file mode 100644
index 0000000..4d365b9
--- /dev/null
+++ b/package/gdb/7.10.1/0006-fix-sim-compile.patch
@@ -0,0 +1,22 @@
+Fix compile on older systems with gcc 4.4.x.
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gdb-7.10.1.orig/sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
+--- gdb-7.10.1.orig/sim/common/sim-base.h	2015-05-13 20:03:56.000000000 +0200
++++ gdb-7.10.1/sim/common/sim-base.h	2016-07-31 12:37:36.103814690 +0200
+@@ -72,8 +72,13 @@
+ #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
+ #endif
+ 
+-/* TODO: Probably should just delete SIM_CPU.  */
++/* GCC 4.4 and older should not define this.  */
++#define GCC_VERSION (__GNUC__ * 10000 \
++                               + __GNUC_MINOR__ * 100 \
++                               + __GNUC_PATCHLEVEL__)
++#if __GCC_VERSION > 40400
+ typedef struct _sim_cpu SIM_CPU;
++#endif
+ typedef struct _sim_cpu sim_cpu;
+ 
+ #include "sim-module.h"
diff --git a/package/gdb/7.11.1/0001-fix-sim-compile.patch b/package/gdb/7.11.1/0001-fix-sim-compile.patch
index ecb0514..4d365b9 100644
--- a/package/gdb/7.11.1/0001-fix-sim-compile.patch
+++ b/package/gdb/7.11.1/0001-fix-sim-compile.patch
@@ -1,16 +1,22 @@
-Fix compile on older systems with gcc 4.4.x
+Fix compile on older systems with gcc 4.4.x.
 
 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
 
-diff -Nur gdb-7.11.1.orig//sim/common/sim-base.h gdb-7.11.1/sim/common/sim-base.h
---- gdb-7.11.1.orig//sim/common/sim-base.h	2016-02-09 21:19:39.000000000 -0600
-+++ gdb-7.11.1/sim/common/sim-base.h	2016-07-08 08:02:09.000000000 -0500
-@@ -72,8 +72,6 @@
+diff -Nur gdb-7.10.1.orig/sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
+--- gdb-7.10.1.orig/sim/common/sim-base.h	2015-05-13 20:03:56.000000000 +0200
++++ gdb-7.10.1/sim/common/sim-base.h	2016-07-31 12:37:36.103814690 +0200
+@@ -72,8 +72,13 @@
  #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
  #endif
  
 -/* TODO: Probably should just delete SIM_CPU.  */
--typedef struct _sim_cpu SIM_CPU;
++/* GCC 4.4 and older should not define this.  */
++#define GCC_VERSION (__GNUC__ * 10000 \
++                               + __GNUC_MINOR__ * 100 \
++                               + __GNUC_PATCHLEVEL__)
++#if __GCC_VERSION > 40400
+ typedef struct _sim_cpu SIM_CPU;
++#endif
  typedef struct _sim_cpu sim_cpu;
  
  #include "sim-module.h"
-- 
1.7.10.4

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

* [Buildroot] [PATCH] gdb: fix sim support for ARM
  2016-07-31 11:27 [Buildroot] [PATCH] gdb: fix sim support for ARM Waldemar Brodkorb
@ 2016-08-01 21:23 ` Romain Naour
  2016-08-04 22:20 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Romain Naour @ 2016-08-01 21:23 UTC (permalink / raw)
  To: buildroot

Hi Waldemar,

Le 31/07/2016 ? 13:27, Waldemar Brodkorb a ?crit :
> It seems the old fix breaks compilation for other
> architectures then bfin.
> Fixes:
> http://autobuild.buildroot.net/results/3b82c44ee853fab0e0c63881f0705bb659412917/
> http://autobuild.buildroot.net/results/dafbb93ab38a4285ce42436219d552cceb14828b/

[Tested in a chroot squeeze with gcc 4.4.5]
Tested-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain


> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> ---
> 
> @Thomas Petazzoni: Can you check if it still works on your old
> Debian system with gcc 4.4 on the host. Thanks.
> 
> ---
>  package/gdb/7.10.1/0005-fix-sim-compile.patch |   16 ----------------
>  package/gdb/7.10.1/0006-fix-sim-compile.patch |   22 ++++++++++++++++++++++
>  package/gdb/7.11.1/0001-fix-sim-compile.patch |   18 ++++++++++++------
>  3 files changed, 34 insertions(+), 22 deletions(-)
>  delete mode 100644 package/gdb/7.10.1/0005-fix-sim-compile.patch
>  create mode 100644 package/gdb/7.10.1/0006-fix-sim-compile.patch
> 
> diff --git a/package/gdb/7.10.1/0005-fix-sim-compile.patch b/package/gdb/7.10.1/0005-fix-sim-compile.patch
> deleted file mode 100644
> index c886363..0000000
> --- a/package/gdb/7.10.1/0005-fix-sim-compile.patch
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -Fix compile on older systems with gcc 4.4.x.
> -
> -Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> -
> -diff -Nur gdb-7.10.1.orig//sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
> ---- gdb-7.10.1.orig//sim/common/sim-base.h	2015-05-13 13:03:56.000000000 -0500
> -+++ gdb-7.10.1/sim/common/sim-base.h	2016-07-08 07:44:17.000000000 -0500
> -@@ -72,8 +72,6 @@
> - #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
> - #endif
> - 
> --/* TODO: Probably should just delete SIM_CPU.  */
> --typedef struct _sim_cpu SIM_CPU;
> - typedef struct _sim_cpu sim_cpu;
> - 
> - #include "sim-module.h"
> diff --git a/package/gdb/7.10.1/0006-fix-sim-compile.patch b/package/gdb/7.10.1/0006-fix-sim-compile.patch
> new file mode 100644
> index 0000000..4d365b9
> --- /dev/null
> +++ b/package/gdb/7.10.1/0006-fix-sim-compile.patch
> @@ -0,0 +1,22 @@
> +Fix compile on older systems with gcc 4.4.x.
> +
> +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> +
> +diff -Nur gdb-7.10.1.orig/sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
> +--- gdb-7.10.1.orig/sim/common/sim-base.h	2015-05-13 20:03:56.000000000 +0200
> ++++ gdb-7.10.1/sim/common/sim-base.h	2016-07-31 12:37:36.103814690 +0200
> +@@ -72,8 +72,13 @@
> + #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
> + #endif
> + 
> +-/* TODO: Probably should just delete SIM_CPU.  */
> ++/* GCC 4.4 and older should not define this.  */
> ++#define GCC_VERSION (__GNUC__ * 10000 \
> ++                               + __GNUC_MINOR__ * 100 \
> ++                               + __GNUC_PATCHLEVEL__)
> ++#if __GCC_VERSION > 40400
> + typedef struct _sim_cpu SIM_CPU;
> ++#endif
> + typedef struct _sim_cpu sim_cpu;
> + 
> + #include "sim-module.h"
> diff --git a/package/gdb/7.11.1/0001-fix-sim-compile.patch b/package/gdb/7.11.1/0001-fix-sim-compile.patch
> index ecb0514..4d365b9 100644
> --- a/package/gdb/7.11.1/0001-fix-sim-compile.patch
> +++ b/package/gdb/7.11.1/0001-fix-sim-compile.patch
> @@ -1,16 +1,22 @@
> -Fix compile on older systems with gcc 4.4.x
> +Fix compile on older systems with gcc 4.4.x.
>  
>  Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
>  
> -diff -Nur gdb-7.11.1.orig//sim/common/sim-base.h gdb-7.11.1/sim/common/sim-base.h
> ---- gdb-7.11.1.orig//sim/common/sim-base.h	2016-02-09 21:19:39.000000000 -0600
> -+++ gdb-7.11.1/sim/common/sim-base.h	2016-07-08 08:02:09.000000000 -0500
> -@@ -72,8 +72,6 @@
> +diff -Nur gdb-7.10.1.orig/sim/common/sim-base.h gdb-7.10.1/sim/common/sim-base.h
> +--- gdb-7.10.1.orig/sim/common/sim-base.h	2015-05-13 20:03:56.000000000 +0200
> ++++ gdb-7.10.1/sim/common/sim-base.h	2016-07-31 12:37:36.103814690 +0200
> +@@ -72,8 +72,13 @@
>   #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
>   #endif
>   
>  -/* TODO: Probably should just delete SIM_CPU.  */
> --typedef struct _sim_cpu SIM_CPU;
> ++/* GCC 4.4 and older should not define this.  */
> ++#define GCC_VERSION (__GNUC__ * 10000 \
> ++                               + __GNUC_MINOR__ * 100 \
> ++                               + __GNUC_PATCHLEVEL__)
> ++#if __GCC_VERSION > 40400
> + typedef struct _sim_cpu SIM_CPU;
> ++#endif
>   typedef struct _sim_cpu sim_cpu;
>   
>   #include "sim-module.h"
> 

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

* [Buildroot] [PATCH] gdb: fix sim support for ARM
  2016-07-31 11:27 [Buildroot] [PATCH] gdb: fix sim support for ARM Waldemar Brodkorb
  2016-08-01 21:23 ` Romain Naour
@ 2016-08-04 22:20 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2016-08-04 22:20 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 31 Jul 2016 13:27:51 +0200, Waldemar Brodkorb wrote:

> +-/* TODO: Probably should just delete SIM_CPU.  */
> ++/* GCC 4.4 and older should not define this.  */
> ++#define GCC_VERSION (__GNUC__ * 10000 \
> ++                               + __GNUC_MINOR__ * 100 \
> ++                               + __GNUC_PATCHLEVEL__)
> ++#if __GCC_VERSION > 40400
> + typedef struct _sim_cpu SIM_CPU;
> ++#endif
> + typedef struct _sim_cpu sim_cpu;

This is not the proper fix, and will potentially break again the build
for architectures other than Blackfin, when built with gcc 4.4.x.

The core of the problem is a commit from Mike Frysinger that refactors
the definition of the SIM_CPU type into a common header file. However,
due to include ordering issues, Mike had to keep a redefinition of
SIM_CPU in the Blackfin specific header file. This is fine with recent
compiler versions with which you can redefine multiple times the same
type, but causes a build failures with older compilers.

However, not all architectures have their own redefinition of SIM_CPU,
so if you remove it for gcc 4.4.x and older, you will break the build
of those architectures when gcc 4.4.x or older is used.

So, I've instead committed a patch that reverts Mike's commit for both
7.10 and 7.11. I've tested the build of the simulator on Blackfin and
ARM, with modern and ancient compilers and it seems to have fixed the
problem.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-08-04 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-31 11:27 [Buildroot] [PATCH] gdb: fix sim support for ARM Waldemar Brodkorb
2016-08-01 21:23 ` Romain Naour
2016-08-04 22:20 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.