1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

Toolchain: Enforce correct sizes for size_t and ptrdiff_t

This commit is contained in:
Tim Schumacher 2022-03-10 18:03:43 +01:00 committed by Linus Groh
parent 7e98c8eaf6
commit b55a3a504e

View file

@ -68,10 +68,10 @@ index 357b0bed0..8e96b74e5 100644
case ${target} in
+i[34567]86-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h serenity.h"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h serenity.h i386/serenity.h"
+ ;;
+x86_64-*-serenity*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h serenity.h"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h serenity.h i386/serenity.h"
+ ;;
+arm-*-serenity*)
+ tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h glibc-stdint.h arm/serenity-elf.h ${tm_file} serenity.h"
@ -154,6 +154,19 @@ index 000000000..24b29c3da
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
diff --git a/gcc/config/i386/serenity.h b/gcc/config/i386/serenity.h
new file mode 100644
index 000000000..dc2f5361e
--- /dev/null
+++ b/gcc/config/i386/serenity.h
@@ -0,0 +1,7 @@
+/* Ensure that we are using the SIZE_TYPE indicated by SysV */
+#undef SIZE_TYPE
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+/* Ensure that ptrdiff_t matches the actual pointer size */
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
index 14a01fe71..3f8e44288 100644
--- a/gcc/config/host-darwin.c