This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: Adding SH support to glibc-2.1.3


>>>>> kaz Kojima writes:

 > Hi,
 > Here's a patch for glibc-2.1.3 to support new sh-linux-gnu target for
 > Linux on Hitachi SH processors.
 > We've already done the paper work for copyright assignment, and got back
 > the copy from FSF.

 > Patch consists of two parts.  One is for changes of generic part, and
 > another is SH specific part.  For the changes of generic part, there
 > are four diffs.  First three diffs are trivial, just add sh[34]
 > support.  We need the 4-th diff for csu/Makefile to get cststuff
 > routines directly.  This is needed because we couldn't use generated
 > files.   The constant (for label) is emitted far away than expected
 > by the generation, after the function epilogue.

 > Sorry for this long patch. Any comments are appreciated.

 > Thanks,

Here're the promised comments:
- Please send one patch with only sh-patches (sysdeps/sh etc).
- Send the other patches separatly and describe why they're needed.
  You can start sending these patches in already, no need to wait
  until everything is finished.
- As I've said already, please make the patches against 2.2.  Please
  note that some internals in glibc have changed, you need to rewrite
  some of your patches.
- you want to look at shlib-versions and add the neccessary lines to
  remove old compatibility code like it has been done for ia64.
- In glibc 2.2 some new constants and interface have been added to
  e.g. mman.h.  Please check all your header files with the current
  version in glibc (the i386 is probably the best version to synch
  with).

> 2000-05-25  Kazumoto Kojima  <kkojima@rr.iij4u.or.jp>
>             Yutaka Niibe  <gniibe@chroot.org>
> 
>         * configure.in: Add machine sh3, sh4.
>         * configure: Likewise
configure is regenerated, no need to send a patch
>         * scripts/config.sub: Likewise.
Please send patches for config.sub to the maintainer.  When your patch
is accepted, we merge config.sub from the central archive at:
:pserver:anoncvs@subversions.gnu.org:/home/cvs (module config)
The mailaddress is <config-patches@gnu.org>.
>         * csu/Makefile: Add new variable crts-predefined whose non-zero
>         value means to generate crt[in].o from system dependent predefined
>         crt[in].S instead of initfini.c.
> 
>         * elf/elf.h: Add SH specific declarations of relocations.
>         * sysdeps/sh/Dist: New file.
>         * sysdeps/sh/Implies: New file.
>         * sysdeps/sh/gmp-mparam.h: New file for SH specific definitions
>         for GNU MP library.
>         * sysdeps/sh/machine-gmon.h: New file for SH specific definitions
>         for profiling support.
>         * sysdeps/sh/memcpy.S: New file for memcpy function written in
>         assembler.
>         * sysdeps/sh/memset.S: Likewise for memset.
>         * sysdeps/sh/strlen.S: Likewise for strlen.
>         * sysdeps/sh/sysdep.h: New file for SH specific assembler macros.
> 
>         * sysdeps/sh/sh3/__longjmp.S: New file for SH-3 specific __longjmp
>         function written in assembler.
>         * sysdeps/sh/sh3/bits/endian.h: New file for SH-3 specific
>         definitions for endian.
>         * sysdeps/sh/sh3/bits/huge_val.h: New file for SH-3 specific
>         definitions for HUGE_VAL constant.
>         * sysdeps/sh/sh3/bits/setjmp.h: New file for SH-3 specific
>         definitions for jmp_buf.
>         * sysdeps/sh/sh3/bsd-_setjmp.S: New file for SH-3 specific
>         BSD _setjmp function written in assembler.
>         * sysdeps/sh/sh3/bsd-setjmp.S: Likewise for setjmp.
>         * sysdeps/sh/sh3/dl-machine.h: New file for SH-3 specific
>         ELF dynamic location inline functions.
>         * sysdeps/sh/sh3/elf/crti.S: Likewise for _init and _fini
>         function prologue.
>         * sysdeps/sh/sh3/elf/crti.S: Likewise for their epilogue and
>         __gmon_start__ function.
>         * sysdeps/sh/sh3/elf/start.S: New file for the startup code
>         for  SH-3 in ELF.
>         * sysdeps/sh/sh3/setjmp.S: New file for SH specific __setjmp
>         and __sigsetjmp functions written in assembler.
>         * sysdeps/sh/sh3/sys/ucontext.h: New file for SH-3 specific
>         definitions for user context.
> 
>         * sysdeps/sh/sh4/__longjmp.S: New file for SH-4 specific __longjmp
>         function written in assembler.
>         * sysdeps/sh/sh4/bits/endian.h: New file for SH-4 specific
>         definitions for endian.
>         * sysdeps/sh/sh4/bits/huge_val.h: New file for SH-4 specific
>         definitions for HUGE_VAL constant.
>         * sysdeps/sh/sh4/bits/setjmp.h: New file for SH-4 specific
>         definitions for jmp_buf.
>         * sysdeps/sh/sh4/bsd-_setjmp.S: New file for SH-4 specific
>         BSD _setjmp function written in assembler.
>         * sysdeps/sh/sh4/bsd-setjmp.S: Likewise for setjmp.
>         * sysdeps/sh/sh4/dl-machine.h: New file for SH-4 specific
>         ELF dynamic location inline functions.
>         * sysdeps/sh/sh4/elf/crti.S: Likewise for _init and _fini
>         function prologue.
>         * sysdeps/sh/sh4/elf/crti.S: Likewise for their epilogue and
>         __gmon_start__ function.
>         * sysdeps/sh/sh4/elf/start.S: New file for the startup code
>         for  SH-4 in ELF.
>         * sysdeps/sh/sh4/setjmp.S: New file for SH specific __setjmp
>         and __sigsetjmp functions written in assembler.
>         * sysdeps/sh/sh4/sys/ucontext.h: New file for SH-4 specific
>         definitions for user context.
>         * sysdeps/sh/sh4/fpu/bits/fenv.h: New file for SH-4 specific
>         definitions for FPU.
>         * sysdeps/sh/sh4/fpu/fclrexcpt.c: New file for SH-4 specific
>         feclearexcept function.
>         * sysdeps/sh/sh4/fpu/fegetenv.c: Likewise for fegetenv.
>         * sysdeps/sh/sh4/fpu/fegetround.c: Likewise for fegetround.
>         * sysdeps/sh/sh4/fpu/feholdexcpt.c: Likewise for feholdexcept.
>         * sysdeps/sh/sh4/fpu/fesetenv.c: Likewise for fesetenv.
>         * sysdeps/sh/sh4/fpu/fesetround.c: Likewise for fesetround.
>         * sysdeps/sh/sh4/fpu/fraiseexcpt.c: Likewise for feraiseexcept.
>         * sysdeps/sh/sh4/fpu/fsetexcptflg.c: Likewise for fesetexceptflag.
>         * sysdeps/sh/sh4/fpu/ftestexcept.c: Likewise for fetestexcept.
>         * sysdeps/sh/sh4/fpu/fpu_control.h: New file for SH-4 specific
>         FPU control word definitions.
> 
>         * sysdeps/unix/sh/sysdep.S: New file for SH specific __syscall_error
>         function in unix.
>         * /sysdeps/unix/sh/sysdep.h: New file for SH specific miscellaneous
>         definitions in unix.
>         * sysdeps/unix/sysv/linux/sh/Dist: New file.
>         * sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
>         * sysdeps/unix/sysv/linux/sh/Versions: Likewise.
>         * sysdeps/unix/sysv/linux/sh/bits/mman.h: New file for Linux/SH
>         specific definitions for mmap interface.
>         * sysdeps/unix/sysv/linux/sh/sysdep.S: New files for Linux/SH
>         specific definitions for system call and errno.
>         * sysdeps/unix/sysv/linux/sh/brk.c: New file for Linux/SH specific
>         definitions for brk function.
>         * sysdeps/unix/sysv/linux/sh/clone.S: Likewise for clone.
>         * sysdeps/unix/sysv/linux/sh/pipe.S: Likewise for pipe.
>         * sysdeps/unix/sysv/linux/sh/socket.S: Likewise for socket.
>         * sysdeps/unix/sysv/linux/sh/vfork.S: Likewise for vfork.
>         * sysdeps/unix/sysv/linux/sh/sigrestorer.S: Likewise for signal
>         restorers.
>         * sysdeps/unix/sysv/linux/sh/getgroups.c: Likewise for getgroups.
>         * sysdeps/unix/sysv/linux/sh/pread.c: Likewise for pread.
>         * sysdeps/unix/sysv/linux/sh/pread64.c: Likewise for pread64.
>         * sysdeps/unix/sysv/linux/sh/pwrite.c: Likewise for pwrite.
>         * sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise for pwrite64.
Can you use the general version?  We've just made changes in glibc 2.2
for pread/pwrite{64}.
>         * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise for setgid.
>         * sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise for seteuid.
>         * sysdeps/unix/sysv/linux/sh/setfsgid.c: Likewise for setfsgid.
>         * sysdeps/unix/sysv/linux/sh/setfsuid.c: Likewise for setfsuid.
>         * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise for setgid.
>         * sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise for setgroups.
>         * sysdeps/unix/sysv/linux/sh/setregid.c: Likewise for setregid.
>         * sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise for setresgid.
>         * sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise for setresuid.
>         * sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise for setreuid.
>         * sysdeps/unix/sysv/linux/sh/setuid.c: Likewise for setuid.
>         * sysdeps/unix/sysv/linux/sh/errlist.c:  New file for Linux/SH
>         specific definitions for errlist.
>         * sysdeps/unix/sysv/linux/sh/errlist.c:  Likewise for siglist.
>         * sysdeps/unix/sysv/linux/sh/sigaction.c: New file for Linux/SH
>         specific definitions for sigaction.
>         * /sysdeps/unix/sysv/linux/sh/init-first.h: New file for Linux/SH
>         specific definitions for library initialization.
>         * sysdeps/unix/sysv/linux/sh/profil-counter.h: New file for Linux/SH
>         specific definitions for profiling support.
>         * sysdeps/unix/sysv/linux/sh/register-dump.h: New file for Linux/SH
>         specific definitions for register dump.
>         * sysdeps/unix/sysv/linux/sh/sigcontextinfo.h: New file for Linux/SH
>         specific definitions for signal context.
>         * sysdeps/unix/sysv/linux/sh/sys/io.h: New file for Linux/SH specific
>         definitions for low level I/O.
>         * sysdeps/unix/sysv/linux/sh/sys/user.h: New file for Linux/SH
>         specific definitions for low level user context.
>         * sysdeps/unix/sysv/linux/sh/syscalls.list: New file for Linux/SH
>         specific system call list.
> 
>         * linuxthreads/sysdeps/sh/pt-machine.h: New file for SH specific
>         definitions in linuxthreads.
> 
> 
Unfortunatly for glibc 2.2 you need also some more files.

