patches/glibc/2.2.5/dl-machine-sparc.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.2.5/dl-machine-sparc.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,230 @@
     1.4 +--- glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h.old	Sat Jun  7 18:19:03 2003
     1.5 ++++ glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h	Sat Jun  7 18:20:04 2003
     1.6 +@@ -148,23 +148,23 @@
     1.7 +    and then redirect to the address it returns.  */
     1.8 + #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)	\
     1.9 +   asm ( "\
    1.10 +-	.text
    1.11 +-	.globl	" #tramp_name "
    1.12 +-	.type	" #tramp_name ", @function
    1.13 +-	.align	32
    1.14 +-" #tramp_name ":
    1.15 +-	/* Set up the arguments to fixup --
    1.16 +-	   %o0 = link_map out of plt0
    1.17 +-	   %o1 = offset of reloc entry
    1.18 +-	   %o2 = return address  */
    1.19 +-	ld	[%o7 + 8], %o0
    1.20 +-	srl	%g1, 10, %o1
    1.21 +-	mov	%i7, %o2
    1.22 +-	call	" #fixup_name "
    1.23 +-	 sub	%o1, 4*12, %o1
    1.24 +-	jmp	%o0
    1.25 +-	 restore
    1.26 +-	.size	" #tramp_name ", . - " #tramp_name "
    1.27 ++	.text\n\
    1.28 ++	.globl	" #tramp_name "\n\
    1.29 ++	.type	" #tramp_name ", @function\n\
    1.30 ++	.align	32\n\
    1.31 ++" #tramp_name ":\n\
    1.32 ++	/* Set up the arguments to fixup --\n\
    1.33 ++	   %o0 = link_map out of plt0\n\
    1.34 ++	   %o1 = offset of reloc entry\n\
    1.35 ++	   %o2 = return address  */\n\
    1.36 ++	ld	[%o7 + 8], %o0\n\
    1.37 ++	srl	%g1, 10, %o1\n\
    1.38 ++	mov	%i7, %o2\n\
    1.39 ++	call	" #fixup_name "\n\
    1.40 ++	 sub	%o1, 4*12, %o1\n\
    1.41 ++	jmp	%o0\n\
    1.42 ++	 restore\n\
    1.43 ++	.size	" #tramp_name ", . - " #tramp_name "\n\
    1.44 + 	.previous")
    1.45 + 
    1.46 + #ifndef PROF
    1.47 +@@ -199,96 +199,96 @@
    1.48 +    its return value is the user program's entry point.  */
    1.49 + 
    1.50 + #define RTLD_START __asm__ ("\
    1.51 +-	.text
    1.52 +-	.globl	_start
    1.53 +-	.type	_start, @function
    1.54 +-	.align	32
    1.55 +-_start:
    1.56 +-  /* Allocate space for functions to drop their arguments.  */
    1.57 +-	sub	%sp, 6*4, %sp
    1.58 +-  /* Pass pointer to argument block to _dl_start.  */
    1.59 +-	call	_dl_start
    1.60 +-	 add	%sp, 22*4, %o0
    1.61 +-	/* FALTHRU */
    1.62 +-	.globl	_dl_start_user
    1.63 +-	.type	_dl_start_user, @function
    1.64 +-_dl_start_user:
    1.65 +-  /* Load the PIC register.  */
    1.66 +-1:	call	2f
    1.67 +-	 sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
    1.68 +-2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
    1.69 +-	add	%l7, %o7, %l7
    1.70 +-  /* Save the user entry point address in %l0 */
    1.71 +-	mov	%o0, %l0
    1.72 +-  /* Store the highest stack address.  */
    1.73 +-	sethi	%hi(__libc_stack_end), %g2
    1.74 +-	or	%g2, %lo(__libc_stack_end), %g2
    1.75 +-	ld	[%l7 + %g2], %l1
    1.76 +-	sethi	%hi(_dl_skip_args), %g2
    1.77 +-	add	%sp, 6*4, %l2
    1.78 +-	or	%g2, %lo(_dl_skip_args), %g2
    1.79 +-	st	%l2, [%l1]
    1.80 +-  /* See if we were run as a command with the executable file name as an
    1.81 +-     extra leading argument.  If so, adjust the contents of the stack.  */
    1.82 +-	ld	[%l7+%g2], %i0
    1.83 +-	ld	[%i0], %i0
    1.84 +-	tst	%i0
    1.85 +-	beq	3f
    1.86 +-	 ld	[%sp+22*4], %i5		/* load argc */
    1.87 +-	/* Find out how far to shift.  */
    1.88 +-	sethi	%hi(_dl_argv), %l3
    1.89 +-	or	%l3, %lo(_dl_argv), %l3
    1.90 +-	ld	[%l7+%l3], %l3
    1.91 +-	sub	%i5, %i0, %i5
    1.92 +-	ld	[%l3], %l4
    1.93 +-	sll	%i0, 2, %i2
    1.94 +-	st	%i5, [%sp+22*4]
    1.95 +-	sub	%l4, %i2, %l4
    1.96 +-	add	%sp, 23*4, %i1
    1.97 +-	add	%i1, %i2, %i2
    1.98 +-	st	%l4, [%l3]
    1.99 +-	/* Copy down argv */
   1.100 +-21:	ld	[%i2], %i3
   1.101 +-	add	%i2, 4, %i2
   1.102 +-	tst	%i3
   1.103 +-	st	%i3, [%i1]
   1.104 +-	bne	21b
   1.105 +-	 add	%i1, 4, %i1
   1.106 +-	/* Copy down env */
   1.107 +-22:	ld	[%i2], %i3
   1.108 +-	add	%i2, 4, %i2
   1.109 +-	tst	%i3
   1.110 +-	st	%i3, [%i1]
   1.111 +-	bne	22b
   1.112 +-	 add	%i1, 4, %i1
   1.113 +-	/* Copy down auxiliary table.  */
   1.114 +-23:	ld	[%i2], %i3
   1.115 +-	ld	[%i2+4], %i4
   1.116 +-	add	%i2, 8, %i2
   1.117 +-	tst	%i3
   1.118 +-	st	%i3, [%i1]
   1.119 +-	st	%i4, [%i1+4]
   1.120 +-	bne	23b
   1.121 +-	 add	%i1, 8, %i1
   1.122 +-  /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp.  */
   1.123 +-3:	sethi	%hi(_dl_loaded), %o0
   1.124 +-	add	%sp, 23*4, %o2
   1.125 +-	orcc	%o0, %lo(_dl_loaded), %o0
   1.126 +-	sll	%i5, 2, %o3
   1.127 +-	ld	[%l7+%o0], %o0
   1.128 +-	add	%o3, 4, %o3
   1.129 +-	mov	%i5, %o1
   1.130 +-	add	%o2, %o3, %o3
   1.131 +-	call	_dl_init
   1.132 +-	 ld	[%o0], %o0
   1.133 +-  /* Pass our finalizer function to the user in %g1.  */
   1.134 +-	sethi	%hi(_dl_fini), %g1
   1.135 +-	or	%g1, %lo(_dl_fini), %g1
   1.136 +-	ld	[%l7+%g1], %g1
   1.137 +-  /* Jump to the user's entry point and deallocate the extra stack we got.  */
   1.138 +-	jmp	%l0
   1.139 +-	 add	%sp, 6*4, %sp
   1.140 +-	.size   _dl_start_user, . - _dl_start_user
   1.141 ++	.text\n\
   1.142 ++	.globl	_start\n\
   1.143 ++	.type	_start, @function\n\
   1.144 ++	.align	32\n\
   1.145 ++_start:\n\
   1.146 ++  /* Allocate space for functions to drop their arguments.  */\n\
   1.147 ++	sub	%sp, 6*4, %sp\n\
   1.148 ++  /* Pass pointer to argument block to _dl_start.  */\n\
   1.149 ++	call	_dl_start\n\
   1.150 ++	 add	%sp, 22*4, %o0\n\
   1.151 ++	/* FALTHRU */\n\
   1.152 ++	.globl	_dl_start_user\n\
   1.153 ++	.type	_dl_start_user, @function\n\
   1.154 ++_dl_start_user:\n\
   1.155 ++  /* Load the PIC register.  */\n\
   1.156 ++1:	call	2f\n\
   1.157 ++	 sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
   1.158 ++2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
   1.159 ++	add	%l7, %o7, %l7\n\
   1.160 ++  /* Save the user entry point address in %l0 */\n\
   1.161 ++	mov	%o0, %l0\n\
   1.162 ++  /* Store the highest stack address.  */\n\
   1.163 ++	sethi	%hi(__libc_stack_end), %g2\n\
   1.164 ++	or	%g2, %lo(__libc_stack_end), %g2\n\
   1.165 ++	ld	[%l7 + %g2], %l1\n\
   1.166 ++	sethi	%hi(_dl_skip_args), %g2\n\
   1.167 ++	add	%sp, 6*4, %l2\n\
   1.168 ++	or	%g2, %lo(_dl_skip_args), %g2\n\
   1.169 ++	st	%l2, [%l1]\n\
   1.170 ++  /* See if we were run as a command with the executable file name as an\n\
   1.171 ++     extra leading argument.  If so, adjust the contents of the stack.  */\n\
   1.172 ++	ld	[%l7+%g2], %i0\n\
   1.173 ++	ld	[%i0], %i0\n\
   1.174 ++	tst	%i0\n\
   1.175 ++	beq	3f\n\
   1.176 ++	 ld	[%sp+22*4], %i5		/* load argc */\n\
   1.177 ++	/* Find out how far to shift.  */\n\
   1.178 ++	sethi	%hi(_dl_argv), %l3\n\
   1.179 ++	or	%l3, %lo(_dl_argv), %l3\n\
   1.180 ++	ld	[%l7+%l3], %l3\n\
   1.181 ++	sub	%i5, %i0, %i5\n\
   1.182 ++	ld	[%l3], %l4\n\
   1.183 ++	sll	%i0, 2, %i2\n\
   1.184 ++	st	%i5, [%sp+22*4]\n\
   1.185 ++	sub	%l4, %i2, %l4\n\
   1.186 ++	add	%sp, 23*4, %i1\n\
   1.187 ++	add	%i1, %i2, %i2\n\
   1.188 ++	st	%l4, [%l3]\n\
   1.189 ++	/* Copy down argv */\n\
   1.190 ++21:	ld	[%i2], %i3\n\
   1.191 ++	add	%i2, 4, %i2\n\
   1.192 ++	tst	%i3\n\
   1.193 ++	st	%i3, [%i1]\n\
   1.194 ++	bne	21b\n\
   1.195 ++	 add	%i1, 4, %i1\n\
   1.196 ++	/* Copy down env */\n\
   1.197 ++22:	ld	[%i2], %i3\n\
   1.198 ++	add	%i2, 4, %i2\n\
   1.199 ++	tst	%i3\n\
   1.200 ++	st	%i3, [%i1]\n\
   1.201 ++	bne	22b\n\
   1.202 ++	 add	%i1, 4, %i1\n\
   1.203 ++	/* Copy down auxiliary table.  */\n\
   1.204 ++23:	ld	[%i2], %i3\n\
   1.205 ++	ld	[%i2+4], %i4\n\
   1.206 ++	add	%i2, 8, %i2\n\
   1.207 ++	tst	%i3\n\
   1.208 ++	st	%i3, [%i1]\n\
   1.209 ++	st	%i4, [%i1+4]\n\
   1.210 ++	bne	23b\n\
   1.211 ++	 add	%i1, 8, %i1\n\
   1.212 ++  /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp.  */\n\
   1.213 ++3:	sethi	%hi(_dl_loaded), %o0\n\
   1.214 ++	add	%sp, 23*4, %o2\n\
   1.215 ++	orcc	%o0, %lo(_dl_loaded), %o0\n\
   1.216 ++	sll	%i5, 2, %o3\n\
   1.217 ++	ld	[%l7+%o0], %o0\n\
   1.218 ++	add	%o3, 4, %o3\n\
   1.219 ++	mov	%i5, %o1\n\
   1.220 ++	add	%o2, %o3, %o3\n\
   1.221 ++	call	_dl_init\n\
   1.222 ++	 ld	[%o0], %o0\n\
   1.223 ++  /* Pass our finalizer function to the user in %g1.  */\n\
   1.224 ++	sethi	%hi(_dl_fini), %g1\n\
   1.225 ++	or	%g1, %lo(_dl_fini), %g1\n\
   1.226 ++	ld	[%l7+%g1], %g1\n\
   1.227 ++  /* Jump to the user's entry point and deallocate the extra stack we got.  */\n\
   1.228 ++	jmp	%l0\n\
   1.229 ++	 add	%sp, 6*4, %sp\n\
   1.230 ++	.size   _dl_start_user, . - _dl_start_user\n\
   1.231 + 	.previous");
   1.232 + 
   1.233 + static inline Elf32_Addr