This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: make existing mips files multi-ABI


Alexandre Oliva <aoliva at redhat dot com> writes:

> This patch adjusts most of the existing mips-specific files that need
> changes to become multi-ABI.

The patch in general is fine.  I just added a number of questions that
I'd like to have clarified first,


> [...]

> Index: sysdeps/mips/elf/start.S
> ===================================================================
> RCS file: /cvs/glibc/libc/sysdeps/mips/elf/start.S,v
> retrieving revision 1.13
> diff -u -p -r1.13 start.S
> --- sysdeps/mips/elf/start.S 9 Dec 2002 20:37:22 -0000 1.13
> +++ sysdeps/mips/elf/start.S 14 Mar 2003 09:30:26 -0000
> @@ -19,6 +19,7 @@
>  
>  #define __ASSEMBLY__ 1
>  #include <entry.h>
> +#include <sys/asm.h>
>  
>  #ifndef ENTRY_POINT
>  #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
> @@ -52,42 +53,41 @@
>  		      char **argv, void (*init) (void), void (*fini) (void),
>  		      void (*rtld_fini) (void), void *stack_end)
>  */
> -#ifdef __PIC__
> -/* A macro to (re)initialize gp. We can get the run time address of 0f in
> -   ra ($31) by blezal instruction. In this early phase, we can't save gp
> -   in stack and .cprestore doesn't work properly. So we set gp by using
> -   this macro. */
> -#define SET_GP \
> -	.set noreorder;	\
> -	bltzal $0,0f;	\
> -	nop;		\
> -0:	.cpload $31;	\
> -	.set reorder;
> -#endif
> -
> +	
>  	.text
>  	.globl ENTRY_POINT
>  	.type ENTRY_POINT,@function
>  ENTRY_POINT:
>  #ifdef __PIC__
> -	SET_GP
> +	SETUP_GPX($0)
> +	SETUP_GPX64($25,$0)

Is this change correct?  I didn't find the definition of SETUP_GP/GPX
directly.

>  #else
> -	la $28, _gp		/* Setup GP correctly if we're non-PIC.  */
> -#endif
> +	PTR_LA $28, _gp		/* Setup GP correctly if we're non-PIC.  */
>  	move $31, $0
> +#endif
>  
> -	la $4, main		/* main */
> -	lw $5, 0($29)		/* argc */
> -	addu $6, $29, 4		/* argv  */
> -	/* Allocate space on the stack for seven arguments and make sure
> -	   the stack is aligned to double words (8 bytes).  */
> -	and $29, 0xfffffff8
> -	subu $29, 32
> -	la $7, __libc_csu_init		/* init */
> -	la $8, __libc_csu_fini
> -	sw $8, 16($29)		/* fini */
> -	sw $2, 20($29)		/* rtld_fini */
> -	sw $29, 24($29)		/* stack_end */
> +	PTR_LA $4, main		/* main */
> +	PTR_L $5, 0($29)		/* argc */
> +	PTR_ADDIU $6, $29, PTRSIZE	/* argv  */
> +	
> +	/* Allocate space on the stack for seven arguments (o32 only)
> +	   and make sure the stack is aligned to double words (8 bytes) 
> +	   on o32 and quad words (16 bytes) on n32 and n64.  */
> +	
> +	and $29, -2 * SZREG
> +#if _MIPS_SIM == _MIPS_SIM_ABI32
> +	PTR_SUBIU $29, 32
> +#endif
> +	PTR_LA $7, __libc_csu_init		/* init */
> +	PTR_LA $8, __libc_csu_fini
> +#if _MIPS_SIM == _MIPS_SIM_ABI32
> +	PTR_S $8, 16($29)		/* fini */
> +	PTR_S $2, 20($29)		/* rtld_fini */
> +	PTR_S $29, 24($29)		/* stack_end */
> +#else
> +	move $9, $2		/* rtld_fini */
> +	move $10, $29		/* stack_end */
> +#endif
>  	jal __libc_start_main
>  hlt:	b hlt			/* Crash if somehow it does return.  */
>  


> Index: sysdeps/unix/sysv/linux/mips/bits/fcntl.h
> ===================================================================
> RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/fcntl.h,v
> retrieving revision 1.16
> diff -u -p -r1.16 fcntl.h
> --- sysdeps/unix/sysv/linux/mips/bits/fcntl.h 6 Jul 2001 04:56:18 -0000 1.16
> +++ sysdeps/unix/sysv/linux/mips/bits/fcntl.h 14 Mar 2003 09:30:28 -0000
> @@ -1,5 +1,6 @@
>  /* O_*, F_*, FD_* bit values for Linux.
> -   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
> +   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003
> +	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
> @@ -142,13 +143,15 @@ typedef struct flock
>  #ifndef __USE_FILE_OFFSET64
>      __off_t l_start;	/* Offset where the lock begins.  */
>      __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
> -    long int l_sysid;	/* XXX */
>  #else
>      __off64_t l_start;	/* Offset where the lock begins.  */
>      __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
>  #endif
> +#if ! defined __USE_FILE_OFFSET64 || _MIPS_SIM != _MIPS_SIM_ABI32
> +    long int l_sysid;
> +#endif
>      __pid_t l_pid;	/* Process holding the lock.  */
> -#ifndef __USE_FILE_OFFSET64
> +#if ! defined __USE_FILE_OFFSET64 || _MIPS_SIM != _MIPS_SIM_ABI32
>      long int pad[4];	/* XXX */

I don't like the XXX here...
>  #endif
>  } flock_t;
> @@ -160,7 +163,13 @@ struct flock64
>      short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
>      __off64_t l_start;	/* Offset where the lock begins.  */
>      __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
> +#if _MIPS_SIM != _MIPS_SIM_ABI32
> +    long int l_sysid;
> +#endif
>      __pid_t l_pid;	/* Process holding the lock.  */
> +#if _MIPS_SIM != _MIPS_SIM_ABI32
> +    long int pad[4];	/* XXX */

and here.  What's the problem?

> +#endif
>    };
>  #endif
>  
> Index: sysdeps/unix/sysv/linux/mips/bits/stat.h
> ===================================================================
> RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/stat.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 stat.h
> --- sysdeps/unix/sysv/linux/mips/bits/stat.h 6 Jul 2001 04:56:18 -0000 1.12
> +++ sysdeps/unix/sysv/linux/mips/bits/stat.h 14 Mar 2003 09:30:28 -0000
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
> +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
> +	2003 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
> @@ -80,15 +81,15 @@ struct stat
>  #ifdef __USE_LARGEFILE64
>  struct stat64
>    {
> -    unsigned long int st_dev;
> -    long int st_pad1[3];
> +    unsigned int st_dev;
Can we change this to __dev_t

> +    int st_pad1[3];
>      __ino64_t st_ino;		/* File serial number.		*/
>      __mode_t st_mode;		/* File mode.  */
>      __nlink_t st_nlink;		/* Link count.  */
>      __uid_t st_uid;		/* User ID of the file's owner.	*/
>      __gid_t st_gid;		/* Group ID of the file's group.*/
> -    unsigned long int st_rdev;	/* Device number, if device.  */
> -    long int st_pad2[3];
> +    unsigned int st_rdev;	/* Device number, if device.  */

And also here?  That would be following Posix.

> +    int st_pad2[3];
>      __off64_t st_size;		/* Size of file, in bytes.  */
>      /*
>       * Actually this should be timestruc_t st_atime, st_mtime and

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj at suse dot de
   private aj at arthur dot inka dot de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]