[PATCH 1/9] sparc: add 'sparcv8' predefines for sparc32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By default, the architecture version is 'v8' for sparc32
and 'v9' for sparc64.
The predefines were added for sparc64 but not for sparc32.

Fix this by adding a generic 'sparcv%d' together with a
variable to hold the architecture version and initialize
this one accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 target-sparc.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/target-sparc.c b/target-sparc.c
index 865dbc8a2180..be4e968ec604 100644
--- a/target-sparc.c
+++ b/target-sparc.c
@@ -3,16 +3,25 @@
 #include "machine.h"
 
 
+static int sparc_version;
+
 static void predefine_sparc(const struct target *self)
 {
 	predefine("__sparc__", 1, "1");
 	predefine("__sparc", 1, "1");
 	predefine_nostd("sparc");
+
+	predefine_weak("__sparc_v%d__", sparc_version);
+	predefine_weak("__sparcv%d__", sparc_version);
+	predefine_weak("__sparcv%d", sparc_version);
 }
 
 
 static void init_sparc32(const struct target *target)
 {
+	if (!sparc_version)
+		sparc_version = 8;
+
 	if (arch_os == OS_SUNOS) {
 		wint_ctype = &long_ctype;
 		wchar_ctype = &long_ctype;
@@ -45,11 +54,14 @@ const struct target target_sparc32 = {
 };
 
 
+static void init_sparc64(const struct target *target)
+{
+	if (!sparc_version)
+		sparc_version = 9;
+}
+
 static void predefine_sparc64(const struct target *self)
 {
-	predefine("__sparc_v9__", 1, "1");
-	predefine("__sparcv9__", 1, "1");
-	predefine("__sparcv9", 1, "1");
 	predefine("__sparc64__", 1, "1");
 	predefine("__arch64__", 1, "1");
 
@@ -65,5 +77,6 @@ const struct target target_sparc64 = {
 
 	.target_32bit = &target_sparc32,
 
+	.init = init_sparc64,
 	.predefine = predefine_sparc64,
 };
-- 
2.27.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux