patches/glibc/2.2.2/glibc-2.2.2-allow-gcc3-dl-machine-i386.patch
changeset 329 419d959441ed
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.2.2/glibc-2.2.2-allow-gcc3-dl-machine-i386.patch	Tue Aug 14 19:32:22 2007 +0000
     1.3 @@ -0,0 +1,232 @@
     1.4 +Fixes errors:
     1.5 +In file included from dynamic-link.h:21,
     1.6 +                 from dl-load.c:32:
     1.7 +../sysdeps/i386/dl-machine.h:121: error: parse error before '.' token
     1.8 +../sysdeps/i386/dl-machine.h:122: error: stray '@' in program
     1.9 +../sysdeps/i386/dl-machine.h:125: error: syntax error at '#' token
    1.10 +../sysdeps/i386/dl-machine.h:128: error: syntax error at '#' token
    1.11 +../sysdeps/i386/dl-machine.h:129: error: syntax error at '#' token
    1.12 +../sysdeps/i386/dl-machine.h:129: error: stray '`' in program
    1.13 +../sysdeps/i386/dl-machine.h:129: error: missing terminating ' character
    1.14 +...
    1.15 +../sysdeps/i386/dl-machine.h:227:22: warning: character constant too long for its type
    1.16 +../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    1.17 +../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    1.18 +../sysdeps/i386/dl-machine.h:209: error: stray '\' in program
    1.19 +../sysdeps/i386/dl-machine.h:209: error: missing terminating " character
    1.20 +../sysdeps/i386/dl-machine.h: In function `dl_platform_init':
    1.21 +../sysdeps/i386/dl-machine.h:273: error: `_dl_platform' undeclared (first use in this function)
    1.22 +../sysdeps/i386/dl-machine.h:273: error: (Each undeclared identifier is reported only once
    1.23 +../sysdeps/i386/dl-machine.h:273: error: for each function it appears in.)
    1.24 +dl-load.c: In function `_dl_map_object_from_fd':
    1.25 +dl-load.c:1043: warning: use of cast expressions as lvalues is deprecated
    1.26 +dl-load.c:1043: warning: use of cast expressions as lvalues is deprecated
    1.27 +dl-load.c:1058: warning: use of cast expressions as lvalues is deprecated
    1.28 +dl-load.c:1058: warning: use of cast expressions as lvalues is deprecated
    1.29 +
    1.30 +dl-runtime.c:53: error: conflicting types for 'fixup'
    1.31 +../sysdeps/i386/dl-machine.h:67: error: previous declaration of 'fixup' was here
    1.32 +dl-runtime.c:53: error: conflicting types for 'fixup'
    1.33 +../sysdeps/i386/dl-machine.h:67: error: previous declaration of 'fixup' was here
    1.34 +dl-runtime.c:135: error: conflicting types for 'profile_fixup'
    1.35 +../sysdeps/i386/dl-machine.h:70: error: previous declaration of 'profile_fixup' was here
    1.36 +dl-runtime.c:135: error: conflicting types for 'profile_fixup'
    1.37 +../sysdeps/i386/dl-machine.h:70: error: previous declaration of 'profile_fixup' was here
    1.38 +../sysdeps/i386/dl-machine.h:67: warning: 'fixup' declared `static' but never defined
    1.39 +../sysdeps/i386/dl-machine.h:70: warning: 'profile_fixup' declared `static' but never defined
    1.40 +
    1.41 +Updated to repair breakage caused by unconditionally requiring ARCH_FIXUP_ATTRIBUTE
    1.42 +to be defined.  (No wonder glibc-2.2.2 didn't build for anything but x86...)
    1.43 +
    1.44 +===================================================================
    1.45 +--- glibc-2.2.2/sysdeps/i386/dl-machine.h.old	2005-04-11 17:45:13.000000000 -0700
    1.46 ++++ glibc-2.2.2/sysdeps/i386/dl-machine.h	2005-04-12 10:01:47.000000000 -0700
    1.47 +@@ -63,11 +63,14 @@
    1.48 +    destroys the passed register information.  */
    1.49 + /* GKM FIXME: Fix trampoline to pass bounds so we can do
    1.50 +    without the `__unbounded' qualifier.  */
    1.51 ++
    1.52 ++#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused))
    1.53 ++
    1.54 + static ElfW(Addr) fixup (struct link_map *__unbounded l, ElfW(Word) reloc_offset)
    1.55 +-     __attribute__ ((regparm (2), unused));
    1.56 ++     ARCH_FIXUP_ATTRIBUTE;
    1.57 + static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset,
    1.58 + 				 ElfW(Addr) retaddr)
    1.59 +-     __attribute__ ((regparm (3), unused));
    1.60 ++     ARCH_FIXUP_ATTRIBUTE;
    1.61 + #endif
    1.62 + 
    1.63 + /* Set up the loaded object described by L so its unrelocated PLT
    1.64 +@@ -117,68 +120,68 @@
    1.65 +    and then redirect to the address it returns.  */
    1.66 + #if !defined PROF && !__BOUNDED_POINTERS__
    1.67 + # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
    1.68 +-	.text
    1.69 +-	.globl _dl_runtime_resolve
    1.70 +-	.type _dl_runtime_resolve, @function
    1.71 +-	.align 16
    1.72 +-_dl_runtime_resolve:
    1.73 +-	pushl %eax		# Preserve registers otherwise clobbered.
    1.74 +-	pushl %ecx
    1.75 +-	pushl %edx
    1.76 +-	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note
    1.77 +-	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.
    1.78 +-	call fixup		# Call resolver.
    1.79 +-	popl %edx		# Get register content back.
    1.80 +-	popl %ecx
    1.81 +-	xchgl %eax, (%esp)	# Get %eax contents end store function address.
    1.82 +-	ret $8			# Jump to function address.
    1.83 +-	.size _dl_runtime_resolve, .-_dl_runtime_resolve
    1.84 +-
    1.85 +-	.globl _dl_runtime_profile
    1.86 +-	.type _dl_runtime_profile, @function
    1.87 +-	.align 16
    1.88 +-_dl_runtime_profile:
    1.89 +-	pushl %eax		# Preserve registers otherwise clobbered.
    1.90 +-	pushl %ecx
    1.91 +-	pushl %edx
    1.92 +-	movl 20(%esp), %ecx	# Load return address
    1.93 +-	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note
    1.94 +-	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.
    1.95 +-	call profile_fixup	# Call resolver.
    1.96 +-	popl %edx		# Get register content back.
    1.97 +-	popl %ecx
    1.98 +-	xchgl %eax, (%esp)	# Get %eax contents end store function address.
    1.99 +-	ret $8			# Jump to function address.
   1.100 +-	.size _dl_runtime_profile, .-_dl_runtime_profile
   1.101 +-	.previous
   1.102 ++	.text\n\
   1.103 ++	.globl _dl_runtime_resolve\n\
   1.104 ++	.type _dl_runtime_resolve, @function\n\
   1.105 ++	.align 16\n\
   1.106 ++_dl_runtime_resolve:\n\
   1.107 ++	pushl %eax		# Preserve registers otherwise clobbered.\n\
   1.108 ++	pushl %ecx\n\
   1.109 ++	pushl %edx\n\
   1.110 ++	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
   1.111 ++	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
   1.112 ++	call fixup		# Call resolver.\n\
   1.113 ++	popl %edx		# Get register content back.\n\
   1.114 ++	popl %ecx\n\
   1.115 ++	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   1.116 ++	ret $8			# Jump to function address.\n\
   1.117 ++	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
   1.118 ++\n\
   1.119 ++	.globl _dl_runtime_profile\n\
   1.120 ++	.type _dl_runtime_profile, @function\n\
   1.121 ++	.align 16\n\
   1.122 ++_dl_runtime_profile:\n\
   1.123 ++	pushl %eax		# Preserve registers otherwise clobbered.\n\
   1.124 ++	pushl %ecx\n\
   1.125 ++	pushl %edx\n\
   1.126 ++	movl 20(%esp), %ecx	# Load return address\n\
   1.127 ++	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
   1.128 ++	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
   1.129 ++	call profile_fixup	# Call resolver.\n\
   1.130 ++	popl %edx		# Get register content back.\n\
   1.131 ++	popl %ecx\n\
   1.132 ++	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   1.133 ++	ret $8			# Jump to function address.\n\
   1.134 ++	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
   1.135 ++	.previous\n\
   1.136 + ");
   1.137 + #else
   1.138 +-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
   1.139 +-	.text
   1.140 +-	.globl _dl_runtime_resolve
   1.141 +-	.globl _dl_runtime_profile
   1.142 +-	.type _dl_runtime_resolve, @function
   1.143 +-	.type _dl_runtime_profile, @function
   1.144 +-	.align 16
   1.145 +-_dl_runtime_resolve:
   1.146 +-_dl_runtime_profile:
   1.147 +-	pushl %eax		# Preserve registers otherwise clobbered.
   1.148 +-	pushl %ecx
   1.149 +-	pushl %edx
   1.150 +-	movl 16(%esp), %edx	# Push the arguments for `fixup'
   1.151 +-	movl 12(%esp), %eax
   1.152 +-	pushl %edx
   1.153 +-	pushl %eax
   1.154 +-	call fixup		# Call resolver.
   1.155 +-	popl %edx		# Pop the parameters
   1.156 +-	popl %ecx
   1.157 +-	popl %edx		# Get register content back.
   1.158 +-	popl %ecx
   1.159 +-	xchgl %eax, (%esp)	# Get %eax contents end store function address.
   1.160 +-	ret $8			# Jump to function address.
   1.161 +-	.size _dl_runtime_resolve, .-_dl_runtime_resolve
   1.162 +-	.size _dl_runtime_profile, .-_dl_runtime_profile
   1.163 +-	.previous
   1.164 ++# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
   1.165 ++	.text\n\
   1.166 ++	.globl _dl_runtime_resolve\n\
   1.167 ++	.globl _dl_runtime_profile\n\
   1.168 ++	.type _dl_runtime_resolve, @function\n\
   1.169 ++	.type _dl_runtime_profile, @function\n\
   1.170 ++	.align 16\n\
   1.171 ++_dl_runtime_resolve:\n\
   1.172 ++_dl_runtime_profile:\n\
   1.173 ++	pushl %eax		# Preserve registers otherwise clobbered.\n\
   1.174 ++	pushl %ecx\n\
   1.175 ++	pushl %edx\n\
   1.176 ++	movl 16(%esp), %edx	# Push the arguments for `fixup'\n\
   1.177 ++	movl 12(%esp), %eax\n\
   1.178 ++	pushl %edx\n\
   1.179 ++	pushl %eax\n\
   1.180 ++	call fixup		# Call resolver.\n\
   1.181 ++	popl %edx		# Pop the parameters\n\
   1.182 ++	popl %ecx\n\
   1.183 ++	popl %edx		# Get register content back.\n\
   1.184 ++	popl %ecx\n\
   1.185 ++	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
   1.186 ++	ret $8			# Jump to function address.\n\
   1.187 ++	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
   1.188 ++	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
   1.189 ++	.previous\n\
   1.190 + ");
   1.191 + #endif
   1.192 + 
   1.193 +@@ -205,7 +208,7 @@
   1.194 + _dl_start_user:\n\
   1.195 + 	# Save the user entry point address in %edi.\n\
   1.196 + 	movl %eax, %edi\n\
   1.197 +-	# Point %ebx at the GOT.
   1.198 ++	# Point %ebx at the GOT.\n\
   1.199 + 	call 0b\n\
   1.200 + 	addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\
   1.201 + 	# Store the highest stack address\n\
   1.202 +
   1.203 +===================================================================
   1.204 +--- glibc-2.2.2/elf/dl-runtime.c.old	2005-07-07 15:40:26.000000000 -0700
   1.205 ++++ glibc-2.2.2/elf/dl-runtime.c	2005-07-07 15:41:57.000000000 -0700
   1.206 +@@ -33,6 +33,11 @@
   1.207 + # define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
   1.208 + #endif
   1.209 + 
   1.210 ++/* The fixup functions might have need special attributes.  If none
   1.211 ++   are provided define the macro as empty.  */
   1.212 ++#ifndef ARCH_FIXUP_ATTRIBUTE
   1.213 ++# define ARCH_FIXUP_ATTRIBUTE
   1.214 ++#endif
   1.215 + 
   1.216 + /* This function is called through a special trampoline from the PLT the
   1.217 +    first time each PLT entry is called.  We must perform the relocation
   1.218 +@@ -42,7 +47,7 @@
   1.219 +    function.  */
   1.220 + 
   1.221 + #ifndef ELF_MACHINE_NO_PLT
   1.222 +-static ElfW(Addr) __attribute__ ((unused))
   1.223 ++static ElfW(Addr) __attribute__ ((unused)) ARCH_FIXUP_ATTRIBUTE
   1.224 + fixup (
   1.225 + # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
   1.226 +         ELF_MACHINE_RUNTIME_FIXUP_ARGS,
   1.227 +@@ -126,7 +131,7 @@
   1.228 + 
   1.229 + #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
   1.230 + 
   1.231 +-static ElfW(Addr) __attribute__ ((unused))
   1.232 ++static ElfW(Addr) __attribute__ ((unused)) ARCH_FIXUP_ATTRIBUTE
   1.233 + profile_fixup (
   1.234 + #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
   1.235 +        ELF_MACHINE_RUNTIME_FIXUP_ARGS,