patches/glibc/2.2.5/dl-machine-sparc.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 --- glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h.old	Sat Jun  7 18:19:03 2003
     2 +++ glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h	Sat Jun  7 18:20:04 2003
     3 @@ -148,23 +148,23 @@
     4     and then redirect to the address it returns.  */
     5  #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)	\
     6    asm ( "\
     7 -	.text
     8 -	.globl	" #tramp_name "
     9 -	.type	" #tramp_name ", @function
    10 -	.align	32
    11 -" #tramp_name ":
    12 -	/* Set up the arguments to fixup --
    13 -	   %o0 = link_map out of plt0
    14 -	   %o1 = offset of reloc entry
    15 -	   %o2 = return address  */
    16 -	ld	[%o7 + 8], %o0
    17 -	srl	%g1, 10, %o1
    18 -	mov	%i7, %o2
    19 -	call	" #fixup_name "
    20 -	 sub	%o1, 4*12, %o1
    21 -	jmp	%o0
    22 -	 restore
    23 -	.size	" #tramp_name ", . - " #tramp_name "
    24 +	.text\n\
    25 +	.globl	" #tramp_name "\n\
    26 +	.type	" #tramp_name ", @function\n\
    27 +	.align	32\n\
    28 +" #tramp_name ":\n\
    29 +	/* Set up the arguments to fixup --\n\
    30 +	   %o0 = link_map out of plt0\n\
    31 +	   %o1 = offset of reloc entry\n\
    32 +	   %o2 = return address  */\n\
    33 +	ld	[%o7 + 8], %o0\n\
    34 +	srl	%g1, 10, %o1\n\
    35 +	mov	%i7, %o2\n\
    36 +	call	" #fixup_name "\n\
    37 +	 sub	%o1, 4*12, %o1\n\
    38 +	jmp	%o0\n\
    39 +	 restore\n\
    40 +	.size	" #tramp_name ", . - " #tramp_name "\n\
    41  	.previous")
    42  
    43  #ifndef PROF
    44 @@ -199,96 +199,96 @@
    45     its return value is the user program's entry point.  */
    46  
    47  #define RTLD_START __asm__ ("\
    48 -	.text
    49 -	.globl	_start
    50 -	.type	_start, @function
    51 -	.align	32
    52 -_start:
    53 -  /* Allocate space for functions to drop their arguments.  */
    54 -	sub	%sp, 6*4, %sp
    55 -  /* Pass pointer to argument block to _dl_start.  */
    56 -	call	_dl_start
    57 -	 add	%sp, 22*4, %o0
    58 -	/* FALTHRU */
    59 -	.globl	_dl_start_user
    60 -	.type	_dl_start_user, @function
    61 -_dl_start_user:
    62 -  /* Load the PIC register.  */
    63 -1:	call	2f
    64 -	 sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
    65 -2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
    66 -	add	%l7, %o7, %l7
    67 -  /* Save the user entry point address in %l0 */
    68 -	mov	%o0, %l0
    69 -  /* Store the highest stack address.  */
    70 -	sethi	%hi(__libc_stack_end), %g2
    71 -	or	%g2, %lo(__libc_stack_end), %g2
    72 -	ld	[%l7 + %g2], %l1
    73 -	sethi	%hi(_dl_skip_args), %g2
    74 -	add	%sp, 6*4, %l2
    75 -	or	%g2, %lo(_dl_skip_args), %g2
    76 -	st	%l2, [%l1]
    77 -  /* See if we were run as a command with the executable file name as an
    78 -     extra leading argument.  If so, adjust the contents of the stack.  */
    79 -	ld	[%l7+%g2], %i0
    80 -	ld	[%i0], %i0
    81 -	tst	%i0
    82 -	beq	3f
    83 -	 ld	[%sp+22*4], %i5		/* load argc */
    84 -	/* Find out how far to shift.  */
    85 -	sethi	%hi(_dl_argv), %l3
    86 -	or	%l3, %lo(_dl_argv), %l3
    87 -	ld	[%l7+%l3], %l3
    88 -	sub	%i5, %i0, %i5
    89 -	ld	[%l3], %l4
    90 -	sll	%i0, 2, %i2
    91 -	st	%i5, [%sp+22*4]
    92 -	sub	%l4, %i2, %l4
    93 -	add	%sp, 23*4, %i1
    94 -	add	%i1, %i2, %i2
    95 -	st	%l4, [%l3]
    96 -	/* Copy down argv */
    97 -21:	ld	[%i2], %i3
    98 -	add	%i2, 4, %i2
    99 -	tst	%i3
   100 -	st	%i3, [%i1]
   101 -	bne	21b
   102 -	 add	%i1, 4, %i1
   103 -	/* Copy down env */
   104 -22:	ld	[%i2], %i3
   105 -	add	%i2, 4, %i2
   106 -	tst	%i3
   107 -	st	%i3, [%i1]
   108 -	bne	22b
   109 -	 add	%i1, 4, %i1
   110 -	/* Copy down auxiliary table.  */
   111 -23:	ld	[%i2], %i3
   112 -	ld	[%i2+4], %i4
   113 -	add	%i2, 8, %i2
   114 -	tst	%i3
   115 -	st	%i3, [%i1]
   116 -	st	%i4, [%i1+4]
   117 -	bne	23b
   118 -	 add	%i1, 8, %i1
   119 -  /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp.  */
   120 -3:	sethi	%hi(_dl_loaded), %o0
   121 -	add	%sp, 23*4, %o2
   122 -	orcc	%o0, %lo(_dl_loaded), %o0
   123 -	sll	%i5, 2, %o3
   124 -	ld	[%l7+%o0], %o0
   125 -	add	%o3, 4, %o3
   126 -	mov	%i5, %o1
   127 -	add	%o2, %o3, %o3
   128 -	call	_dl_init
   129 -	 ld	[%o0], %o0
   130 -  /* Pass our finalizer function to the user in %g1.  */
   131 -	sethi	%hi(_dl_fini), %g1
   132 -	or	%g1, %lo(_dl_fini), %g1
   133 -	ld	[%l7+%g1], %g1
   134 -  /* Jump to the user's entry point and deallocate the extra stack we got.  */
   135 -	jmp	%l0
   136 -	 add	%sp, 6*4, %sp
   137 -	.size   _dl_start_user, . - _dl_start_user
   138 +	.text\n\
   139 +	.globl	_start\n\
   140 +	.type	_start, @function\n\
   141 +	.align	32\n\
   142 +_start:\n\
   143 +  /* Allocate space for functions to drop their arguments.  */\n\
   144 +	sub	%sp, 6*4, %sp\n\
   145 +  /* Pass pointer to argument block to _dl_start.  */\n\
   146 +	call	_dl_start\n\
   147 +	 add	%sp, 22*4, %o0\n\
   148 +	/* FALTHRU */\n\
   149 +	.globl	_dl_start_user\n\
   150 +	.type	_dl_start_user, @function\n\
   151 +_dl_start_user:\n\
   152 +  /* Load the PIC register.  */\n\
   153 +1:	call	2f\n\
   154 +	 sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
   155 +2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
   156 +	add	%l7, %o7, %l7\n\
   157 +  /* Save the user entry point address in %l0 */\n\
   158 +	mov	%o0, %l0\n\
   159 +  /* Store the highest stack address.  */\n\
   160 +	sethi	%hi(__libc_stack_end), %g2\n\
   161 +	or	%g2, %lo(__libc_stack_end), %g2\n\
   162 +	ld	[%l7 + %g2], %l1\n\
   163 +	sethi	%hi(_dl_skip_args), %g2\n\
   164 +	add	%sp, 6*4, %l2\n\
   165 +	or	%g2, %lo(_dl_skip_args), %g2\n\
   166 +	st	%l2, [%l1]\n\
   167 +  /* See if we were run as a command with the executable file name as an\n\
   168 +     extra leading argument.  If so, adjust the contents of the stack.  */\n\
   169 +	ld	[%l7+%g2], %i0\n\
   170 +	ld	[%i0], %i0\n\
   171 +	tst	%i0\n\
   172 +	beq	3f\n\
   173 +	 ld	[%sp+22*4], %i5		/* load argc */\n\
   174 +	/* Find out how far to shift.  */\n\
   175 +	sethi	%hi(_dl_argv), %l3\n\
   176 +	or	%l3, %lo(_dl_argv), %l3\n\
   177 +	ld	[%l7+%l3], %l3\n\
   178 +	sub	%i5, %i0, %i5\n\
   179 +	ld	[%l3], %l4\n\
   180 +	sll	%i0, 2, %i2\n\
   181 +	st	%i5, [%sp+22*4]\n\
   182 +	sub	%l4, %i2, %l4\n\
   183 +	add	%sp, 23*4, %i1\n\
   184 +	add	%i1, %i2, %i2\n\
   185 +	st	%l4, [%l3]\n\
   186 +	/* Copy down argv */\n\
   187 +21:	ld	[%i2], %i3\n\
   188 +	add	%i2, 4, %i2\n\
   189 +	tst	%i3\n\
   190 +	st	%i3, [%i1]\n\
   191 +	bne	21b\n\
   192 +	 add	%i1, 4, %i1\n\
   193 +	/* Copy down env */\n\
   194 +22:	ld	[%i2], %i3\n\
   195 +	add	%i2, 4, %i2\n\
   196 +	tst	%i3\n\
   197 +	st	%i3, [%i1]\n\
   198 +	bne	22b\n\
   199 +	 add	%i1, 4, %i1\n\
   200 +	/* Copy down auxiliary table.  */\n\
   201 +23:	ld	[%i2], %i3\n\
   202 +	ld	[%i2+4], %i4\n\
   203 +	add	%i2, 8, %i2\n\
   204 +	tst	%i3\n\
   205 +	st	%i3, [%i1]\n\
   206 +	st	%i4, [%i1+4]\n\
   207 +	bne	23b\n\
   208 +	 add	%i1, 8, %i1\n\
   209 +  /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp.  */\n\
   210 +3:	sethi	%hi(_dl_loaded), %o0\n\
   211 +	add	%sp, 23*4, %o2\n\
   212 +	orcc	%o0, %lo(_dl_loaded), %o0\n\
   213 +	sll	%i5, 2, %o3\n\
   214 +	ld	[%l7+%o0], %o0\n\
   215 +	add	%o3, 4, %o3\n\
   216 +	mov	%i5, %o1\n\
   217 +	add	%o2, %o3, %o3\n\
   218 +	call	_dl_init\n\
   219 +	 ld	[%o0], %o0\n\
   220 +  /* Pass our finalizer function to the user in %g1.  */\n\
   221 +	sethi	%hi(_dl_fini), %g1\n\
   222 +	or	%g1, %lo(_dl_fini), %g1\n\
   223 +	ld	[%l7+%g1], %g1\n\
   224 +  /* Jump to the user's entry point and deallocate the extra stack we got.  */\n\
   225 +	jmp	%l0\n\
   226 +	 add	%sp, 6*4, %sp\n\
   227 +	.size   _dl_start_user, . - _dl_start_user\n\
   228  	.previous");
   229  
   230  static inline Elf32_Addr