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