gdb: fix sim support for ARM
PATCH 1/1 gdb: fix sim support for ARM
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/
---
@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
package/gdb/7.10.1/0005-fix-sim-compile.patch deleted +0 -16
@@ -1,16 +0,0 @@ -Fix compile on older systems with gcc 4.4.x. - -Signed-off-by: Waldemar Brodkorb <[email protected]> - -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"
package/gdb/7.10.1/0006-fix-sim-compile.patch new file +22 -0
@@ -0,0 +1,22 @@ +Fix compile on older systems with gcc 4.4.x. + +Signed-off-by: Waldemar Brodkorb <[email protected]> + +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"
package/gdb/7.11.1/0001-fix-sim-compile.patch +12 -6
@@ -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 <[email protected]> -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"
Signature · 1 line
1.7.10.4
PATCH 1/1 gdb: fix sim support for ARM
Hi Waldemar,
Le 31/07/2016 ? 13:27, Waldemar Brodkorb a ?crit :
Quoted 5 lines
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/
Best regards,
Romain
Quoted 99 lines
Signed-off-by Waldemar Brodkorb <[email protected]>---
@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.patchpackage/gdb/7.10.1/0005-fix-sim-compile.patch deleted +0
-16@@ -1,16 +0,0 @@ -Fix compile on older systems with gcc 4.4.x. - -Signed-off-by: Waldemar Brodkorb <[email protected]> - -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"package/gdb/7.10.1/0006-fix-sim-compile.patch new file +22
-0@@ -0,0 +1,22 @@ +Fix compile on older systems with gcc 4.4.x. + +Signed-off-by: Waldemar Brodkorb <[email protected]> + +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"package/gdb/7.11.1/0001-fix-sim-compile.patch +12
-6@@ -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 <[email protected]> -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"
PATCH 1/1 gdb: fix sim support for ARM
In reply to Waldemar BrodkorbHello,
Quoted 9 lines · Waldemar Brodkorb
+-/* 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_cpuSIM_CPU;
++#endif
+ typedef struct_sim_cpusim_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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com