[..]
> diff -u -r -N glibc-2.1.3-original/sysdeps/sh/bits/string.h glibc-2.1.3/sysdeps/sh/bits/string.h
> --- glibc-2.1.3-original/sysdeps/sh/bits/string.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/sh/bits/string.h	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,22 @@
> +/* SH specific definitions for string functions.
> +   Copyright (C) 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#define _HAVE_STRING_ARCH_strcpy 1
> +#define _HAVE_STRING_ARCH_stpcpy 1
> +#define _HAVE_STRING_ARCH_mempcpy 1

This doesn't look right to me.  

[...]
> diff -u -r -N glibc-2.1.3-original/sysdeps/sh/sh3/dl-machine.h glibc-2.1.3/sysdeps/sh/sh3/dl-machine.h
> --- glibc-2.1.3-original/sysdeps/sh/sh3/dl-machine.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/sh/sh3/dl-machine.h	Sun Mar 12 16:02:39 2000
> @@ -0,0 +1,523 @@
> +/* Machine-dependent ELF dynamic relocation inline functions.  SH-3 version.
> +   Copyright (C) 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.	*/
> +
> +#ifndef dl_machine_h
> +#define dl_machine_h
> +
> +/* Only dummy. This doesn't work. */
> +
> +#define ELF_MACHINE_NAME "SH"
> +
> +#include <sys/param.h>
> +
> +#include <assert.h>
> +
> +/* Return nonzero iff E_MACHINE is compatible with the running host.  */
> +static inline int __attribute__ ((unused))
> +elf_machine_matches_host (Elf32_Half e_machine)
> +{
> +  switch (e_machine)
> +    {
> +    case EM_SH:
> +      return 1;
> +    default:
> +      return 0;
> +    }
> +}
> +
> +
> +/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
> +   first element of the GOT.  This must be inlined in a function which
> +   uses global data.  */
> +static inline Elf32_Addr __attribute__ ((unused))
> +elf_machine_dynamic (void)
> +{
> +  register Elf32_Addr *got;
> +  asm ("mov r12,%0" :"=r" (got));
> +  return *got;
> +}
> +
> +
> +/* Return the run-time load address of the shared object.  */
> +static inline Elf32_Addr __attribute__ ((unused))
> +elf_machine_load_address (void)
> +{
> +  Elf32_Addr addr;
> +  asm ("mov.l .L1,r0
> +	mov.l .L3,r2
> +	add r12,r2
> +	mov.l @(r0,r12),r0
> +	bra .L2
> +	 sub r0,r2
> +	.align 2
> +	.L1: .long _dl_start@GOT
> +	.L3: .long _dl_start@GOTOFF
> +	.L2: mov r2,%0"
> +       : "=r" (addr) : : "r0", "r1", "r2");
> +  return addr;
> +}
> +
> +
> +/* Set up the loaded object described by L so its unrelocated PLT
> +   entries will jump to the on-demand fixup code in dl-runtime.c.  */
> +
> +static inline int __attribute__ ((unused))
> +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
> +{
> +  Elf32_Addr *got;
> +  extern void _dl_runtime_resolve (Elf32_Word);
> +  extern void _dl_runtime_profile (Elf32_Word);
> +
> +  if (l->l_info[DT_JMPREL] && lazy)
> +    {
> +      /* The GOT entries for functions in the PLT have not yet been filled
> +	 in.  Their initial contents will arrange when called to load an
> +	 offset into the .rela.plt section and _GLOBAL_OFFSET_TABLE_[1],
> +	 and then jump to _GLOBAL_OFFSET_TABLE[2].  */
> +      got = (Elf32_Addr *) l->l_info[DT_PLTGOT]->d_un.d_ptr;
> +      got[1] = (Elf32_Addr) l;	/* Identify this shared object.	 */
> +
> +      /* The got[2] entry contains the address of a function which gets
> +	 called to get the address of a so far unresolved function and
> +	 jump to it.  The profiling extension of the dynamic linker allows
> +	 to intercept the calls to collect information.	 In this case we
> +	 don't store the address in the GOT so that all future calls also
> +	 end in this function.	*/
> +      if (profile)
> +	{
> +	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
> +	  /* Say that we really want profiling and the timers are started.  */
> +	  _dl_profile_map = l;
> +	}
> +      else
> +	/* This function will get called to fix up the GOT entry indicated by
> +	   the offset on the stack, and then jump to the resolved address.  */
> +	got[2] = (Elf32_Addr) &_dl_runtime_resolve;
> +    }
> +  return lazy;
> +}
> +
> +/* This code is used in dl-runtime.c to call the `fixup' function
> +   and then redirect to the address it returns.	 */
> +
> +#define ELF_MACHINE_RUNTIME_FIXUP_ARGS int plt_type
> +
> +#ifdef PIC
Either use __PIC__ or SHARED.
> +#define FUN_ADDR	"\
> +	mov.l 1f,r2
> +	mova 1f,r0
> +        bra 2f
> +	 add r0,r2		! Get GOT address in r2
> +0:	.align 2
> +1:	.long _GLOBAL_OFFSET_TABLE_
> +2:	mov.l 3f,r0
> +	add r2,r0"
> +#define GOTJMP(x)	#x "@GOTOFF"
> +#else
> +#define FUN_ADDR	"\
> +	mov.l 3f,r0"
> +#define GOTJMP(x)	#x
> +#endif
> +
> +#if defined (KERNEL_MATH_EMULATION)
> +#define FGR_SAVE	"\
> +	sts.l	fpscr, @-r15
> +	mov	#8,r3
> +	swap.w	r3, r3
> +	lds	r3, fpscr
> +	fmov.s	fr11, @-r15
> +	fmov.s	fr10, @-r15
> +	fmov.s	fr9, @-r15
> +	fmov.s	fr8, @-r15
> +	fmov.s	fr7, @-r15
> +	fmov.s	fr6, @-r15
> +	fmov.s	fr5, @-r15
> +	fmov.s	fr4, @-r15"
> +#define FGR_LOAD	"\
> +	fmov.s	@r15+, fr4
> +	fmov.s	@r15+, fr5
> +	fmov.s	@r15+, fr6
> +	fmov.s	@r15+, fr7
> +	fmov.s	@r15+, fr8
> +	fmov.s	@r15+, fr9
> +	fmov.s	@r15+, fr10
> +	fmov.s	@r15+, fr11
> +	lds.l	@r15+, fpscr"
> +#else
> +#define FGR_SAVE	""
> +#define FGR_LOAD	""
> +#endif
> +
> +#ifndef PROF
> +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
> +	.text
> +	.globl _dl_runtime_resolve
> +	.type _dl_runtime_resolve, @function
> +	.align 5
> +_dl_runtime_resolve:
> +	mov.l r3,@-r15
> +	mov.l r4,@-r15
> +	mov.l r5,@-r15
> +	mov.l r6,@-r15
> +	mov.l r7,@-r15
> +	mov.l r12,@-r15
> +	movt r3			! Save T flag.
> +	mov.l r3,@-r15
> +	" FGR_SAVE "
> +	sts.l pr,@-r15
> +	mov r0,r4		! PLT type
> +	mov r2,r5		! link map address
> +	" FUN_ADDR "
> +	jsr @r0			! Call resolver.
> +	 mov r1,r6		! reloc offset
> +	lds.l @r15+,pr		! Get register content back.
> +	" FGR_LOAD "
> +	mov.l @r15+,r3
> +	shal r3			! Lode T flag.
> +	mov.l @r15+,r12
> +	mov.l @r15+,r7
> +	mov.l @r15+,r6
> +	mov.l @r15+,r5
> +	mov.l @r15+,r4
> +	jmp @r0			! Jump to function address.
> +	 mov.l @r15+,r3
> +	.align 2
> +3:
> +	.long " GOTJMP (fixup) "
> +	.size _dl_runtime_resolve, .-_dl_runtime_resolve
> +
> +	.globl _dl_runtime_profile
> +	.type _dl_runtime_profile, @function
> +	.align 5
> +_dl_runtime_profile:
> +	mov.l r3,@-r15
> +	mov.l r4,@-r15
> +	mov.l r5,@-r15
> +	mov.l r6,@-r15
> +	mov.l r7,@-r15
> +	mov.l r12,@-r15
> +	movt r3			! Save T flag.
> +	mov.l r3,@-r15
> +	" FGR_SAVE "
> +	sts.l pr,@-r15
> +	mov r0,r4		! PLT type
> +	mov r2,r5		! link map address
> +	sts pr,r7		! return address
> +	" FUN_ADDR "
> +	jsr @r0			! Call resolver.
> +	 mov r1,r6		! reloc offset
> +	lds.l @r15+,pr		! Get register content back.
> +	" FGR_LOAD "
> +	mov.l @r15+,r3
> +	shal r3			! Lode T flag.
> +	mov.l @r15+,r12
> +	mov.l @r15+,r7
> +	mov.l @r15+,r6
> +	mov.l @r15+,r5
> +	mov.l @r15+,r4
> +	jmp @r0			! Jump to function address.
> +	 mov.l @r15+,r3
> +	.align 2
> +3:
> +	.long " GOTJMP (profile_fixup) "
> +	.size _dl_runtime_profile, .-_dl_runtime_profile
> +	.previous
> +");
> +#else
> +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
> +	.text
> +	.globl _dl_runtime_resolve
> +	.globl _dl_runtime_profile
> +	.type _dl_runtime_resolve, @function
> +	.type _dl_runtime_profile, @function
> +	.align 5
> +_dl_runtime_resolve:
> +_dl_runtime_profile:
> +	mov.l r3,@-r15
> +	mov.l r4,@-r15
> +	mov.l r5,@-r15
> +	mov.l r6,@-r15
> +	mov.l r7,@-r15
> +	mov.l r12,@-r15
> +	movt r3			! Save T flag.
> +	mov.l r3,@-r15
> +	" FGR_SAVE "
> +	sts.l pr,@-r15
> +	mov r0,r4		! PLT type
> +	mov r2,r5		! link map address
> +	sts pr,r7		! return address
> +	" FUN_ADDR "
> +	jsr @r0			! Call resolver.
> +	 mov r1,r6		! reloc offset
> +	lds.l @r15+,pr		! Get register content back.
> +	" FGR_LOAD "
> +	mov.l @r15+,r3
> +	shal r3			! Lode T flag.
> +	mov.l @r15+,r12
> +	mov.l @r15+,r7
> +	mov.l @r15+,r6
> +	mov.l @r15+,r5
> +	mov.l @r15+,r4
> +	jmp @r0			! Jump to function address.
> +	 mov.l @r15+,r3
> +	.align 2
> +3:
> +	.long " GOTJMP (fixup) "
> +	.size _dl_runtime_resolve, .-_dl_runtime_resolve
> +	.size _dl_runtime_profile, .-_dl_runtime_profile
> +	.previous
> +");
> +#endif
> +
> +/* Mask identifying addresses reserved for the user program,
> +   where the dynamic linker should not map anything.  */
> +#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
> +
> +/* Initial entry point code for the dynamic linker.
> +   The C function `_dl_start' is the real entry point;
> +   its return value is the user program's entry point.	*/
> +
> +#define RTLD_START asm ("\
> +.text\n\
> +.globl _start\n\
> +.globl _dl_start_user\n\
> +_start:\n\
> +	mov r15,r4\n\
> +	mov.l .L_dl_start,r1\n\
> +	mova .L_dl_start,r0\n\
> +	add r1,r0\n\
> +	jsr @r0\n\
> +	 nop\n\
> +_dl_start_user:\n\
> +	! Save the user entry point address in r8.\n\
> +	mov r0,r8\n\
> +	! Point r12 at the GOT.\n\
> +	mov.l 1f,r12\n\
> +	mova 1f,r0\n\
> +	bra 2f\n\
> +	 add r0,r12\n\
> +	.align 2\n\
> +1:	.long _GLOBAL_OFFSET_TABLE_\n\
> +2:	! Store the highest stack address\n\
> +	mov.l .L_stack_end,r0\n\
> +	mov.l @(r0,r12),r0\n\
> +	mov.l r15,@r0\n\
> +	! See if we were run as a command with the executable file\n\
> +	! name as an extra leading argument.\n\
> +	mov.l .L_dl_skip_args,r0\n\
> +	mov.l @(r0,r12),r0\n\
> +	mov.l @r0,r0\n\
> +	! Get the original argument count.\n\
> +	mov.l @r15,r2\n\
> +	! Subtract _dl_skip_args from it.\n\
> +	sub r0,r2\n\
> +	! Adjust the stack pointer to skip _dl_skip_args words.\n\
> +	shll2 r0\n\
> +	add r0,r15\n\
> +	! Store back the modified argument count.\n\
> +	mov.l r2,@r15\n\
> +	! Push the searchlist of the main object as argument in\n\
> +	! _dl_init_next call below.\n\
> +	mov.l .L_dl_main_searchlist,r0\n\
> +	mov.l @(r0,r12),r0\n\
> +	mov.l @r0,r9\n\
> +0:	mov r9,r4\n\
> +	! Call _dl_init_next to return the address of an initializer\n\
> +	! function to run.\n\
> +	mov.l .L_dl_init_next,r1\n\
> +	mova .L_dl_init_next,r0\n\
> +	add r1,r0\n\
> +	jsr @r0\n\
> +	 nop\n\
> +	! Check for zero return, when out of initializers.\n\
> +	tst r0,r0\n\
> +	bt 1f\n\
> +	! Call the shared object initializer function.\n\
> +	jsr @r0\n\
> +	 nop\n\
> +	! Loop to call _dl_init_next for the next initializer.\n\
> +	bra 0b\n\
> +	 nop\n\
> +1:	! Clear the startup flag.\n\
> +	mov.l .L_dl_starting_up,r0\n\
> +	mov.l @(r0,r12),r0\n\
> +	mov #0,r2\n\
> +	mov.l r2,@r0\n\
> +	! Pass our finalizer function to the user in r4, as per ELF ABI.\n\
> +	mov.l .L_dl_fini,r0\n\
> +	mov.l @(r0,r12),r4\n\
> +	! Jump to the user's entry point.\n\
> +	jmp @r8\n\
> +	 nop\n\
> +	.align 2\n\
> +.L_dl_start:\n\
> +	.long _dl_start@PLT\n\
> +.L_stack_end:\n\
> +	.long __libc_stack_end@GOT\n\
> +.L_dl_skip_args:\n\
> +	.long _dl_skip_args@GOT\n\
> +.L_dl_main_searchlist:\n\
> +	.long _dl_main_searchlist@GOT\n\
> +.L_dl_init_next:\n\
> +	.long _dl_init_next@PLT\n\
> +.L_dl_starting_up:\n\
> +	.long _dl_starting_up@GOT\n\
> +.L_dl_fini:\n\
> +	.long _dl_fini@GOT\n\
> +.previous\n\
> +");
> +
> +/* Nonzero iff TYPE should not be allowed to resolve to one of
> +   the main executable's symbols, as for a COPY reloc.	*/
> +#define elf_machine_lookup_noexec_p(type) ((type) == R_SH_COPY)
> +
> +/* Nonzero iff TYPE describes relocation of a PLT entry, so
> +   PLT entries should not be allowed to define the value.  */
> +#define elf_machine_lookup_noplt_p(type) ((type) == R_SH_JMP_SLOT)
> +
> +/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
> +#define ELF_MACHINE_JMP_SLOT	R_SH_JMP_SLOT
> +
> +/* We define an initialization functions.  This is called very early in
> +   _dl_sysdep_start.  */
> +#define DL_PLATFORM_INIT dl_platform_init ()
> +
> +extern const char *_dl_platform;
> +
> +static inline void __attribute__ ((unused))
> +dl_platform_init (void)
> +{
> +  if (_dl_platform != NULL && *_dl_platform == '\0')
> +    /* Avoid an empty string which would disturb us.  */
> +    _dl_platform = NULL;
> +}
> +
> +static inline void
> +elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
> +		       Elf32_Addr *reloc_addr, Elf32_Addr value)
> +{
> +  *reloc_addr = value;
> +}
> +
> +/* Return the final value of a plt relocation.	*/
> +static inline Elf32_Addr
> +elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
> +		       Elf32_Addr value)
> +{
> +  return value + reloc->r_addend;
> +}
> +
> +#endif /* !dl_machine_h */
> +
> +#ifdef RESOLVE
> +
> +/* SH never uses Elf32_Rel relocations.	 */
> +#define ELF_MACHINE_NO_REL 1
> +
> +extern char **_dl_argv;
> +
> +/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
> +   MAP is the object containing the reloc.  */
> +
> +static inline void
> +elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
> +		 const Elf32_Sym *sym, const struct r_found_version *version,
> +		 Elf32_Addr *const reloc_addr)
> +{
> +  if (ELF32_R_TYPE (reloc->r_info) == R_SH_RELATIVE)
> +    {
> +#ifndef RTLD_BOOTSTRAP
> +      if (map != &_dl_rtld_map) /* Already done in rtld itself.	 */
> +#endif
> +	*reloc_addr = map->l_addr + reloc->r_addend;
> +    }
> +  else if (ELF32_R_TYPE (reloc->r_info) != R_SH_NONE)
> +    {
> +      const Elf32_Sym *const refsym = sym;
> +      Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
> +      if (sym)
> +	value += sym->st_value;
> +      value += reloc->r_addend;
> +
> +      switch (ELF32_R_TYPE (reloc->r_info))
> +	{
> +	case R_SH_COPY:
> +	  if (sym == NULL)
> +	    /* This can happen in trace mode if an object could not be
> +	       found.  */
> +	    break;
> +	  if (sym->st_size > refsym->st_size
> +	      || (sym->st_size < refsym->st_size && _dl_verbose))
> +	    {
> +	      const char *strtab;
> +
> +	      strtab = (const char *) map->l_info[DT_STRTAB]->d_un.d_ptr;
> +	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
> +				": Symbol `", strtab + refsym->st_name,
> +				"' has different size in shared object, "
> +				"consider re-linking\n", NULL);
> +	    }
> +	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
> +						   refsym->st_size));
> +	  break;
> +	case R_SH_GLOB_DAT:
> +	case R_SH_JMP_SLOT:
> +	  *reloc_addr = value;
> +	  break;
> +	case R_SH_DIR32:
> +	  {
> +#ifndef RTLD_BOOTSTRAP
> +	   /* This is defined in rtld.c, but nowhere in the static
> +	      libc.a; make the reference weak so static programs can
> +	      still link.  This declaration cannot be done when
> +	      compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because
> +	      rtld.c contains the common defn for _dl_rtld_map, which
> +	      is incompatible with a weak decl in the same file.  */
> +	    weak_extern (_dl_rtld_map);
> +	    if (map == &_dl_rtld_map)
> +	      /* Undo the relocation done here during bootstrapping.
> +		 Now we will relocate it anew, possibly using a
> +		 binding found in the user program or a loaded library
> +		 rather than the dynamic linker's built-in definitions
> +		 used while loading those libraries.  */
> +	      value -= map->l_addr + refsym->st_value + reloc->r_addend;
> +#endif
> +	    *reloc_addr = value;
> +	    break;
> +	  }
> +	case R_SH_REL32:
> +	  *reloc_addr = (value - (Elf32_Addr) reloc_addr);
> +	  break;
> +	default:
> +	  assert (! "unexpected dynamic reloc type");
> +	  break;
> +	}
> +    }
> +}
> +
> +static inline void
> +elf_machine_lazy_rel (Elf32_Addr l_addr, const Elf32_Rela *reloc)
> +{
> +  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
> +  /* Check for unexpected PLT reloc type.  */
> +  assert (ELF32_R_TYPE (reloc->r_info) == R_SH_JMP_SLOT);
> +  *reloc_addr += l_addr; /* + reloc->r_addend; */
> +}
> +
> +#endif /* RESOLVE */
> diff -u -r -N glibc-2.1.3-original/sysdeps/sh/sh4/fpu/bits/fenv.h glibc-2.1.3/sysdeps/sh/sh4/fpu/bits/fenv.h
> --- glibc-2.1.3-original/sysdeps/sh/sh4/fpu/bits/fenv.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/sh/sh4/fpu/bits/fenv.h	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,72 @@
> +/* Copyright (C) 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#ifndef _FENV_H
> +# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
> +#endif
> +
> +
> +/* Define bits representing the exception.  We use the bit positions
> +   of the appropriate bits in the FPU control word.  */
> +enum
> +  {
> +    FE_INEXACT = 0x04,
> +#define FE_INEXACT	FE_INEXACT
> +    FE_UNDERFLOW = 0x08,
> +#define FE_UNDERFLOW	FE_UNDERFLOW
> +    FE_OVERFLOW = 0x10,
> +#define FE_OVERFLOW	FE_OVERFLOW
> +    FE_DIVBYZERO = 0x20,
> +#define FE_DIVBYZERO	FE_DIVBYZERO
> +    FE_INVALID = 0x40,
> +#define FE_INVALID	FE_INVALID
> +  };
> +
> +#define FE_ALL_EXCEPT \
> +	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
> +
> +/* The SH FPU supports all of the four defined rounding modes.  We
> +   use again the bit positions in the FPU control word as the values
> +   for the appropriate macros.  */
> +enum
> +  {
> +    FE_TONEAREST = 0x0,
> +#define FE_TONEAREST	FE_TONEAREST
> +    FE_TOWARDZERO = 0x1,
> +#define FE_TOWARDZERO	FE_TOWARDZERO
> +    FE_UPWARD = 0x2,
> +#define FE_UPWARD	FE_UPWARD
> +    FE_DOWNWARD = 0x3
> +#define FE_DOWNWARD	FE_DOWNWARD
> +  };
> +
> +
> +/* Type representing exception flags.  */
> +typedef unsigned short int fexcept_t;
> +
> +
> +/* Type representing floating-point environment.  This function corresponds
> +   to the layout of the block written by the `fstenv'.  */
> +typedef struct
> +  {
> +    unsigned int __fpscr;
> +  }
> +fenv_t;
> +
> +/* If the default argument is used we use this value.  */
> +#define FE_DFL_ENV	((fenv_t *) -1)
> diff -u -r -N glibc-2.1.3-original/sysdeps/sh/sh4/fpu/fclrexcpt.c glibc-2.1.3/sysdeps/sh/sh4/fpu/fclrexcpt.c
> --- glibc-2.1.3-original/sysdeps/sh/sh4/fpu/fclrexcpt.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/sh/sh4/fpu/fclrexcpt.c	Sun Mar 12 21:13:05 2000
> @@ -0,0 +1,40 @@
> +/* Clear given exceptions in current floating-point environment.
> +   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#include <fenv.h>
> +#include <fpu_control.h>
> +
> +void
> +feclearexcept (int excepts)
It's int __feclearexcept - this was changed in the last minute in ISO
C99.  Please check all your functions from <fenv.h> with the current
version in glibc 2.2.
> +{
> +  int cw;
> +
> +  /* Mask out unsupported bits/exceptions.  */
> +  excepts &= FE_ALL_EXCEPT;
> +
> +  /* Read the complete control word.  */
> +  _FPU_GETCW (cw);
> +
> +  /* Clear exception bits.  */
> +  cw &= ~excepts;
> +  
> +  /* Put the new data in effect.  */
> +  _FPU_SETCW (cw);
> +}
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/Versions glibc-2.1.3/sysdeps/unix/sysv/linux/sh/Versions
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/Versions	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/Versions	Sun Mar 12 04:20:49 2000
> @@ -0,0 +1,4 @@
> +libc {
> +  GLIBC_2.1 {
> +  }
> +}
No versions?  In that case you don't need the file at all.
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/errlist.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/errlist.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/errlist.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/errlist.c	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,55 @@
> +/* Copyright (C) 1998, 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#include <sizes.h>
> +#include <errlist.h>
> +
> +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
> +
> +# define SYS_ERRLIST __new_sys_errlist
> +# define SYS_NERR __new_sys_nerr
> +
> +asm (".data; .globl __old_sys_errlist;  __old_sys_errlist:");
> +#endif
> +
> +#include <sysdeps/gnu/errlist.c>
> +
> +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
> +asm (".type __old_sys_errlist,%object;.size __old_sys_errlist,"
> +     OLD_ERRLIST_SIZE_STR "*" PTR_SIZE_STR);

You don't need compatibility with old versions.  We've also changed
the way to handle this, have a look at glibc 2.2.
> +
> +extern const char *const *__old_sys_errlist;
> +
> +const int __old_sys_nerr = OLD_ERRLIST_SIZE;
> +
> +strong_alias (__old_sys_nerr, _old_sys_nerr);
> +weak_alias (__old_sys_nerr, _old_sys_nerr)
> +symbol_version (__old_sys_nerr, _sys_nerr, GLIBC_2.0);
> +symbol_version (_old_sys_nerr, sys_nerr, GLIBC_2.0);
> +weak_alias (__old_sys_errlist, _old_sys_errlist);
> +symbol_version (__old_sys_errlist, _sys_errlist, GLIBC_2.0);
> +symbol_version (_old_sys_errlist, sys_errlist, GLIBC_2.0);
> +
> +weak_alias (__new_sys_nerr, _new_sys_nerr)
> +default_symbol_version (__new_sys_nerr, _sys_nerr, GLIBC_2.1);
> +default_symbol_version (_new_sys_nerr, sys_nerr, GLIBC_2.1);
> +weak_alias (__new_sys_errlist, _new_sys_errlist)
> +default_symbol_version (__new_sys_errlist, _sys_errlist, GLIBC_2.1);
> +default_symbol_version (_new_sys_errlist, sys_errlist, GLIBC_2.1);
> +
> +#endif
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/getgroups.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/getgroups.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/getgroups.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/getgroups.c	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,2 @@
> +/* We also have to rewrite the kernel gid_t to the user land type.  */
> +#include <sysdeps/unix/sysv/linux/i386/getgroups.c>

