win32.S: Make the jump tables position-independent Now that non-Windows platforms include win32.S, it needs to support building as position-independent code. This fixes build failures on target platforms that do not allow text relocations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
diff --git a/src/x86/win32.S b/src/x86/win32.S
index 7cbae2a..5ed1221 100644
--- a/src/x86/win32.S
+++ b/src/x86/win32.S
@@ -548,31 +548,33 @@ USCORE_SYMBOL(ffi_call_win32):
call 1f
# Do not insert anything here between the call and the jump table.
.Lstore_table:
- .long .Lnoretval /* FFI_TYPE_VOID */
- .long .Lretint /* FFI_TYPE_INT */
- .long .Lretfloat /* FFI_TYPE_FLOAT */
- .long .Lretdouble /* FFI_TYPE_DOUBLE */
- .long .Lretlongdouble /* FFI_TYPE_LONGDOUBLE */
- .long .Lretuint8 /* FFI_TYPE_UINT8 */
- .long .Lretsint8 /* FFI_TYPE_SINT8 */
- .long .Lretuint16 /* FFI_TYPE_UINT16 */
- .long .Lretsint16 /* FFI_TYPE_SINT16 */
- .long .Lretint /* FFI_TYPE_UINT32 */
- .long .Lretint /* FFI_TYPE_SINT32 */
- .long .Lretint64 /* FFI_TYPE_UINT64 */
- .long .Lretint64 /* FFI_TYPE_SINT64 */
- .long .Lretstruct /* FFI_TYPE_STRUCT */
- .long .Lretint /* FFI_TYPE_POINTER */
- .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */
- .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */
- .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */
- .long .Lretstruct /* FFI_TYPE_MS_STRUCT */
+ .long .Lnoretval-.Lstore_table /* FFI_TYPE_VOID */
+ .long .Lretint-.Lstore_table /* FFI_TYPE_INT */
+ .long .Lretfloat-.Lstore_table /* FFI_TYPE_FLOAT */
+ .long .Lretdouble-.Lstore_table /* FFI_TYPE_DOUBLE */
+ .long .Lretlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */
+ .long .Lretuint8-.Lstore_table /* FFI_TYPE_UINT8 */
+ .long .Lretsint8-.Lstore_table /* FFI_TYPE_SINT8 */
+ .long .Lretuint16-.Lstore_table /* FFI_TYPE_UINT16 */
+ .long .Lretsint16-.Lstore_table /* FFI_TYPE_SINT16 */
+ .long .Lretint-.Lstore_table /* FFI_TYPE_UINT32 */
+ .long .Lretint-.Lstore_table /* FFI_TYPE_SINT32 */
+ .long .Lretint64-.Lstore_table /* FFI_TYPE_UINT64 */
+ .long .Lretint64-.Lstore_table /* FFI_TYPE_SINT64 */
+ .long .Lretstruct-.Lstore_table /* FFI_TYPE_STRUCT */
+ .long .Lretint-.Lstore_table /* FFI_TYPE_POINTER */
+ .long .Lretstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */
+ .long .Lretstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */
+ .long .Lretstruct4b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lretstruct-.Lstore_table /* FFI_TYPE_MS_STRUCT */
1:
add %ecx, %ecx
add %ecx, %ecx
add (%esp),%ecx
+ mov (%ecx),%ecx
+ add (%esp),%ecx
add $4, %esp
- jmp *(%ecx)
+ jmp *%ecx
/* Sign/zero extend as appropriate. */
.Lretsint8:
@@ -704,32 +706,34 @@ USCORE_SYMBOL(ffi_closure_SYSV):
call 1f
# Do not insert anything here between the call and the jump table.
.Lcls_store_table:
- .long .Lcls_noretval /* FFI_TYPE_VOID */
- .long .Lcls_retint /* FFI_TYPE_INT */
- .long .Lcls_retfloat /* FFI_TYPE_FLOAT */
- .long .Lcls_retdouble /* FFI_TYPE_DOUBLE */
- .long .Lcls_retldouble /* FFI_TYPE_LONGDOUBLE */
- .long .Lcls_retuint8 /* FFI_TYPE_UINT8 */
- .long .Lcls_retsint8 /* FFI_TYPE_SINT8 */
- .long .Lcls_retuint16 /* FFI_TYPE_UINT16 */
- .long .Lcls_retsint16 /* FFI_TYPE_SINT16 */
- .long .Lcls_retint /* FFI_TYPE_UINT32 */
- .long .Lcls_retint /* FFI_TYPE_SINT32 */
- .long .Lcls_retllong /* FFI_TYPE_UINT64 */
- .long .Lcls_retllong /* FFI_TYPE_SINT64 */
- .long .Lcls_retstruct /* FFI_TYPE_STRUCT */
- .long .Lcls_retint /* FFI_TYPE_POINTER */
- .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
- .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
- .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
- .long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */
+ .long .Lcls_noretval-.Lcls_store_table /* FFI_TYPE_VOID */
+ .long .Lcls_retint-.Lcls_store_table /* FFI_TYPE_INT */
+ .long .Lcls_retfloat-.Lcls_store_table /* FFI_TYPE_FLOAT */
+ .long .Lcls_retdouble-.Lcls_store_table /* FFI_TYPE_DOUBLE */
+ .long .Lcls_retldouble-.Lcls_store_table /* FFI_TYPE_LONGDOUBLE */
+ .long .Lcls_retuint8-.Lcls_store_table /* FFI_TYPE_UINT8 */
+ .long .Lcls_retsint8-.Lcls_store_table /* FFI_TYPE_SINT8 */
+ .long .Lcls_retuint16-.Lcls_store_table /* FFI_TYPE_UINT16 */
+ .long .Lcls_retsint16-.Lcls_store_table /* FFI_TYPE_SINT16 */
+ .long .Lcls_retint-.Lcls_store_table /* FFI_TYPE_UINT32 */
+ .long .Lcls_retint-.Lcls_store_table /* FFI_TYPE_SINT32 */
+ .long .Lcls_retllong-.Lcls_store_table /* FFI_TYPE_UINT64 */
+ .long .Lcls_retllong-.Lcls_store_table /* FFI_TYPE_SINT64 */
+ .long .Lcls_retstruct-.Lcls_store_table /* FFI_TYPE_STRUCT */
+ .long .Lcls_retint-.Lcls_store_table /* FFI_TYPE_POINTER */
+ .long .Lcls_retstruct1-.Lcls_store_table /* FFI_TYPE_SMALL_STRUCT_1B */
+ .long .Lcls_retstruct2-.Lcls_store_table /* FFI_TYPE_SMALL_STRUCT_2B */
+ .long .Lcls_retstruct4-.Lcls_store_table /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lcls_retmsstruct-.Lcls_store_table /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
add %eax, %eax
add (%esp),%eax
+ mov (%eax),%eax
+ add (%esp),%eax
add $4, %esp
- jmp *(%eax)
+ jmp *%eax
/* Sign/zero extend as appropriate. */
.Lcls_retsint8:
@@ -855,31 +859,33 @@ USCORE_SYMBOL(ffi_closure_raw_SYSV):
call 1f
# Do not insert anything here between the call and the jump table.
.Lrcls_store_table:
- .long .Lrcls_noretval /* FFI_TYPE_VOID */
- .long .Lrcls_retint /* FFI_TYPE_INT */
- .long .Lrcls_retfloat /* FFI_TYPE_FLOAT */
- .long .Lrcls_retdouble /* FFI_TYPE_DOUBLE */
- .long .Lrcls_retldouble /* FFI_TYPE_LONGDOUBLE */
- .long .Lrcls_retuint8 /* FFI_TYPE_UINT8 */
- .long .Lrcls_retsint8 /* FFI_TYPE_SINT8 */
- .long .Lrcls_retuint16 /* FFI_TYPE_UINT16 */
- .long .Lrcls_retsint16 /* FFI_TYPE_SINT16 */
- .long .Lrcls_retint /* FFI_TYPE_UINT32 */
- .long .Lrcls_retint /* FFI_TYPE_SINT32 */
- .long .Lrcls_retllong /* FFI_TYPE_UINT64 */
- .long .Lrcls_retllong /* FFI_TYPE_SINT64 */
- .long .Lrcls_retstruct /* FFI_TYPE_STRUCT */
- .long .Lrcls_retint /* FFI_TYPE_POINTER */
- .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
- .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
- .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
- .long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */
+ .long .Lrcls_noretval-.Lrcls_store_table /* FFI_TYPE_VOID */
+ .long .Lrcls_retint-.Lrcls_store_table /* FFI_TYPE_INT */
+ .long .Lrcls_retfloat-.Lrcls_store_table /* FFI_TYPE_FLOAT */
+ .long .Lrcls_retdouble-.Lrcls_store_table /* FFI_TYPE_DOUBLE */
+ .long .Lrcls_retldouble-.Lrcls_store_table /* FFI_TYPE_LONGDOUBLE */
+ .long .Lrcls_retuint8-.Lrcls_store_table /* FFI_TYPE_UINT8 */
+ .long .Lrcls_retsint8-.Lrcls_store_table /* FFI_TYPE_SINT8 */
+ .long .Lrcls_retuint16-.Lrcls_store_table /* FFI_TYPE_UINT16 */
+ .long .Lrcls_retsint16-.Lrcls_store_table /* FFI_TYPE_SINT16 */
+ .long .Lrcls_retint-.Lrcls_store_table /* FFI_TYPE_UINT32 */
+ .long .Lrcls_retint-.Lrcls_store_table /* FFI_TYPE_SINT32 */
+ .long .Lrcls_retllong-.Lrcls_store_table /* FFI_TYPE_UINT64 */
+ .long .Lrcls_retllong-.Lrcls_store_table /* FFI_TYPE_SINT64 */
+ .long .Lrcls_retstruct-.Lrcls_store_table /* FFI_TYPE_STRUCT */
+ .long .Lrcls_retint-.Lrcls_store_table /* FFI_TYPE_POINTER */
+ .long .Lrcls_retstruct1-.Lrcls_store_table /* FFI_TYPE_SMALL_STRUCT_1B */
+ .long .Lrcls_retstruct2-.Lrcls_store_table /* FFI_TYPE_SMALL_STRUCT_2B */
+ .long .Lrcls_retstruct4-.Lrcls_store_table /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lrcls_retstruct-.Lrcls_store_table /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
add %eax, %eax
add (%esp),%eax
+ mov (%eax),%eax
+ add (%esp),%eax
add $4, %esp
- jmp *(%eax)
+ jmp *%eax
/* Sign/zero extend as appropriate. */
.Lrcls_retsint8:
@@ -980,30 +986,32 @@ USCORE_SYMBOL(ffi_closure_STDCALL):
call 1f
# Do not insert anything here between the call and the jump table.
.Lscls_store_table:
- .long .Lscls_noretval /* FFI_TYPE_VOID */
- .long .Lscls_retint /* FFI_TYPE_INT */
- .long .Lscls_retfloat /* FFI_TYPE_FLOAT */
- .long .Lscls_retdouble /* FFI_TYPE_DOUBLE */
- .long .Lscls_retldouble /* FFI_TYPE_LONGDOUBLE */
- .long .Lscls_retuint8 /* FFI_TYPE_UINT8 */
- .long .Lscls_retsint8 /* FFI_TYPE_SINT8 */
- .long .Lscls_retuint16 /* FFI_TYPE_UINT16 */
- .long .Lscls_retsint16 /* FFI_TYPE_SINT16 */
- .long .Lscls_retint /* FFI_TYPE_UINT32 */
- .long .Lscls_retint /* FFI_TYPE_SINT32 */
- .long .Lscls_retllong /* FFI_TYPE_UINT64 */
- .long .Lscls_retllong /* FFI_TYPE_SINT64 */
- .long .Lscls_retstruct /* FFI_TYPE_STRUCT */
- .long .Lscls_retint /* FFI_TYPE_POINTER */
- .long .Lscls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
- .long .Lscls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
- .long .Lscls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
+ .long .Lscls_noretval-.Lscls_store_table /* FFI_TYPE_VOID */
+ .long .Lscls_retint-.Lscls_store_table /* FFI_TYPE_INT */
+ .long .Lscls_retfloat-.Lscls_store_table /* FFI_TYPE_FLOAT */
+ .long .Lscls_retdouble-.Lscls_store_table /* FFI_TYPE_DOUBLE */
+ .long .Lscls_retldouble-.Lscls_store_table /* FFI_TYPE_LONGDOUBLE */
+ .long .Lscls_retuint8-.Lscls_store_table /* FFI_TYPE_UINT8 */
+ .long .Lscls_retsint8-.Lscls_store_table /* FFI_TYPE_SINT8 */
+ .long .Lscls_retuint16-.Lscls_store_table /* FFI_TYPE_UINT16 */
+ .long .Lscls_retsint16-.Lscls_store_table /* FFI_TYPE_SINT16 */
+ .long .Lscls_retint-.Lscls_store_table /* FFI_TYPE_UINT32 */
+ .long .Lscls_retint-.Lscls_store_table /* FFI_TYPE_SINT32 */
+ .long .Lscls_retllong-.Lscls_store_table /* FFI_TYPE_UINT64 */
+ .long .Lscls_retllong-.Lscls_store_table /* FFI_TYPE_SINT64 */
+ .long .Lscls_retstruct-.Lscls_store_table /* FFI_TYPE_STRUCT */
+ .long .Lscls_retint-.Lscls_store_table /* FFI_TYPE_POINTER */
+ .long .Lscls_retstruct1-.Lscls_store_table /* FFI_TYPE_SMALL_STRUCT_1B */
+ .long .Lscls_retstruct2-.Lscls_store_table /* FFI_TYPE_SMALL_STRUCT_2B */
+ .long .Lscls_retstruct4-.Lscls_store_table /* FFI_TYPE_SMALL_STRUCT_4B */
1:
add %eax, %eax
add %eax, %eax
add (%esp),%eax
+ mov (%eax),%eax
+ add (%esp),%eax
add $4, %esp
- jmp *(%eax)
+ jmp *%eax
/* Sign/zero extend as appropriate. */
.Lscls_retsint8: