commit ee4724712b13bdcf59782386612e9fcda8977a3a
parent fb7fe4047c21fd43a1c085a6314b7f8ee4ec5647
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 7 Nov 2024 12:55:38 +0100
libc: Fix compilation of ppc
Diffstat:
6 files changed, 204 insertions(+), 13 deletions(-)
diff --git a/include/bits/linux/ppc/arch/inttypes.h b/include/bits/linux/ppc/arch/inttypes.h
@@ -0,0 +1,181 @@
+#define PRId8 "hhd"
+#define PRIi8 "hhi"
+#define PRIo8 "hho"
+#define PRIu8 "hhu"
+#define PRIx8 "hhx"
+#define PRIX8 "hhX"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+
+#define PRId32 "d"
+#define PRIi32 "i"
+#define PRIo32 "o"
+#define PRIu32 "u"
+#define PRIx32 "x"
+#define PRIX32 "X"
+
+#define PRId64 "lld"
+#define PRIi64 "lli"
+#define PRIo64 "llo"
+#define PRIu64 "llu"
+#define PRIx64 "llx"
+#define PRIX64 "llX"
+
+#define PRIdLEAST8 "hhd"
+#define PRIiLEAST8 "hhi"
+#define PRIoLEAST8 "hho"
+#define PRIuLEAST8 "hhu"
+#define PRIxLEAST8 "hhx"
+#define PRIXLEAST8 "hhX"
+
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+
+#define PRIdLEAST32 "d"
+#define PRIiLEAST32 "i"
+#define PRIoLEAST32 "o"
+#define PRIuLEAST32 "u"
+#define PRIxLEAST32 "x"
+#define PRIXLEAST32 "X"
+
+#define PRIdLEAST64 "lld"
+#define PRIiLEAST64 "lli"
+#define PRIoLEAST64 "llo"
+#define PRIuLEAST64 "llu"
+#define PRIxLEAST64 "llx"
+#define PRIXLEAST64 "llX"
+
+#define PRIdFAST8 "hhd"
+#define PRIiFAST8 "hhi"
+#define PRIoFAST8 "hho"
+#define PRIuFAST8 "hhu"
+#define PRIxFAST8 "hhx"
+#define PRIXFAST8 "hhX"
+
+#define PRIdFAST16 "d"
+#define PRIiFAST16 "i"
+#define PRIoFAST16 "o"
+#define PRIuFAST16 "u"
+#define PRIxFAST16 "x"
+#define PRIXFAST16 "X"
+
+#define PRIdFAST32 "d"
+#define PRIiFAST32 "i"
+#define PRIoFAST32 "o"
+#define PRIuFAST32 "u"
+#define PRIxFAST32 "x"
+#define PRIXFAST32 "X"
+
+#define PRIdFAST64 "lld"
+#define PRIiFAST64 "lli"
+#define PRIoFAST64 "llo"
+#define PRIuFAST64 "llu"
+#define PRIxFAST64 "llx"
+#define PRIXFAST64 "llX"
+
+#define PRIdPTR "ld"
+#define PRIiPTR "li"
+#define PRIoPTR "lo"
+#define PRIuPTR "lu"
+#define PRIxPTR "lx"
+#define PRIXPTR "lX"
+
+#define PRIdMAX "lld"
+#define PRIiMAX "lli"
+#define PRIoMAX "llo"
+#define PRIuMAX "llu"
+#define PRIxMAX "llx"
+#define PRIXMAX "llX"
+
+#define SCNd8 "hhd"
+#define SCNi8 "hhi"
+#define SCNo8 "hho"
+#define SCNu8 "hhu"
+#define SCNx8 "hhx"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+
+#define SCNd32 "d"
+#define SCNi32 "i"
+#define SCNo32 "o"
+#define SCNu32 "u"
+#define SCNx32 "x"
+
+#define SCNd64 "lld"
+#define SCNi64 "lli"
+#define SCNo64 "llo"
+#define SCNu64 "llu"
+#define SCNx64 "llx"
+
+#define SCNdLEAST8 "hhd"
+#define SCNiLEAST8 "hhi"
+#define SCNoLEAST8 "hho"
+#define SCNuLEAST8 "hhu"
+#define SCNxLEAST8 "hhx"
+
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+
+#define SCNdLEAST32 "d"
+#define SCNiLEAST32 "i"
+#define SCNoLEAST32 "o"
+#define SCNuLEAST32 "u"
+#define SCNxLEAST32 "x"
+
+#define SCNdLEAST64 "lld"
+#define SCNiLEAST64 "lli"
+#define SCNoLEAST64 "llo"
+#define SCNuLEAST64 "llu"
+#define SCNxLEAST64 "llx"
+
+#define SCNdFAST8 "hhd"
+#define SCNiFAST8 "hhi"
+#define SCNoFAST8 "hho"
+#define SCNuFAST8 "hhu"
+#define SCNxFAST8 "hhx"
+
+#define SCNdFAST16 "d"
+#define SCNiFAST16 "i"
+#define SCNoFAST16 "o"
+#define SCNuFAST16 "u"
+#define SCNxFAST16 "x"
+
+#define SCNdFAST32 "d"
+#define SCNiFAST32 "i"
+#define SCNoFAST32 "o"
+#define SCNuFAST32 "u"
+#define SCNxFAST32 "x"
+
+#define SCNdFAST64 "lld"
+#define SCNiFAST64 "lli"
+#define SCNoFAST64 "llo"
+#define SCNuFAST64 "llu"
+#define SCNxFAST64 "llx"
+
+#define SCNdPTR "ld"
+#define SCNiPTR "li"
+#define SCNoPTR "lo"
+#define SCNuPTR "lu"
+#define SCNxPTR "lx"
+
+#define SCNdMAX "lld"
+#define SCNiMAX "lli"
+#define SCNoMAX "llo"
+#define SCNuMAX "llu"
+#define SCNxMAX "llx"
diff --git a/include/bits/linux/ppc/arch/sigaction.h b/include/bits/linux/ppc/arch/sigaction.h
@@ -0,0 +1,10 @@
+#define SA_RESTORER 0x04000000
+
+struct sigaction {
+ void (*sa_handler)(int);
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+ unsigned sa_mask[2];
+};
+
+extern int __sigaction(int, struct sigaction *, struct sigaction *, size_t);
diff --git a/scripts/build/conf/ppc-linux.mk b/scripts/build/conf/ppc-linux.mk
@@ -0,0 +1,5 @@
+ABI = sysv
+ARCH = ppc
+SYS = linux
+FORMAT = elf
+O = ql
diff --git a/scripts/build/conf/ppc32-linux.mk b/scripts/build/conf/ppc32-linux.mk
@@ -1,5 +0,0 @@
-ABI = sysv
-ARCH = ppc32
-SYS = linux
-FORMAT = elf
-O = ql
diff --git a/scripts/libc-dirs b/scripts/libc-dirs
@@ -3,7 +3,8 @@ libexec
libexec/scc
lib
lib/scc
-lib/scc/ppc32-linux
+lib/scc/ppc-linux
+lib/scc/ppc64-linux
lib/scc/i386-linux
lib/scc/arm-linux
lib/scc/arm64-linux
diff --git a/src/libc/arch/ppc/linux/Makefile b/src/libc/arch/ppc/linux/Makefile
@@ -25,17 +25,16 @@ GENOBJS =\
OBJS =\
$(GENOBJS)\
- _cerrno.o\
- _sys_errlist.o\
-
-GENSRC = $(GENOBJS:.o=.s)
+ _cerrno.$O\
+ _sys_errlist.$O\
all: $(CRT) $(OBJS)
$(CRT): ../crt-posix.s
-$(GENSRC): syscall.lst
- ./gensys.sh $(@:.s=)
+$(GENOBJS): syscall.lst
+ ./gensys.sh $(@:.$O=)
+ $(AS) $(PROJ_ASFLAGS) -o $@ $(@:.$O=.s)
clean:
- rm -f $(GENSRC) _sys_errlist.c
+ rm -f $(GENOBJS:.$O=.s) _sys_errlist.c