patches/glibc/2.2.2/glibc-2.2.2-allow-gcc3-dl-machine-i386.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 Fixes errors:
     2 In file included from dynamic-link.h:21,
     3                  from dl-load.c:32:
     4 ../sysdeps/i386/dl-machine.h:121: error: parse error before '.' token
     5 ../sysdeps/i386/dl-machine.h:122: error: stray '@' in program
     6 ../sysdeps/i386/dl-machine.h:125: error: syntax error at '#' token
     7 ../sysdeps/i386/dl-machine.h:128: error: syntax error at '#' token
     8 ../sysdeps/i386/dl-machine.h:129: error: syntax error at '#' token
     9 ../sysdeps/i386/dl-machine.h:129: error: stray '`' in program
    10 ../sysdeps/i386/dl-machine.h:129: error: missing terminating ' character
    11 ...
    12 ../sysdeps/i386/dl-machine.h:227:22: warning: character constant too long for its type
    13 ../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    14 ../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    15 ../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    16 ../sysdeps/i386/dl-machine.h:209: error: missing terminating " character
    17 ../sysdeps/i386/dl-machine.h: In function `dl_platform_init':
    18 ../sysdeps/i386/dl-machine.h:273: error: `_dl_platform' undeclared (first use in this function)
    19 ../sysdeps/i386/dl-machine.h:273: error: (Each undeclared identifier is reported only once
    20 ../sysdeps/i386/dl-machine.h:273: error: for each function it appears in.)
    21 dl-load.c: In function `_dl_map_object_from_fd':
    22 dl-load.c:1043: warning: use of cast expressions as lvalues is deprecated
    23 dl-load.c:1043: warning: use of cast expressions as lvalues is deprecated
    24 dl-load.c:1058: warning: use of cast expressions as lvalues is deprecated
    25 dl-load.c:1058: warning: use of cast expressions as lvalues is deprecated
    26 
    27 dl-runtime.c:53: error: conflicting types for 'fixup'
    28 ../sysdeps/i386/dl-machine.h:67: error: previous declaration of 'fixup' was here
    29 dl-runtime.c:53: error: conflicting types for 'fixup'
    30 ../sysdeps/i386/dl-machine.h:67: error: previous declaration of 'fixup' was here
    31 dl-runtime.c:135: error: conflicting types for 'profile_fixup'
    32 ../sysdeps/i386/dl-machine.h:70: error: previous declaration of 'profile_fixup' was here
    33 dl-runtime.c:135: error: conflicting types for 'profile_fixup'
    34 ../sysdeps/i386/dl-machine.h:70: error: previous declaration of 'profile_fixup' was here
    35 ../sysdeps/i386/dl-machine.h:67: warning: 'fixup' declared `static' but never defined
    36 ../sysdeps/i386/dl-machine.h:70: warning: 'profile_fixup' declared `static' but never defined
    37 
    38 Updated to repair breakage caused by unconditionally requiring ARCH_FIXUP_ATTRIBUTE
    39 to be defined.  (No wonder glibc-2.2.2 didn't build for anything but x86...)
    40 
    41 ===================================================================
    42 --- glibc-2.2.2/sysdeps/i386/dl-machine.h.old	2005-04-11 17:45:13.000000000 -0700
    43 +++ glibc-2.2.2/sysdeps/i386/dl-machine.h	2005-04-12 10:01:47.000000000 -0700
    44 @@ -63,11 +63,14 @@
    45     destroys the passed register information.  */
    46  /* GKM FIXME: Fix trampoline to pass bounds so we can do
    47     without the `__unbounded' qualifier.  */
    48 +
    49 +#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused))
    50 +
    51  static ElfW(Addr) fixup (struct link_map *__unbounded l, ElfW(Word) reloc_offset)
    52 -     __attribute__ ((regparm (2), unused));
    53 +     ARCH_FIXUP_ATTRIBUTE;
    54  static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset,
    55  				 ElfW(Addr) retaddr)
    56 -     __attribute__ ((regparm (3), unused));
    57 +     ARCH_FIXUP_ATTRIBUTE;
    58  #endif
    59  
    60  /* Set up the loaded object described by L so its unrelocated PLT
    61 @@ -117,68 +120,68 @@
    62     and then redirect to the address it returns.  */
    63  #if !defined PROF && !__BOUNDED_POINTERS__
    64  # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
    65 -	.text
    66 -	.globl _dl_runtime_resolve
    67 -	.type _dl_runtime_resolve, @function
    68 -	.align 16
    69 -_dl_runtime_resolve:
    70 -	pushl %eax		# Preserve registers otherwise clobbered.
    71 -	pushl %ecx
    72 -	pushl %edx
    73 -	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note
    74 -	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.
    75 -	call fixup		# Call resolver.
    76 -	popl %edx		# Get register content back.
    77 -	popl %ecx
    78 -	xchgl %eax, (%esp)	# Get %eax contents end store function address.
    79 -	ret $8			# Jump to function address.
    80 -	.size _dl_runtime_resolve, .-_dl_runtime_resolve
    81 -
    82 -	.globl _dl_runtime_profile
    83 -	.type _dl_runtime_profile, @function
    84 -	.align 16
    85 -_dl_runtime_profile:
    86 -	pushl %eax		# Preserve registers otherwise clobbered.
    87 -	pushl %ecx
    88 -	pushl %edx
    89 -	movl 20(%esp), %ecx	# Load return address
    90 -	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note
    91 -	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.
    92 -	call profile_fixup	# Call resolver.
    93 -	popl %edx		# Get register content back.
    94 -	popl %ecx
    95 -	xchgl %eax, (%esp)	# Get %eax contents end store function address.
    96 -	ret $8			# Jump to function address.
    97 -	.size _dl_runtime_profile, .-_dl_runtime_profile
    98 -	.previous
    99 +	.text\n\
   100 +	.globl _dl_runtime_resolve\n\
   101 +	.type _dl_runtime_resolve, @function\n\
   102 +	.align 16\n\
   103 +_dl_runtime_resolve:\n\
   104 +	pushl %eax		# Preserve registers otherwise clobbered.\n\
   105 +	pushl %ecx\n\
   106 +	pushl %edx\n\
   107 +	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
   108 +	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
   109 +	call fixup		# Call resolver.\n\
   110 +	popl %edx		# Get register content back.\n\
   111 +	popl %ecx\n\
   112 +	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   113 +	ret $8			# Jump to function address.\n\
   114 +	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
   115 +\n\
   116 +	.globl _dl_runtime_profile\n\
   117 +	.type _dl_runtime_profile, @function\n\
   118 +	.align 16\n\
   119 +_dl_runtime_profile:\n\
   120 +	pushl %eax		# Preserve registers otherwise clobbered.\n\
   121 +	pushl %ecx\n\
   122 +	pushl %edx\n\
   123 +	movl 20(%esp), %ecx	# Load return address\n\
   124 +	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
   125 +	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
   126 +	call profile_fixup	# Call resolver.\n\
   127 +	popl %edx		# Get register content back.\n\
   128 +	popl %ecx\n\
   129 +	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   130 +	ret $8			# Jump to function address.\n\
   131 +	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
   132 +	.previous\n\
   133  ");
   134  #else
   135 -# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
   136 -	.text
   137 -	.globl _dl_runtime_resolve
   138 -	.globl _dl_runtime_profile
   139 -	.type _dl_runtime_resolve, @function
   140 -	.type _dl_runtime_profile, @function
   141 -	.align 16
   142 -_dl_runtime_resolve:
   143 -_dl_runtime_profile:
   144 -	pushl %eax		# Preserve registers otherwise clobbered.
   145 -	pushl %ecx
   146 -	pushl %edx
   147 -	movl 16(%esp), %edx	# Push the arguments for `fixup'
   148 -	movl 12(%esp), %eax
   149 -	pushl %edx
   150 -	pushl %eax
   151 -	call fixup		# Call resolver.
   152 -	popl %edx		# Pop the parameters
   153 -	popl %ecx
   154 -	popl %edx		# Get register content back.
   155 -	popl %ecx
   156 -	xchgl %eax, (%esp)	# Get %eax contents end store function address.
   157 -	ret $8			# Jump to function address.
   158 -	.size _dl_runtime_resolve, .-_dl_runtime_resolve
   159 -	.size _dl_runtime_profile, .-_dl_runtime_profile
   160 -	.previous
   161 +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
   162 +	.text\n\
   163 +	.globl _dl_runtime_resolve\n\
   164 +	.globl _dl_runtime_profile\n\
   165 +	.type _dl_runtime_resolve, @function\n\
   166 +	.type _dl_runtime_profile, @function\n\
   167 +	.align 16\n\
   168 +_dl_runtime_resolve:\n\
   169 +_dl_runtime_profile:\n\
   170 +	pushl %eax		# Preserve registers otherwise clobbered.\n\
   171 +	pushl %ecx\n\
   172 +	pushl %edx\n\
   173 +	movl 16(%esp), %edx	# Push the arguments for `fixup'\n\
   174 +	movl 12(%esp), %eax\n\
   175 +	pushl %edx\n\
   176 +	pushl %eax\n\
   177 +	call fixup		# Call resolver.\n\
   178 +	popl %edx		# Pop the parameters\n\
   179 +	popl %ecx\n\
   180 +	popl %edx		# Get register content back.\n\
   181 +	popl %ecx\n\
   182 +	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   183 +	ret $8			# Jump to function address.\n\
   184 +	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
   185 +	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
   186 +	.previous\n\
   187  ");
   188  #endif
   189  
   190 @@ -205,7 +208,7 @@
   191  _dl_start_user:\n\
   192  	# Save the user entry point address in %edi.\n\
   193  	movl %eax, %edi\n\
   194 -	# Point %ebx at the GOT.
   195 +	# Point %ebx at the GOT.\n\
   196  	call 0b\n\
   197  	addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\
   198  	# Store the highest stack address\n\
   199 
   200 ===================================================================
   201 --- glibc-2.2.2/elf/dl-runtime.c.old	2005-07-07 15:40:26.000000000 -0700
   202 +++ glibc-2.2.2/elf/dl-runtime.c	2005-07-07 15:41:57.000000000 -0700
   203 @@ -33,6 +33,11 @@
   204  # define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
   205  #endif
   206  
   207 +/* The fixup functions might have need special attributes.  If none
   208 +   are provided define the macro as empty.  */
   209 +#ifndef ARCH_FIXUP_ATTRIBUTE
   210 +# define ARCH_FIXUP_ATTRIBUTE
   211 +#endif
   212  
   213  /* This function is called through a special trampoline from the PLT the
   214     first time each PLT entry is called.  We must perform the relocation
   215 @@ -42,7 +47,7 @@
   216     function.  */
   217  
   218  #ifndef ELF_MACHINE_NO_PLT
   219 -static ElfW(Addr) __attribute__ ((unused))
   220 +static ElfW(Addr) __attribute__ ((unused)) ARCH_FIXUP_ATTRIBUTE
   221  fixup (
   222  # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
   223          ELF_MACHINE_RUNTIME_FIXUP_ARGS,
   224 @@ -126,7 +131,7 @@
   225  
   226  #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
   227  
   228 -static ElfW(Addr) __attribute__ ((unused))
   229 +static ElfW(Addr) __attribute__ ((unused)) ARCH_FIXUP_ATTRIBUTE
   230  profile_fixup (
   231  #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
   232         ELF_MACHINE_RUNTIME_FIXUP_ARGS,