diff mbox series

[2/2] cgcc: let sparse define _BIG_ENDIAN

Message ID 20191109130849.62559-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series cgcc: small simplifications | expand

Commit Message

Luc Van Oostenryck Nov. 9, 2019, 1:08 p.m. UTC
In addition of __BIG_ENDIAN__, gcc defines _BIG_ENDIAN on
powerpc (32 & 64-bit). cgcc does that too but this may also
beeneeded when using sparse itself.

So, move this define the the sparse code.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 cgcc  | 3 +--
 lib.c | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index c97085e74..93bdc644c 100755
--- a/cgcc
+++ b/cgcc
@@ -276,8 +276,7 @@  sub add_specs {
 	return (' --arch=x86_64' .
 		&float_types (1, 1, 33, [24,8], [53,11], [113,15]));
     } elsif ($spec eq 'ppc') {
-	return (' -D_BIG_ENDIAN' .
-		' --arch=ppc' .
+	return (' --arch=ppc' .
 		&float_types (1, 1, 21, [24,8], [53,11], [113,15]));
     } elsif ($spec eq 'ppc64') {
 	return (
diff --git a/lib.c b/lib.c
index fbf14282b..fd45da5d1 100644
--- a/lib.c
+++ b/lib.c
@@ -1514,6 +1514,8 @@  static void predefined_macros(void)
 		predefine("__powerpc", 1, "1");
 		predefine("__ppc__", 1, "1");
 		predefine("__PPC__", 1, "1");
+		if (arch_big_endian)
+			predefine("_BIG_DEBIAN", 1, "1");
 		break;
 	case MACH_RISCV64:
 	case MACH_RISCV32: