| 1 | .file "weak4-2.s" | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 | .text | 
|---|
| 5 |  | 
|---|
| 6 | .align 4,0xcc | 
|---|
| 7 | nop | 
|---|
| 8 | int $41 | 
|---|
| 9 | nop | 
|---|
| 10 |  | 
|---|
| 11 | .align 3,0xcc | 
|---|
| 12 | .globl _check_weaktext | 
|---|
| 13 | /* | 
|---|
| 14 | * Check up weak text. | 
|---|
| 15 | */ | 
|---|
| 16 | _check_weaktext: | 
|---|
| 17 | xorl    %eax, %eax | 
|---|
| 18 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 19 | call    _weaktext+6 | 
|---|
| 20 | orl     %eax, %eax | 
|---|
| 21 | jnz     failure | 
|---|
| 22 |  | 
|---|
| 23 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 24 | leal    _weaktext+6, %ecx | 
|---|
| 25 | call    *%ecx | 
|---|
| 26 | orl     %eax, %eax | 
|---|
| 27 | jnz     failure | 
|---|
| 28 | jmp     done | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | .align 3,0xcc | 
|---|
| 32 | .globl _check_weakdata | 
|---|
| 33 | /* | 
|---|
| 34 | * Check up weak data. | 
|---|
| 35 | */ | 
|---|
| 36 | _check_weakdata: | 
|---|
| 37 | movl    _weakdata+12, %eax | 
|---|
| 38 | cmpl    $3, %eax | 
|---|
| 39 | jnz     failure | 
|---|
| 40 |  | 
|---|
| 41 | lea     _weakdata+20, %eax | 
|---|
| 42 | movl    (%eax), %eax | 
|---|
| 43 | cmpl    $5, %eax | 
|---|
| 44 | jnz     failure | 
|---|
| 45 | jmp     done | 
|---|
| 46 |  | 
|---|
| 47 | .align 3,0xcc | 
|---|
| 48 | .globl _check_weakbss | 
|---|
| 49 | /* | 
|---|
| 50 | * Check up weak bss. | 
|---|
| 51 | */ | 
|---|
| 52 | _check_weakbss: | 
|---|
| 53 | movl    _weakbss+12, %eax | 
|---|
| 54 | cmpl    $3, %eax | 
|---|
| 55 | jnz     failure | 
|---|
| 56 |  | 
|---|
| 57 | lea     _weakbss+20, %eax | 
|---|
| 58 | movl    (%eax), %eax | 
|---|
| 59 | cmpl    $5, %eax | 
|---|
| 60 | jnz     failure | 
|---|
| 61 | jmp     done | 
|---|
| 62 |  | 
|---|
| 63 | .align 3,0xcc | 
|---|
| 64 | .globl _check_weakundef | 
|---|
| 65 | /* | 
|---|
| 66 | * Check up weak undef (in main). | 
|---|
| 67 | */ | 
|---|
| 68 | _check_weakundef: | 
|---|
| 69 | .weak _weakundef | 
|---|
| 70 | movl    _weakundef+12, %eax | 
|---|
| 71 | cmpl    $3, %eax | 
|---|
| 72 | jnz     failure | 
|---|
| 73 |  | 
|---|
| 74 | lea     _weakundef+20, %eax | 
|---|
| 75 | movl    (%eax), %eax | 
|---|
| 76 | cmpl    $5, %eax | 
|---|
| 77 | jnz     failure | 
|---|
| 78 | jmp     done | 
|---|
| 79 |  | 
|---|
| 80 | .align 3,0xcc | 
|---|
| 81 | .globl _check_weakabs | 
|---|
| 82 | /* | 
|---|
| 83 | * Check up weak abs (=0xdead) | 
|---|
| 84 | */ | 
|---|
| 85 | _check_weakabs: | 
|---|
| 86 | leal    _weakabs, %eax | 
|---|
| 87 | cmpl    $0xdead, %eax | 
|---|
| 88 | jnz     failure | 
|---|
| 89 |  | 
|---|
| 90 | leal    _weakabs+2, %eax | 
|---|
| 91 | cmpl    $0xdeaf, %eax | 
|---|
| 92 | jnz     failure | 
|---|
| 93 | jmp     done | 
|---|
| 94 |  | 
|---|
| 95 |  | 
|---|
| 96 | .align 3,0xcc | 
|---|
| 97 | .globl _check_weaktext_localdefault | 
|---|
| 98 | /* | 
|---|
| 99 | * Check up weak text with a local default. | 
|---|
| 100 | */ | 
|---|
| 101 | _check_weaktext_localdefault: | 
|---|
| 102 | /* resolved weak */ | 
|---|
| 103 | .weak _weaktext_localdefault_extrn | 
|---|
| 104 | .set _weaktext_localdefault_extrn, _weaktext_localdefault | 
|---|
| 105 | xorl    %eax, %eax | 
|---|
| 106 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 107 | call    _weaktext_localdefault_extrn+5 | 
|---|
| 108 | orl     %eax, %eax | 
|---|
| 109 | jnz     failure | 
|---|
| 110 |  | 
|---|
| 111 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 112 | leal    _weaktext_localdefault_extrn+5, %ecx | 
|---|
| 113 | call    *%ecx | 
|---|
| 114 | orl     %eax, %eax | 
|---|
| 115 | jnz     failure | 
|---|
| 116 |  | 
|---|
| 117 | /* unresolved weak */ | 
|---|
| 118 | .weak _weaktext_localdefault_extrn_unresolved | 
|---|
| 119 | .set _weaktext_localdefault_extrn_unresolved, _weaktext_localdefault | 
|---|
| 120 | xorl    %eax, %eax | 
|---|
| 121 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 122 | call    _weaktext_localdefault_extrn_unresolved+6 | 
|---|
| 123 | orl     %eax, %eax | 
|---|
| 124 | jnz     failure | 
|---|
| 125 |  | 
|---|
| 126 | inc     %eax                        /* eax = non-zero */ | 
|---|
| 127 | leal    _weaktext_localdefault_extrn_unresolved+6, %ecx | 
|---|
| 128 | call    *%ecx | 
|---|
| 129 | orl     %eax, %eax | 
|---|
| 130 | jnz     failure | 
|---|
| 131 | jmp     done | 
|---|
| 132 |  | 
|---|
| 133 |  | 
|---|
| 134 | .align 3,0xcc | 
|---|
| 135 | .globl _check_weakdata_localdefault | 
|---|
| 136 | /* | 
|---|
| 137 | * Check up weak data with a local default. | 
|---|
| 138 | */ | 
|---|
| 139 | _check_weakdata_localdefault: | 
|---|
| 140 | /* resolved weak */ | 
|---|
| 141 | .weak _weakdata_localdefault_extrn | 
|---|
| 142 | .set _weakdata_localdefault_extrn, _weakdata_localdefault | 
|---|
| 143 | movl    _weakdata_localdefault_extrn+12, %eax | 
|---|
| 144 | cmpl    $13, %eax | 
|---|
| 145 | jnz     failure | 
|---|
| 146 |  | 
|---|
| 147 | lea     _weakdata_localdefault_extrn+20, %eax | 
|---|
| 148 | movl    (%eax), %eax | 
|---|
| 149 | cmpl    $15, %eax | 
|---|
| 150 | jnz     failure | 
|---|
| 151 |  | 
|---|
| 152 | /* unresolved weak */ | 
|---|
| 153 | .weak _weakdata_localdefault_extrn_unresolved | 
|---|
| 154 | .set _weakdata_localdefault_extrn_unresolved, _weakdata_localdefault | 
|---|
| 155 | movl    _weakdata_localdefault_extrn_unresolved+12, %eax | 
|---|
| 156 | cmpl    $3, %eax | 
|---|
| 157 | jnz     failure | 
|---|
| 158 |  | 
|---|
| 159 | lea     _weakdata_localdefault_extrn_unresolved+20, %eax | 
|---|
| 160 | movl    (%eax), %eax | 
|---|
| 161 | cmpl    $5, %eax | 
|---|
| 162 | jnz     failure | 
|---|
| 163 | jmp     done | 
|---|
| 164 |  | 
|---|
| 165 |  | 
|---|
| 166 | .align 3,0xcc | 
|---|
| 167 | .globl _check_weakbss_localdefault | 
|---|
| 168 | /* | 
|---|
| 169 | * Check up weak bss with a local default. | 
|---|
| 170 | */ | 
|---|
| 171 | _check_weakbss_localdefault: | 
|---|
| 172 | /* resolved weak */ | 
|---|
| 173 | .weak _weakbss_localdefault_extrn | 
|---|
| 174 | .set _weakbss_localdefault_extrn, _weakbss_localdefault | 
|---|
| 175 | movl    _weakbss_localdefault_extrn+12, %eax | 
|---|
| 176 | cmpl    $13, %eax | 
|---|
| 177 | jnz     failure | 
|---|
| 178 |  | 
|---|
| 179 | lea     _weakbss_localdefault_extrn+20, %eax | 
|---|
| 180 | movl    (%eax), %eax | 
|---|
| 181 | cmpl    $15, %eax | 
|---|
| 182 | jnz     failure | 
|---|
| 183 |  | 
|---|
| 184 | /* unresolved weak */ | 
|---|
| 185 | .weak _weakbss_localdefault_extrn_unresolved | 
|---|
| 186 | .set _weakbss_localdefault_extrn_unresolved, _weakbss_localdefault | 
|---|
| 187 | movl    _weakbss_localdefault_extrn_unresolved+12, %eax | 
|---|
| 188 | cmpl    $3, %eax | 
|---|
| 189 | jnz     failure | 
|---|
| 190 |  | 
|---|
| 191 | lea     _weakbss_localdefault_extrn_unresolved+20, %eax | 
|---|
| 192 | movl    (%eax), %eax | 
|---|
| 193 | cmpl    $5, %eax | 
|---|
| 194 | jnz     failure | 
|---|
| 195 | jmp     done | 
|---|
| 196 |  | 
|---|
| 197 |  | 
|---|
| 198 | .align 3,0xcc | 
|---|
| 199 | .globl _check_weakundef_externdefault | 
|---|
| 200 | /* | 
|---|
| 201 | * Check up weak bss with an undefined default. | 
|---|
| 202 | */ | 
|---|
| 203 | _check_weakundef_externdefault: | 
|---|
| 204 | /* resolved weak */ | 
|---|
| 205 | .weak _weakundef_externdefault_extrn | 
|---|
| 206 | .set _weakundef_externdefault_extrn, _weakundef_externdefault | 
|---|
| 207 | movl    _weakundef_externdefault_extrn+8, %eax | 
|---|
| 208 | cmpl    $12, %eax | 
|---|
| 209 | jnz     failure | 
|---|
| 210 |  | 
|---|
| 211 | lea     _weakundef_externdefault_extrn+20, %eax | 
|---|
| 212 | movl    (%eax), %eax | 
|---|
| 213 | cmpl    $15, %eax | 
|---|
| 214 | jnz     failure | 
|---|
| 215 |  | 
|---|
| 216 | /* unresolved weak */ | 
|---|
| 217 | .weak _weakundef_externdefault_extrn_unresolved | 
|---|
| 218 | .set _weakundef_externdefault_extrn_unresolved, _weakundef_externdefault | 
|---|
| 219 | movl    _weakundef_externdefault_extrn_unresolved+12, %eax | 
|---|
| 220 | cmpl    $3, %eax | 
|---|
| 221 | jnz     failure | 
|---|
| 222 |  | 
|---|
| 223 | lea     _weakundef_externdefault_extrn_unresolved+20, %eax | 
|---|
| 224 | movl    (%eax), %eax | 
|---|
| 225 | cmpl    $5, %eax | 
|---|
| 226 | jnz     failure | 
|---|
| 227 | jmp     done | 
|---|
| 228 |  | 
|---|
| 229 |  | 
|---|
| 230 | .align 3,0xcc | 
|---|
| 231 | .globl _check_weakabs_localdefault | 
|---|
| 232 | /* | 
|---|
| 233 | * Check up weak bss with an undefined default. | 
|---|
| 234 | */ | 
|---|
| 235 | _check_weakabs_localdefault: | 
|---|
| 236 | /* resolved weak */ | 
|---|
| 237 | .weak _weakabs_localdefault_extrn | 
|---|
| 238 | .set _weakabs_localdefault_extrn, _weakabs_localdefault | 
|---|
| 239 | leal    _weakabs_localdefault_extrn, %eax | 
|---|
| 240 | cmpl    $0xbeef, %eax | 
|---|
| 241 | jnz     failure | 
|---|
| 242 |  | 
|---|
| 243 | leal    _weakabs_localdefault_extrn+2, %eax | 
|---|
| 244 | cmpl    $0xbef1, %eax | 
|---|
| 245 | jnz     failure | 
|---|
| 246 |  | 
|---|
| 247 | /* unresolved weak */ | 
|---|
| 248 | .weak _weakabs_localdefault_extrn_unresolved | 
|---|
| 249 | .set _weakabs_localdefault_extrn_unresolved, _weakabs_localdefault | 
|---|
| 250 | leal    _weakabs_localdefault_extrn_unresolved, %eax | 
|---|
| 251 | cmpl    $0xdead, %eax | 
|---|
| 252 | jnz     failure | 
|---|
| 253 |  | 
|---|
| 254 | leal    _weakabs_localdefault_extrn_unresolved+2, %eax | 
|---|
| 255 | cmpl    $0xdeaf, %eax | 
|---|
| 256 | jnz     failure | 
|---|
| 257 | jmp     done | 
|---|
| 258 |  | 
|---|
| 259 |  | 
|---|
| 260 | done: | 
|---|
| 261 | xorl    %eax, %eax | 
|---|
| 262 | ret | 
|---|
| 263 | failure: | 
|---|
| 264 | movl    $1, %eax | 
|---|
| 265 | ret | 
|---|
| 266 |  | 
|---|
| 267 |  | 
|---|
| 268 | /* | 
|---|
| 269 | * Weak text. | 
|---|
| 270 | */ | 
|---|
| 271 | .align 4,0xcc | 
|---|
| 272 | nop | 
|---|
| 273 | int $42 | 
|---|
| 274 | nop | 
|---|
| 275 | .align 3,0xcc | 
|---|
| 276 | .weak _weaktext | 
|---|
| 277 | _weaktext: | 
|---|
| 278 | _weaktext_localdefault: | 
|---|
| 279 | ret                                 /* 0 */ | 
|---|
| 280 | ret                                 /* 1 */ | 
|---|
| 281 | ret                                 /* 2 */ | 
|---|
| 282 | ret                                 /* 3 */ | 
|---|
| 283 | ret                                 /* 4 */ | 
|---|
| 284 | ret                                 /* 5 */ | 
|---|
| 285 | xorl %eax, %eax                     /* 6 */ | 
|---|
| 286 | ret | 
|---|
| 287 | ret | 
|---|
| 288 | ret | 
|---|
| 289 | ret | 
|---|
| 290 |  | 
|---|
| 291 |  | 
|---|
| 292 | /* | 
|---|
| 293 | * Weak data. | 
|---|
| 294 | */ | 
|---|
| 295 | .data | 
|---|
| 296 | .space 16 | 
|---|
| 297 | .weak _weakdata | 
|---|
| 298 | _weakdata: | 
|---|
| 299 | _weakdata_localdefault: | 
|---|
| 300 | .long   0 | 
|---|
| 301 | .long   1 | 
|---|
| 302 | .long   2 | 
|---|
| 303 | .long   3 | 
|---|
| 304 | .long   4 | 
|---|
| 305 | .long   5 | 
|---|
| 306 | .long   6 | 
|---|
| 307 | .long   7 | 
|---|
| 308 |  | 
|---|
| 309 |  | 
|---|
| 310 | /* | 
|---|
| 311 | * Weak bss (initiated by main()). | 
|---|
| 312 | */ | 
|---|
| 313 | .bss | 
|---|
| 314 | .space 32 | 
|---|
| 315 | .weak _weakbss | 
|---|
| 316 | _weakbss: | 
|---|
| 317 | _weakbss_localdefault: | 
|---|
| 318 | .space 40 | 
|---|
| 319 |  | 
|---|
| 320 |  | 
|---|
| 321 | /* | 
|---|
| 322 | * Weak abs | 
|---|
| 323 | */ | 
|---|
| 324 | .weak _weakabs | 
|---|
| 325 | .equ _weakabs, 0xdead | 
|---|
| 326 | .global _weakabs_localdefault | 
|---|
| 327 | .equ _weakabs_localdefault, 0xdead | 
|---|