Is this really needed?  What kernel version are you supporting?  If
you start with glibc 2.2 and Linux 2.4 this might not be necessary.

> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/init-first.h glibc-2.1.3/sysdeps/unix/sysv/linux/sh/init-first.h
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/init-first.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/init-first.h	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,52 @@
> +/* Prepare arguments for library initialization function.
> +   Copyright (C) 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.	*/
> +
> +/* The job of this fragment it to find argc and friends for INIT.
> +   This is done in one of two ways: either in the stack context
> +   of program start, or having dlopen pass them in.  */
> +
> +#define SYSDEP_CALL_INIT(NAME, INIT)		\
> +void NAME (void *arg, void *arg1, void *arg2, void *arg3, void *argp)	\
> +{		\
> +  int argc;	\
> +  char** argv;	\
> +  char** envp;	\
> +  /* The next variable is only here to work around a bug in gcc <= 2.7.2.2.   \
> +     If the address would be taken inside the expression the optimizer	      \
> +     would try to be too smart and throws it away.  Grrr.  */		      \
> +  int *dummy_addr = &_dl_starting_up;					      \
> +									      \
> +  __libc_multiple_libcs = dummy_addr && !_dl_starting_up;		      \
> +						\
> +  if (!__libc_multiple_libcs)			\
> +    {						\
> +      /* In SH, argp is the first argument on stack.  */	\
> +      argc = *(int*) (&argp);			\
> +      argv = (char **) &argp + 1;		\
> +      envp = &argv[argc+1];			\
> +    }						\
> +  else						\
> +    {						\
> +      argc = (int) arg;				\
> +      argv = (char**) arg1;			\
> +      envp = (char**) arg2;			\
> +    }						\
> +						\
> +  INIT (argc, argv, envp);			\
> +}
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pipe.S glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pipe.S
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pipe.S	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pipe.S	Thu Apr 27 21:26:38 2000
> @@ -0,0 +1,63 @@
> +/* Copyright (C) 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#include <sysdep.h>
> +
> +ENTRY (__libc_pipe)
> +	mov	#+__NR_pipe, $r3
> +	trapa	#0x10
> +	mov     r0, r3
> +	mov	#-12, r2
> +	shad	r2, r3
> +	not	r3, r3			// r1=0 means r0 = -1 to -4095
> +	tst	r3, r3			// i.e. error in linux
> +	bf	1f
> +	mov.l	.L2, r1
> +#ifdef PIC
> +	mov	r0, r4
> +	mov.l	r12, @-r15
> +	sts.l	pr, @-r15
> +        mov.l	0f, r12
> +	mova	0f, r0
> +	add	r0, r12
> +	mova	.L2, r0
> +	add	r0, r1
> +	jsr	@r1
> +	 nop
> +	lds.l	@r15+, pr
> +	rts
> +	 mov.l	@r15+, r12
> +	.align 2
> +0:
> +	.long	_GLOBAL_OFFSET_TABLE_
> +#else
> +	jmp	@r1
> +	 mov	r0, r4
> +#endif
> +1:
> +	mov.l	r0, @r4
> +	mov.l	r1, @(4, r4)
> +	rts
> +	 mov	#0, r0
> +	.align	2
> +.L2:
> +	.long	PLTJMP(C_SYMBOL_NAME(__syscall_error))
> +PSEUDO_END (__libc_pipe)
> +
> +weak_alias (__libc_pipe, __pipe)
> +weak_alias (__libc_pipe, pipe)
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pread.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pread.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pread.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pread.c	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1 @@
> +#include <sysdeps/unix/sysv/linux/i386/pread.c>
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pread64.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pread64.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pread64.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pread64.c	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1 @@
> +#include <sysdeps/unix/sysv/linux/i386/pread64.c>
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/profil-counter.h glibc-2.1.3/sysdeps/unix/sysv/linux/sh/profil-counter.h
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/profil-counter.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/profil-counter.h	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1,28 @@
> +/* Low-level statistical profiling support function.  Linux/SH version.
> +   Copyright (C) 1996, 1997, 1998, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#include <signal.h>
> +
Shouldn't this be a static void?
> +void
> +profil_counter (int signo, int _a2, int _a3, int _a4, struct sigcontext sc)
> +{
> +  void *pc;
> +  pc = (void *) sc.sc_pc;
> +  profil_count (pc);
> +}
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pwrite.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pwrite.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/pwrite.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/pwrite.c	Sun Mar 12 04:09:09 2000
> @@ -0,0 +1 @@
> +#include <sysdeps/unix/sysv/linux/i386/pwrite.c>
Not needed in glibc 2.2 anymore.
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/sigaction.c glibc-2.1.3/sysdeps/unix/sysv/linux/sh/sigaction.c
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/sigaction.c	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/sigaction.c	Sun Mar 12 04:09:10 2000
> @@ -0,0 +1,150 @@
> +/* Copyright (C) 1997, 1998, 1999, 2000 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#include <errno.h>
> +#include <signal.h>
> +#include <string.h>
> +
> +#include <sysdep.h>
> +#include <sys/syscall.h>
> +
> +/* The difference here is that the sigaction structure used in the
> +   kernel is not the same as we use in the libc.  Therefore we must
> +   translate it here.  */
> +#include <kernel_sigaction.h>
> +
> +extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
> +				struct old_kernel_sigaction *);
> +extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
> +				   struct kernel_sigaction *, size_t);
> +
> +/* The variable is shared between all wrappers around signal handling
> +   functions which have RT equivalents.  */
> +int __libc_missing_rt_sigs;
Are you really supporting 2.0 and 2.1 kernels?  Btw. we've also added
in glibc 2.2 some ASSUME_* constants, see
sysdeps/unix/sysv/linux/kernel-features.h and how this is handled.
> diff -u -r -N glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/sys/io.h glibc-2.1.3/sysdeps/unix/sysv/linux/sh/sys/io.h
> --- glibc-2.1.3-original/sysdeps/unix/sysv/linux/sh/sys/io.h	Thu Jan  1 09:00:00 1970
> +++ glibc-2.1.3/sysdeps/unix/sysv/linux/sh/sys/io.h	Sun Mar 12 04:09:10 2000
> @@ -0,0 +1,48 @@
> +/* Copyright (C) 1996, 1998, 1999 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 Library General Public License as
> +   published by the Free Software Foundation; either version 2 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
> +   Library General Public License for more details.
> +
> +   You should have received a copy of the GNU Library General Public
> +   License along with the GNU C Library; see the file COPYING.LIB.  If not,
> +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +#ifndef	_SYS_IO_H
> +
> +#define	_SYS_IO_H	1
> +#include <features.h>
> +
> +__BEGIN_DECLS
> +
> +/* If TURN_ON is TRUE, request for permission to do direct i/o on the
> +   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
> +   permission off for that range.  This call requires root privileges.  */
> +extern int ioperm __P ((unsigned long int __from, unsigned long int __num,
> +			int __turn_on));

With glibc 2.2 we use normal prototypes without __P (and no need for
__ptr_t anymore, use void *).

[...]

Some of my notes apply to more than one place, I've just added the
description where I noticed the problem first.

Looking forward to the integration of your patch into 2.2!
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de

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