summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-12-14 17:09:39 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2004-12-14 17:09:39 +0000
commit334b74710e90be7f39ed368ea54a7dca1e44175e (patch)
treec0f855ffec5da8e1a3fedff50c5a5971f9e61de9
parent06aaee48192d4dcd92c7d38de77b2dc50c8a0346 (diff)
downloaddrakx-backup-do-not-use-334b74710e90be7f39ed368ea54a7dca1e44175e.tar
drakx-backup-do-not-use-334b74710e90be7f39ed368ea54a7dca1e44175e.tar.gz
drakx-backup-do-not-use-334b74710e90be7f39ed368ea54a7dca1e44175e.tar.bz2
drakx-backup-do-not-use-334b74710e90be7f39ed368ea54a7dca1e44175e.tar.xz
drakx-backup-do-not-use-334b74710e90be7f39ed368ea54a7dca1e44175e.zip
ppc64 port
-rw-r--r--mdk-stage1/dietlibc/Makefile9
-rw-r--r--mdk-stage1/dietlibc/diet.c6
-rw-r--r--mdk-stage1/dietlibc/include/asm/sigcontext.h2
-rw-r--r--mdk-stage1/dietlibc/include/elf.h120
-rw-r--r--mdk-stage1/dietlibc/include/endian.h2
-rw-r--r--mdk-stage1/dietlibc/include/fcntl.h2
-rw-r--r--mdk-stage1/dietlibc/include/setjmp.h2
-rw-r--r--mdk-stage1/dietlibc/include/signal.h4
-rw-r--r--mdk-stage1/dietlibc/include/sys/ioctl.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/mman.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/ptrace.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/shm.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/stat.h26
-rw-r--r--mdk-stage1/dietlibc/include/sys/types.h59
-rw-r--r--mdk-stage1/dietlibc/include/sys/ucontext.h2
-rw-r--r--mdk-stage1/dietlibc/include/termios.h4
-rw-r--r--mdk-stage1/dietlibc/syscalls.h5
17 files changed, 211 insertions, 40 deletions
diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile
index 0fe32e61b..ef8071e64 100644
--- a/mdk-stage1/dietlibc/Makefile
+++ b/mdk-stage1/dietlibc/Makefile
@@ -4,7 +4,7 @@ prefix?=/usr
#DESTDIR=/tmp/fefix
# Use "make DEBUG=1" to compile a debug version.
-MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/' -e 's/ppc64/ppc/')
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/')
# This extra-ugly cruft is here so make will not run uname and sed each
# time it looks at $(OBJDIR). This alone sped up running make when
@@ -22,6 +22,9 @@ else
ifeq ($(MYARCH),ppc)
ARCH=ppc
else
+ifeq ($(MYARCH),ppc64)
+ARCH=ppc64
+else
ifeq ($(MYARCH),arm)
ARCH=arm
else
@@ -64,6 +67,7 @@ endif
endif
endif
endif
+endif
# ARCH=$(MYARCH)
@@ -71,6 +75,9 @@ LIBDIR=${prefix}/lib
ifeq ($(ARCH),x86_64)
LIBDIR=${prefix}/lib64
endif
+ifeq ($(ARCH),ppc64)
+LIBDIR=${prefix}/lib64
+endif
BINDIR=${prefix}/bin
MAN1DIR=${prefix}/share/man/man1
INSTALLHOME=$(LIBDIR)/dietlibc
diff --git a/mdk-stage1/dietlibc/diet.c b/mdk-stage1/dietlibc/diet.c
index c3a053ac8..32434b878 100644
--- a/mdk-stage1/dietlibc/diet.c
+++ b/mdk-stage1/dietlibc/diet.c
@@ -35,6 +35,7 @@ static const char* Os[] = {
"arm","-Os","-fomit-frame-pointer",0,
"mips","-Os","-fomit-frame-pointer","-mno-abicalls","-G","8","-fno-pic",0,
"ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0,
+ "ppc64","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0,
"s390","-Os","-fomit-frame-pointer",0,
"sh","-Os","-fomit-frame-pointer",0,
"ia64","-Os","-fno-omit-frame-pointer",0,
@@ -125,9 +126,12 @@ usage:
shortplatform="sparc";
#endif
#endif
-#ifdef __powerpc__
+#ifdef powerpc
shortplatform="ppc";
#endif
+#ifdef __powerpc64__
+ shortplatform="ppc64";
+#endif
#ifdef __i386__
shortplatform="i386";
#endif
diff --git a/mdk-stage1/dietlibc/include/asm/sigcontext.h b/mdk-stage1/dietlibc/include/asm/sigcontext.h
index c4a720cc0..a22bdcfe7 100644
--- a/mdk-stage1/dietlibc/include/asm/sigcontext.h
+++ b/mdk-stage1/dietlibc/include/asm/sigcontext.h
@@ -13,7 +13,7 @@
#include <asm/mips-sigcontext.h>
#endif
-#ifdef __powerpc__
+#if defined(powerpc) || defined(__powerpc64__)
#include <asm/ppc-sigcontext.h>
#endif
diff --git a/mdk-stage1/dietlibc/include/elf.h b/mdk-stage1/dietlibc/include/elf.h
index 7b198bad3..bd8530153 100644
--- a/mdk-stage1/dietlibc/include/elf.h
+++ b/mdk-stage1/dietlibc/include/elf.h
@@ -63,6 +63,7 @@ typedef int64_t Elf64_Sxword;
#define EM_PARISC 15 /* HPPA */
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
#define EM_PPC 20 /* PowerPC */
+#define EM_PPC64 21 /* PowerPC 64-bit */
#define EM_S390 22 /* IBM S/390 */
#define EM_ARM 40 /* ARM */
@@ -450,6 +451,125 @@ typedef struct {
that may still be in object files. */
#define R_PPC_TOC16 255
+/* PowerPC64 relocations defined by the ABIs */
+#define R_PPC64_NONE R_PPC_NONE
+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16 R_PPC_GOT16
+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
+
+#define R_PPC64_COPY R_PPC_COPY
+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32 R_PPC_UADDR32
+#define R_PPC64_UADDR16 R_PPC_UADDR16
+#define R_PPC64_REL32 R_PPC_REL32
+#define R_PPC64_PLT32 R_PPC_PLT32
+#define R_PPC64_PLTREL32 R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
+#define R_PPC64_PLT64 45 /* doubleword64 L + A */
+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
+#define R_PPC64_TOC 51 /* doubleword64 .TOC */
+#define R_PPC64_PLTGOT16 52 /* half16* M + A */
+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
+
+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
+
+/* PowerPC64 relocations defined for the TLS access ABI. */
+#define R_PPC64_TLS 67 /* none (sym+add)@tls */
+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
+
+/* Keep this the last entry. */
+#define R_PPC64_NUM 107
+
+/* PowerPC64 specific values for the Dyn d_tag field. */
+#define DT_PPC64_GLINK (DT_LOPROC + 0)
+#define DT_PPC64_NUM 1
+
/*
* ARM ELF relocation types
*/
diff --git a/mdk-stage1/dietlibc/include/endian.h b/mdk-stage1/dietlibc/include/endian.h
index 93b1f2948..cc92b3372 100644
--- a/mdk-stage1/dietlibc/include/endian.h
+++ b/mdk-stage1/dietlibc/include/endian.h
@@ -47,7 +47,7 @@
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
-#if defined(__alpha__) || defined(__mips64) || defined(__sparc_v9__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__alpha__) || defined(__mips64) || defined(__sparc_v9__) || defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__)
#define __WORDSIZE 64
#endif
diff --git a/mdk-stage1/dietlibc/include/fcntl.h b/mdk-stage1/dietlibc/include/fcntl.h
index 33f58d82a..08832ebda 100644
--- a/mdk-stage1/dietlibc/include/fcntl.h
+++ b/mdk-stage1/dietlibc/include/fcntl.h
@@ -320,7 +320,7 @@ struct flock64 {
};
#endif
-#elif defined(__powerpc__)
+#elif defined(powerpc) || defined(__powerpc64__)
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
diff --git a/mdk-stage1/dietlibc/include/setjmp.h b/mdk-stage1/dietlibc/include/setjmp.h
index b591936ac..64091ebee 100644
--- a/mdk-stage1/dietlibc/include/setjmp.h
+++ b/mdk-stage1/dietlibc/include/setjmp.h
@@ -168,7 +168,7 @@ typedef int __jmp_buf[24];
#endif
#endif
-#ifdef __powerpc__
+#if defined(powerpc) || defined(__powerpc64__)
# define JB_GPR1 0 /* Also known as the stack pointer */
# define JB_GPR2 1
# define JB_LR 2 /* The address we will return to */
diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h
index fdc0518cf..9959295a4 100644
--- a/mdk-stage1/dietlibc/include/signal.h
+++ b/mdk-stage1/dietlibc/include/signal.h
@@ -30,8 +30,8 @@
#define SIGALRM 14
#define SIGTERM 15
#define SIGUNUSED 31
-#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__arm__) \
- || defined(__s390__) || defined(__ia64__)
+#if defined(__i386__) || defined(__x86_64__) || defined(powerpc) || defined(__arm__) \
+ || defined(__s390__) || defined(__ia64__) || defined(__powerpc64__)
#define SIGBUS 7
#define SIGUSR1 10
#define SIGUSR2 12
diff --git a/mdk-stage1/dietlibc/include/sys/ioctl.h b/mdk-stage1/dietlibc/include/sys/ioctl.h
index a7890f038..653bbdc6a 100644
--- a/mdk-stage1/dietlibc/include/sys/ioctl.h
+++ b/mdk-stage1/dietlibc/include/sys/ioctl.h
@@ -13,7 +13,7 @@
#include <sys/sparc-ioctl.h>
#elif defined(__mips__)
#include <sys/mips-ioctl.h>
-#elif defined(__powerpc__)
+#elif defined(powerpc) || defined(__powerpc64__)
#include <sys/ppc-ioctl.h>
#elif defined(__s390__)
#include <sys/s390-ioctl.h>
diff --git a/mdk-stage1/dietlibc/include/sys/mman.h b/mdk-stage1/dietlibc/include/sys/mman.h
index 298773a92..18510884f 100644
--- a/mdk-stage1/dietlibc/include/sys/mman.h
+++ b/mdk-stage1/dietlibc/include/sys/mman.h
@@ -75,7 +75,7 @@
#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
#define MADV_WILLNEED 0x3 /* pre-fault pages */
#define MADV_DONTNEED 0x4 /* discard these pages */
-#elif defined(__sparc__) || defined (__powerpc__)
+#elif defined(__sparc__) || defined (powerpc) || defined(__powerpc64__)
#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */
diff --git a/mdk-stage1/dietlibc/include/sys/ptrace.h b/mdk-stage1/dietlibc/include/sys/ptrace.h
index b09d3ac3a..27c95cb1e 100644
--- a/mdk-stage1/dietlibc/include/sys/ptrace.h
+++ b/mdk-stage1/dietlibc/include/sys/ptrace.h
@@ -635,7 +635,7 @@ struct sparc_stackf {
#define PTRACE_GETUCODE 29 /* stupid bsd-ism */
-#elif defined(__powerpc__)
+#elif defined(powerpc) || defined(__powerpc64__)
struct pt_regs {
unsigned long gpr[32];
diff --git a/mdk-stage1/dietlibc/include/sys/shm.h b/mdk-stage1/dietlibc/include/sys/shm.h
index 879a8786e..36a04f8c6 100644
--- a/mdk-stage1/dietlibc/include/sys/shm.h
+++ b/mdk-stage1/dietlibc/include/sys/shm.h
@@ -58,7 +58,7 @@ struct shm_info {
unsigned long swap_successes;
};
-#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(powerpc) || defined(__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__)
#define PAGE_SIZE 4096UL
#define PAGE_SHIFT 12
#elif defined(__alpha__) || defined(__sparc__)
diff --git a/mdk-stage1/dietlibc/include/sys/stat.h b/mdk-stage1/dietlibc/include/sys/stat.h
index d31cbd1f2..c821f60a1 100644
--- a/mdk-stage1/dietlibc/include/sys/stat.h
+++ b/mdk-stage1/dietlibc/include/sys/stat.h
@@ -193,7 +193,8 @@ __extension__ long long st_size;
unsigned long st_pad2;
__extension__ long long st_blocks;
};
-#elif defined(__powerpc__)
+#elif defined(powerpc) || defined(__powerpc64__)
+#if defined(powerpc)
struct stat {
dev_t st_dev;
ino_t st_ino;
@@ -214,6 +215,29 @@ struct stat {
unsigned long __unused4;
unsigned long __unused5;
};
+#else
+struct stat {
+ unsigned long st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned long st_rdev;
+ off_t st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned long __unused4;
+ unsigned long __unused5;
+ unsigned long __unused6;
+};
+#endif
/* This matches struct stat64 in glibc2.1.
*/
diff --git a/mdk-stage1/dietlibc/include/sys/types.h b/mdk-stage1/dietlibc/include/sys/types.h
index a3d2bf4be..75753cf19 100644
--- a/mdk-stage1/dietlibc/include/sys/types.h
+++ b/mdk-stage1/dietlibc/include/sys/types.h
@@ -41,29 +41,42 @@ typedef unsigned long int clock_t; /* Used for system times in
Used for timer ID returned by timer_create().
*/
-#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__hppa__) || defined(__sparc64__) \
- || defined(__x86_64__) || defined(__ia64__)
-typedef unsigned int uid_t; /* Used for user IDs. */
-typedef unsigned int gid_t; /* Used for group IDs. */
-typedef unsigned int dev_t; /* Used for device IDs. */
-#else
-typedef unsigned short uid_t; /* Used for user IDs. */
-typedef unsigned short gid_t; /* Used for group IDs. */
-typedef unsigned short dev_t; /* Used for device IDs. */
-#endif
-
-#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__sparc64__) \
- || defined(__x86_64__) || defined(__ia64__)
-typedef unsigned int mode_t; /* Used for some file attributes. */
-#else
-typedef unsigned short mode_t; /* Used for some file attributes. */
-#endif
-
-#if defined(__alpha__) || defined(__mips__) || defined(__sparc64__) \
- || defined(__x86_64__) || defined(__ia64__)
-typedef unsigned int nlink_t; /* Used for link counts. */
-#else
-typedef unsigned short nlink_t; /* Used for link counts. */
+#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__s390x__)
+ typedef unsigned int dev_t; /* Used for device IDs. */
+ typedef unsigned int gid_t; /* Used for group IDs. */
+ typedef unsigned int mode_t; /* Used for some file attributes. */
+ typedef unsigned int nlink_t; /* Used for link counts. */
+ typedef unsigned int uid_t; /* Used for user IDs. */
+#elif defined(__arm__) || defined(__i386__) || defined(__sparc__) || defined(__s390__) /* make sure __s390x__ hits before __s390__ */
+ typedef unsigned short dev_t;
+ typedef unsigned short gid_t;
+ typedef unsigned short mode_t;
+ typedef unsigned short nlink_t;
+ typedef unsigned short uid_t;
+#elif defined(__hppa__)
+ typedef unsigned int dev_t;
+ typedef unsigned int gid_t;
+ typedef unsigned short mode_t;
+ typedef unsigned short nlink_t;
+ typedef unsigned int uid_t;
+#elif defined(__mips__)
+ typedef unsigned int dev_t;
+ typedef int gid_t;
+ typedef unsigned int mode_t;
+ typedef int nlink_t;
+ typedef int uid_t;
+#elif defined(powerpc)
+ typedef unsigned int dev_t;
+ typedef unsigned int gid_t;
+ typedef unsigned int mode_t;
+ typedef unsigned short nlink_t;
+ typedef unsigned int uid_t;
+#elif defined(__powerpc64__) || defined(__x86_64__)
+ typedef unsigned long dev_t;
+ typedef unsigned int gid_t;
+ typedef unsigned int mode_t;
+ typedef unsigned long nlink_t;
+ typedef unsigned int uid_t;
#endif
typedef signed int id_t; /* Used as a general identifier; can be
diff --git a/mdk-stage1/dietlibc/include/sys/ucontext.h b/mdk-stage1/dietlibc/include/sys/ucontext.h
index 573c6c7fb..c380cb3aa 100644
--- a/mdk-stage1/dietlibc/include/sys/ucontext.h
+++ b/mdk-stage1/dietlibc/include/sys/ucontext.h
@@ -6,7 +6,7 @@
typedef struct sigcontext mcontext_t;
-#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__mips64__) || defined(__powerpc__) || defined(__hppa__)
+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__mips64__) || defined(powerpc) || defined(__powerpc64__) || defined(__hppa__)
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
diff --git a/mdk-stage1/dietlibc/include/termios.h b/mdk-stage1/dietlibc/include/termios.h
index 12e02c5d7..24ea6ef04 100644
--- a/mdk-stage1/dietlibc/include/termios.h
+++ b/mdk-stage1/dietlibc/include/termios.h
@@ -101,7 +101,7 @@ struct termios {
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
};
-#elif defined(powerpc) || defined(__alpha__)
+#elif defined(powerpc) || defined(__powerpc64__) || defined(__alpha__)
#define NCCS 19
struct termios {
tcflag_t c_iflag; /* input mode flags */
@@ -165,7 +165,7 @@ struct termios {
#define VLNEXT 15
#define VEOF 16
#define VEOL 17
-#elif defined(__powerpc__)
+#elif defined(powerpc) || defined(__powerpc64__)
#define VINTR 0
#define VQUIT 1
#define VERASE 2
diff --git a/mdk-stage1/dietlibc/syscalls.h b/mdk-stage1/dietlibc/syscalls.h
index aa62f67a9..233921882 100644
--- a/mdk-stage1/dietlibc/syscalls.h
+++ b/mdk-stage1/dietlibc/syscalls.h
@@ -11,9 +11,12 @@
#include "sparc/syscalls.h"
#endif
-#elif defined(__powerpc__)
+#elif defined(powerpc)
#include "ppc/syscalls.h"
+#elif defined(__powerpc64__)
+#include "ppc64/syscalls.h"
+
#elif defined(__mips__)
#include "mips/syscalls.h"