From 8ce567b25b4fc59c480933ce75dd9af91c1f3abb Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Mon, 20 Feb 2023 16:27:01 +0100
Subject: [PATCH] [machdeps] ppc_32.json is closer to original; new avr_16.json
 machdep

- ppc_32 was originally configured for a Mac; using
`powerpc-apple-darwin` triple in clang mimicks that better than
a generic `powerpc` (mostly, some alignment changes, and char gets signed)
- x86_16 cannot be created with standard gcc/clang (they do not support
16 bit, `-m16` doesn't do much in fact). avr_16 seems more standard for
these compiler. x86_16 could be recreated with more exotic compilers.
---
 share/machdeps/machdep_avr_16.json | 32 ++++++++++++++++++++++++++++++
 share/machdeps/machdep_ppc_32.json | 10 +++++-----
 2 files changed, 37 insertions(+), 5 deletions(-)
 create mode 100644 share/machdeps/machdep_avr_16.json

diff --git a/share/machdeps/machdep_avr_16.json b/share/machdeps/machdep_avr_16.json
new file mode 100644
index 00000000000..327f9bc286f
--- /dev/null
+++ b/share/machdeps/machdep_avr_16.json
@@ -0,0 +1,32 @@
+{
+    "alignof_aligned": 1,
+    "alignof_double": 1,
+    "alignof_float": 1,
+    "alignof_fun": 4,
+    "alignof_int": 1,
+    "alignof_long": 1,
+    "alignof_longdouble": 1,
+    "alignof_longlong": 1,
+    "alignof_ptr": 1,
+    "alignof_short": 2,
+    "alignof_str": 1,
+    "char_is_unsigned": false,
+    "compiler": "clang",
+    "cpp_arch_flags": "-target avr -m16",
+    "has__builtin_va_list": true,
+    "little_endian": true,
+    "ptrdiff_t": "int",
+    "size_t": "unsigned int",
+    "sizeof_double": 4,
+    "sizeof_float": 4,
+    "sizeof_fun": 1,
+    "sizeof_int": 2,
+    "sizeof_long": 4,
+    "sizeof_longdouble": 4,
+    "sizeof_longlong": 8,
+    "sizeof_ptr": 2,
+    "sizeof_short": 2,
+    "sizeof_void": 1,
+    "version": "clang version 15.0.7",
+    "wchar_t": "int"
+}
\ No newline at end of file
diff --git a/share/machdeps/machdep_ppc_32.json b/share/machdeps/machdep_ppc_32.json
index 5e5a767911c..de712c039d3 100644
--- a/share/machdeps/machdep_ppc_32.json
+++ b/share/machdeps/machdep_ppc_32.json
@@ -6,16 +6,16 @@
     "alignof_int": 4,
     "alignof_long": 4,
     "alignof_longdouble": 16,
-    "alignof_longlong": 8,
+    "alignof_longlong": 4,
     "alignof_ptr": 4,
     "alignof_short": 2,
     "alignof_str": 1,
-    "char_is_unsigned": true,
+    "char_is_unsigned": false,
     "compiler": "clang",
-    "cpp_arch_flags": "-target ppc32",
-    "has__builtin_va_list": true,
+    "cpp_arch_flags": "-target powerpc-apple-darwin -mcpu=603",
+    "has__builtin_va_list": false,
     "little_endian": false,
-    "ptrdiff_t": "long",
+    "ptrdiff_t": "int",
     "size_t": "unsigned long",
     "sizeof_double": 8,
     "sizeof_float": 4,
-- 
GitLab