diff options
Diffstat (limited to 'libc/sysdeps/linux/powerpc')
| -rw-r--r-- | libc/sysdeps/linux/powerpc/__syscall_error.c | 4 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/fcntl.h | 9 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/ioctl-types.h | 74 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/ipc.h | 8 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/kernel_stat.h | 10 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/msq.h | 10 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/sem.h | 24 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/shm.h | 20 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/stat.h | 12 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/bits/termios.h | 48 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/crt1.S | 23 | ||||
| -rw-r--r-- | libc/sysdeps/linux/powerpc/sys/procfs.h | 2 | 
12 files changed, 156 insertions, 88 deletions
diff --git a/libc/sysdeps/linux/powerpc/__syscall_error.c b/libc/sysdeps/linux/powerpc/__syscall_error.c index 5e109a83b..af26cf6ab 100644 --- a/libc/sysdeps/linux/powerpc/__syscall_error.c +++ b/libc/sysdeps/linux/powerpc/__syscall_error.c @@ -10,8 +10,8 @@  /* This routine is jumped to by all the syscall handlers, to stash   * an error number into errno.  */ -int __syscall_error(int err_no) attribute_hidden; -int __syscall_error(int err_no) +long __syscall_error(int err_no) attribute_hidden; +long __syscall_error(int err_no)  {  	__set_errno(err_no);  	return -1; diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h index 30f1e4e21..54e4894ec 100644 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h @@ -54,6 +54,7 @@  # define O_DIRECT	0400000	/* Direct disk access.	*/  # define O_NOATIME     01000000 /* Do not set atime.  */  # define O_PATH       010000000 /* Resolve pathname but do not open file.  */ +# define O_TMPFILE    020040000 /* Atomically create nameless file.  */  #endif  #ifdef __USE_LARGEFILE64 @@ -101,11 +102,13 @@  # define F_SETLEASE	1024	/* Set a lease.	 */  # define F_GETLEASE	1025	/* Enquire what lease is active.  */  # define F_NOTIFY	1026	/* Request notfications on a directory.	 */ -# define F_DUPFD_CLOEXEC 1030	/* Duplicate file descriptor with -				   close-on-exit set on new fd.  */  # define F_SETPIPE_SZ	1031    /* Set pipe page size array.  */  # define F_GETPIPE_SZ	1032    /* Get pipe page size array.  */  #endif +#if defined __USE_XOPEN2K8 || defined __USE_GNU +# define F_DUPFD_CLOEXEC 1030	/* Duplicate file descriptor with +				   close-on-exit set on new fd.  */ +#endif  /* For F_[GET|SET]FD.  */  #define FD_CLOEXEC	1	/* actually anything with low bit set goes */ @@ -242,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,  #endif  __END_DECLS +/* Include generic Linux declarations.  */ +#include <bits/fcntl-linux.h> diff --git a/libc/sysdeps/linux/powerpc/bits/ioctl-types.h b/libc/sysdeps/linux/powerpc/bits/ioctl-types.h index 87b8265af..926061fa8 100644 --- a/libc/sysdeps/linux/powerpc/bits/ioctl-types.h +++ b/libc/sysdeps/linux/powerpc/bits/ioctl-types.h @@ -1,5 +1,77 @@ +/* Structure types for pre-termios terminal ioctls.  Linux/powerpc version. +   Copyright (C) 2014-2019 Free Software Foundation, Inc. +   This file is part of the GNU C Library. + +   The GNU C Library is free software; you can redistribute it and/or +   modify it under the terms of the GNU Lesser General Public +   License as published by the Free Software Foundation; either +   version 2.1 of the License, or (at your option) any later version. + +   The GNU C Library is distributed in the hope that it will be useful, +   but WITHOUT ANY WARRANTY; without even the implied warranty of +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +   Lesser General Public License for more details. + +   You should have received a copy of the GNU Lesser General Public +   License along with the GNU C Library; if not, see +   <http://www.gnu.org/licenses/>.  */ +  #ifndef _SYS_IOCTL_H  # error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."  #endif -#include <termios.h> +/* Get definition of constants for use with `ioctl'.  */ +#include <asm/ioctls.h> + + +struct winsize +  { +    unsigned short int ws_row; +    unsigned short int ws_col; +    unsigned short int ws_xpixel; +    unsigned short int ws_ypixel; +  }; + +#define NCC 10 +struct termio +  { +    unsigned short int c_iflag;		/* input mode flags */ +    unsigned short int c_oflag;		/* output mode flags */ +    unsigned short int c_cflag;		/* control mode flags */ +    unsigned short int c_lflag;		/* local mode flags */ +    unsigned char c_line;		/* line discipline */ +    unsigned char c_cc[NCC];		/* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE	0x001 +#define TIOCM_DTR	0x002 +#define TIOCM_RTS	0x004 +#define TIOCM_ST	0x008 +#define TIOCM_SR	0x010 +#define TIOCM_CTS	0x020 +#define TIOCM_CAR	0x040 +#define TIOCM_RNG	0x080 +#define TIOCM_DSR	0x100 +#define TIOCM_CD	TIOCM_CAR +#define TIOCM_RI	TIOCM_RNG + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY		0 +#define N_SLIP		1 +#define N_MOUSE		2 +#define N_PPP		3 +#define N_STRIP		4 +#define N_AX25		5 +#define N_X25		6	/* X.25 async  */ +#define N_6PACK		7 +#define N_MASC		8	/* Mobitex module  */ +#define N_R3964		9	/* Simatic R3964 module  */ +#define N_PROFIBUS_FDL	10	/* Profibus  */ +#define N_IRDA		11	/* Linux IR  */ +#define N_SMSBLOCK	12	/* SMS block mode  */ +#define N_HDLC		13	/* synchronous HDLC  */ +#define N_SYNC_PPP	14	/* synchronous PPP  */ +#define	N_HCI		15	/* Bluetooth HCI UART  */ diff --git a/libc/sysdeps/linux/powerpc/bits/ipc.h b/libc/sysdeps/linux/powerpc/bits/ipc.h index e21debf5d..f40ffbc24 100644 --- a/libc/sysdeps/linux/powerpc/bits/ipc.h +++ b/libc/sysdeps/linux/powerpc/bits/ipc.h @@ -50,12 +50,12 @@ struct ipc_perm  #if 0      unsigned long __seq;	/* Sequence number. */      unsigned int __pad2; -    unsigned long long int __unused1; -    unsigned long long int __unused2; +    unsigned long long int __uclibc_unused1; +    unsigned long long int __uclibc_unused2;  #else      __uint32_t __seq;		/* Sequence number.  */      __uint32_t __pad1; -    __uint64_t __unused1; -    __uint64_t __unused2; +    __uint64_t __uclibc_unused1; +    __uint64_t __uclibc_unused2;  #endif    }; diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h index 579b5b4e2..023eefeea 100644 --- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h @@ -39,11 +39,11 @@ struct kernel_stat64 {  	long long st_size;		/* Size of file, in bytes.  */  	long st_blksize;		/* Optimal block size for I/O.  */  	long long st_blocks;		/* Number 512-byte blocks allocated. */ -	struct timespec st_atim;	/* Time of last access.  */ -	struct timespec st_mtim;	/* Time of last modification.  */ -	struct timespec st_ctim;	/* Time of last status change.  */ -	unsigned long int __unused4; -	unsigned long int __unused5; +	struct timespec	st_atim; +	struct timespec	st_mtim; +	struct timespec	st_ctim; +	unsigned long int __uclibc_unused4; +	unsigned long int __uclibc_unused5;  };  #endif	/*  _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/powerpc/bits/msq.h b/libc/sysdeps/linux/powerpc/bits/msq.h index 70d4f06e3..995f5157b 100644 --- a/libc/sysdeps/linux/powerpc/bits/msq.h +++ b/libc/sysdeps/linux/powerpc/bits/msq.h @@ -38,15 +38,15 @@ struct msqid_ds  {    struct ipc_perm msg_perm;    /* structure describing operation permission */  #if __WORDSIZE == 32 -  unsigned int __unused1; +  unsigned int __uclibc_unused1;  #endif    __time_t msg_stime;          /* time of last msgsnd command */  #if __WORDSIZE == 32 -  unsigned int __unused2; +  unsigned int __uclibc_unused2;  #endif    __time_t msg_rtime;          /* time of last msgrcv command */  #if __WORDSIZE == 32 -  unsigned int __unused3; +  unsigned int __uclibc_unused3;  #endif    __time_t msg_ctime;          /* time of last change */    unsigned long __msg_cbytes; /* current number of bytes on queue */ @@ -54,8 +54,8 @@ struct msqid_ds    msglen_t msg_qbytes;         /* max number of bytes allowed on queue */    __pid_t msg_lspid;           /* pid of last msgsnd() */    __pid_t msg_lrpid;           /* pid of last msgrcv() */ -  unsigned long __unused4; -  unsigned long __unused5; +  unsigned long __uclibc_unused4; +  unsigned long __uclibc_unused5;  };  #ifdef __USE_MISC diff --git a/libc/sysdeps/linux/powerpc/bits/sem.h b/libc/sysdeps/linux/powerpc/bits/sem.h index 271a607ca..8d338eac0 100644 --- a/libc/sysdeps/linux/powerpc/bits/sem.h +++ b/libc/sysdeps/linux/powerpc/bits/sem.h @@ -35,23 +35,39 @@  #define SETALL         17              /* set all semval's */ +  /* Data structure describing a set of semaphores.  */  struct semid_ds  {    struct ipc_perm sem_perm;            /* operation permission struct */  #if __WORDSIZE == 32 -  unsigned int __unused1; +  unsigned int __uclibc_unused1;  #endif +#if defined(__UCLIBC_USE_TIME64__) +  unsigned long int __sem_otime_internal_1; /* last semop() time */ +  unsigned long int __sem_otime_internal_2; +#else    __time_t sem_otime;                  /* last semop() time */ +#endif  #if __WORDSIZE == 32 -  unsigned int __unused2; +  unsigned int __uclibc_unused2;  #endif +#if defined(__UCLIBC_USE_TIME64__) +  unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */ +  unsigned long int __sem_ctime_internal_2; +#else    __time_t sem_ctime;                  /* last time changed by semctl() */ +#endif    unsigned long int sem_nsems;         /* number of semaphores in set */ -  unsigned long __unused3; -  unsigned long __unused4; +#if defined(__UCLIBC_USE_TIME64__) +  __time_t sem_otime; +  __time_t sem_ctime; +#endif +  unsigned long __uclibc_unused3; +  unsigned long __uclibc_unused4;  }; +  /* The user should define a union like the following to use it for arguments     for `semctl'. diff --git a/libc/sysdeps/linux/powerpc/bits/shm.h b/libc/sysdeps/linux/powerpc/bits/shm.h index 63e7f6ed1..7ba17f8ad 100644 --- a/libc/sysdeps/linux/powerpc/bits/shm.h +++ b/libc/sysdeps/linux/powerpc/bits/shm.h @@ -50,26 +50,26 @@ struct shmid_ds    {      struct ipc_perm shm_perm;          /* operation permission struct */  #if __WORDSIZE == 32 -    unsigned int __unused1; +    unsigned int __uclibc_unused1;  #endif      __time_t shm_atime;                        /* time of last shmat() */  #if __WORDSIZE == 32 -    unsigned int __unused2; +    unsigned int __uclibc_unused2;  #endif      __time_t shm_dtime;                        /* time of last shmdt() */  #if __WORDSIZE == 32 -    unsigned int __unused3; +    unsigned int __uclibc_unused3;  #endif      __time_t shm_ctime;			/* time of last change by shmctl() */  #if __WORDSIZE == 32 -    unsigned int __unused4; +    unsigned int __uclibc_unused4;  #endif      size_t shm_segsz;                  /* size of segment in bytes */      __pid_t shm_cpid;                  /* pid of creator */      __pid_t shm_lpid;                  /* pid of last shmop */      shmatt_t shm_nattch;               /* number of current attaches */ -    unsigned long __unused5; -    unsigned long __unused6; +    unsigned long __uclibc_unused5; +    unsigned long __uclibc_unused6;    };  #ifdef __USE_MISC @@ -91,10 +91,10 @@ struct shminfo      unsigned long int shmmni;      unsigned long int shmseg;      unsigned long int shmall; -    unsigned long int __unused1; -    unsigned long int __unused2; -    unsigned long int __unused3; -    unsigned long int __unused4; +    unsigned long int __uclibc_unused1; +    unsigned long int __uclibc_unused2; +    unsigned long int __uclibc_unused3; +    unsigned long int __uclibc_unused4;    };  struct shm_info diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h index a90043f8a..ce2ebf896 100644 --- a/libc/sysdeps/linux/powerpc/bits/stat.h +++ b/libc/sysdeps/linux/powerpc/bits/stat.h @@ -59,7 +59,7 @@ struct stat  # else      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */  # endif -#ifdef __USE_MISC +#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)      /* Nanosecond resolution timestamps are stored in a format         equivalent to 'struct timespec'.  This is the type used         whenever possible but the Unix namespace rules do not allow the @@ -80,8 +80,8 @@ struct stat      __time_t st_ctime;			/* Time of last status change.  */      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */  #endif -    unsigned long int __unused4; -    unsigned long int __unused5; +    unsigned long int __uclibc_unused4; +    unsigned long int __uclibc_unused5;    }; @@ -99,7 +99,7 @@ struct stat64      __off64_t st_size;			/* Size of file, in bytes.  */      __blksize_t st_blksize;		/* Optimal block size for I/O.  */      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC +#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)      /* Nanosecond resolution timestamps are stored in a format         equivalent to 'struct timespec'.  This is the type used         whenever possible but the Unix namespace rules do not allow the @@ -120,8 +120,8 @@ struct stat64      __time_t st_ctime;			/* Time of last status change.  */      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */  #endif -    unsigned long int __unused4; -    unsigned long int __unused5; +    unsigned long int __uclibc_unused4; +    unsigned long int __uclibc_unused5;    };  # endif /* __USE_LARGEFILE64 */ diff --git a/libc/sysdeps/linux/powerpc/bits/termios.h b/libc/sysdeps/linux/powerpc/bits/termios.h index ffd99a5e2..83380685f 100644 --- a/libc/sysdeps/linux/powerpc/bits/termios.h +++ b/libc/sysdeps/linux/powerpc/bits/termios.h @@ -256,23 +256,6 @@ struct ltchars {  #define TIOCPKT_NOSTOP		16  #define TIOCPKT_DOSTOP		32 -struct winsize { -	unsigned short ws_row; -	unsigned short ws_col; -	unsigned short ws_xpixel; -	unsigned short ws_ypixel; -}; - -#define NCC 10 -struct termio { -	unsigned short c_iflag;		/* input mode flags */ -	unsigned short c_oflag;		/* output mode flags */ -	unsigned short c_cflag;		/* control mode flags */ -	unsigned short c_lflag;		/* local mode flags */ -	unsigned char c_line;		/* line discipline */ -	unsigned char c_cc[NCC];	/* control characters */ -}; -  /* c_cc characters */  #define _VINTR	0  #define _VQUIT	1 @@ -285,36 +268,5 @@ struct termio {  #define _VEOL2	8  #define _VSWTC	9 -/* modem lines */ -#define TIOCM_LE	0x001 -#define TIOCM_DTR	0x002 -#define TIOCM_RTS	0x004 -#define TIOCM_ST	0x008 -#define TIOCM_SR	0x010 -#define TIOCM_CTS	0x020 -#define TIOCM_CAR	0x040 -#define TIOCM_RNG	0x080 -#define TIOCM_DSR	0x100 -#define TIOCM_CD	TIOCM_CAR -#define TIOCM_RI	TIOCM_RNG -  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */  #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */ - -/* line disciplines */ -#define N_TTY		0 -#define N_SLIP		1 -#define N_MOUSE		2 -#define N_PPP		3 -#define N_STRIP		4 -#define N_AX25		5 -#define N_X25		6	/* X.25 async  */ -#define N_6PACK		7 -#define N_MASC		8	/* Mobitex module  */ -#define N_R3964		9	/* Simatic R3964 module  */ -#define N_PROFIBUS_FDL	10	/* Profibus  */ -#define N_IRDA		11	/* Linux IR  */ -#define N_SMSBLOCK	12	/* SMS block mode  */ -#define N_HDLC		13	/* synchronous HDLC  */ -#define N_SYNC_PPP	14	/* synchronous PPP  */ -#define	N_HCI		15	/* Bluetooth HCI UART  */ diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S index 27bfc5a5a..3ac32636c 100644 --- a/libc/sysdeps/linux/powerpc/crt1.S +++ b/libc/sysdeps/linux/powerpc/crt1.S @@ -41,6 +41,9 @@  	.weak _init  	.weak _fini  #endif +#ifdef L_rcrt1 +	.type reloc_static_pie,%function +#endif  	.type	main,%function  	.type	__uClibc_main,%function @@ -57,6 +60,26 @@ _start:  	bl	_GLOBAL_OFFSET_TABLE_-4@local  	mflr	r31  # endif +	/* in PIC/PIE, plt stubs need r30 to point to the GOT if using secure-plt */ +# ifdef PPC_HAS_SECUREPLT +	mr	30,31 +# endif +#ifdef L_rcrt1 +	stwu r3, -4(r1)					/* Save r3 */ +	stwu r9, -16(r1)				/* Save r9 */ +	bcl 20,31,2f					/* Jump to label 2 */ +2:	mflr r3							/* Load lr into r3 */ +	addis r3, r3, _DYNAMIC-2b@ha	/* Add high half of _DYNAMIC to r3 */ +	addi r3,r3,_DYNAMIC-2b@l		/* Add low half of _DYNAMIC */ +	lwz r4, 0(r31)					/* load _DYNAMIC from the GOT */ +	subf r3, r4, r3					/* sub _DYNAMIC@got and it's actual address */ +	bl reloc_static_pie				/* Call reloc_static_pie */ +	lwzu r9, 0(r1)					/* restore r9 */ +	addi r1, r1, 16					/* update stack pointer */ +	lwzu r3, 0(r1)					/* restore r3 */ +	addi r1, r1, 4					/* update stack pointer */ +	li r5, 0						/* zero r5 */ +#endif  #endif  	/* Set up the small data pointer in r13.  */  #ifdef __PIC__ diff --git a/libc/sysdeps/linux/powerpc/sys/procfs.h b/libc/sysdeps/linux/powerpc/sys/procfs.h index 7ae12e3cc..9e6ec191c 100644 --- a/libc/sysdeps/linux/powerpc/sys/procfs.h +++ b/libc/sysdeps/linux/powerpc/sys/procfs.h @@ -34,7 +34,7 @@ __BEGIN_DECLS  /* These definitions are normally provided by ucontext.h via     asm/sigcontext.h, asm/ptrace.h, and asm/elf.h.  Otherwise we define     them here.  */ -#ifndef __PPC64_ELF_H +#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H  #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */  #define ELF_NFPREG      33      /* includes fpscr */  #if __WORDSIZE == 32  | 
