diff options
Diffstat (limited to 'ld/testsuite')
479 files changed, 5286 insertions, 834 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp index f5cb188..6aba75f 100644 --- a/ld/testsuite/config/default.exp +++ b/ld/testsuite/config/default.exp @@ -251,6 +251,17 @@ if ![info exists LDFLAGS] then { set LDFLAGS {} } +# Set LD_CLASS to "64bit" for 64-bit LD. +if { ![info exists LD_CLASS] } then { + set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]] + set readelf_output [run_host_cmd "$READELF" "-h $REAL_LD"] + if { [regexp {[ \t]+Class:[ \t]+ELF64} $readelf_output] } then { + set LD_CLASS "64bit" + } else { + set LD_CLASS "32bit" + } +} + # Set PLT_CFLAGS to "-fplt" if target compiler supports it. if { ![info exists PLT_CFLAGS] } then { diff --git a/ld/testsuite/ld-aarch64/dt_textrel.d b/ld/testsuite/ld-aarch64/dt_textrel.d index 2dbbd2f..e28d164 100644 --- a/ld/testsuite/ld-aarch64/dt_textrel.d +++ b/ld/testsuite/ld-aarch64/dt_textrel.d @@ -3,5 +3,4 @@ #readelf: -d #... .*TEXTREL.* -.* - +#pass diff --git a/ld/testsuite/ld-aarch64/erratum843419.d b/ld/testsuite/ld-aarch64/erratum843419.d index 28e4445..f0934f0 100644 --- a/ld/testsuite/ld-aarch64/erratum843419.d +++ b/ld/testsuite/ld-aarch64/erratum843419.d @@ -14,7 +14,7 @@ Disassembly of section .e843419: ... 0*20000ff8 <e843419_1>: -[ ]*20000ff8: 90100000 adrp x0, 40000000 <[_a-zA-z0-9]+> +[ ]*20000ff8: 90100000 adrp x0, 40000000 <[_a-zA-Z0-9]+> [ ]*20000ffc: f800c007 stur x7, \[x0, #12\] [ ]*20001000: d2800128 mov x8, #0x9 // #9 [ ]*20001004: 14000008 b 20001024 <e843419@0002_00000013_1004> diff --git a/ld/testsuite/ld-aarch64/gc-plt-relocs.d b/ld/testsuite/ld-aarch64/gc-plt-relocs.d index d9f9413..0322c3c 100644 --- a/ld/testsuite/ld-aarch64/gc-plt-relocs.d +++ b/ld/testsuite/ld-aarch64/gc-plt-relocs.d @@ -2,7 +2,7 @@ #source: gc-plt-main.s #source: gc-plt-hidden.s #source: gc-plt2.s -#ld: --gc-sections -T aarch64.ld --shared +#ld: --gc-sections -T aarch64.ld --shared --hash-style=sysv #objdump: -dT # Shared object with plt related relocs against global symbol diff --git a/ld/testsuite/ld-aarch64/ifunc-1-local.d b/ld/testsuite/ld-aarch64/ifunc-1-local.d index 0e307e0..779d973 100644 --- a/ld/testsuite/ld-aarch64/ifunc-1-local.d +++ b/ld/testsuite/ld-aarch64/ifunc-1-local.d @@ -1,4 +1,4 @@ -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/ifunc-1.d b/ld/testsuite/ld-aarch64/ifunc-1.d index 9e522c9..0640303 100644 --- a/ld/testsuite/ld-aarch64/ifunc-1.d +++ b/ld/testsuite/ld-aarch64/ifunc-1.d @@ -1,4 +1,4 @@ -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/ifunc-2-local.d b/ld/testsuite/ld-aarch64/ifunc-2-local.d index 103f3e4..27710bc 100644 --- a/ld/testsuite/ld-aarch64/ifunc-2-local.d +++ b/ld/testsuite/ld-aarch64/ifunc-2-local.d @@ -1,4 +1,4 @@ -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/ifunc-2.d b/ld/testsuite/ld-aarch64/ifunc-2.d index 70ce224..b67e282 100644 --- a/ld/testsuite/ld-aarch64/ifunc-2.d +++ b/ld/testsuite/ld-aarch64/ifunc-2.d @@ -1,4 +1,4 @@ -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/ifunc-21.d b/ld/testsuite/ld-aarch64/ifunc-21.d index eef2e62..590495f 100644 --- a/ld/testsuite/ld-aarch64/ifunc-21.d +++ b/ld/testsuite/ld-aarch64/ifunc-21.d @@ -1,5 +1,5 @@ #source: ifunc-21.s -#ld: -shared -z nocombreloc +#ld: -shared --hash-style=sysv -z nocombreloc #objdump: -d -s -j .got.plt -j .text #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/ifunc-3a.d b/ld/testsuite/ld-aarch64/ifunc-3a.d index 4f61a8b..3e19b33 100644 --- a/ld/testsuite/ld-aarch64/ifunc-3a.d +++ b/ld/testsuite/ld-aarch64/ifunc-3a.d @@ -1,5 +1,5 @@ #source: ifunc-3.s -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: aarch64*-*-* diff --git a/ld/testsuite/ld-aarch64/relasz.d b/ld/testsuite/ld-aarch64/relasz.d index 5cc5595..28fe83a 100644 --- a/ld/testsuite/ld-aarch64/relasz.d +++ b/ld/testsuite/ld-aarch64/relasz.d @@ -1,5 +1,5 @@ #source: relasz.s -#ld: -shared -Taarch64.ld +#ld: -shared --hash-style=sysv -Taarch64.ld #readelf: -d # Check that the RELASZ section has the correct size even if we are # using a non-default linker script that merges .rela.dyn and .rela.plt diff --git a/ld/testsuite/ld-aarch64/tls-small-ld.d b/ld/testsuite/ld-aarch64/tls-small-ld.d index 74cf256..dce10af 100644 --- a/ld/testsuite/ld-aarch64/tls-small-ld.d +++ b/ld/testsuite/ld-aarch64/tls-small-ld.d @@ -1,5 +1,5 @@ #source: tls-small-ld.s -#ld: -T relocs.ld -shared +#ld: -T relocs.ld -shared --hash-style=sysv #readelf: -Wr Relocation section '\.rela\.dyn' at offset 0x10070 contains 2 entries: diff --git a/ld/testsuite/ld-aarch64/tls-tiny-ld.d b/ld/testsuite/ld-aarch64/tls-tiny-ld.d index f2cb60c..a9eb0a5 100644 --- a/ld/testsuite/ld-aarch64/tls-tiny-ld.d +++ b/ld/testsuite/ld-aarch64/tls-tiny-ld.d @@ -1,5 +1,5 @@ #source: tls-tiny-ld.s -#ld: -T relocs.ld -shared +#ld: -T relocs.ld -shared --hash-style=sysv #readelf: -Wr Relocation section '\.rela\.dyn' at offset 0x10070 contains 2 entries: diff --git a/ld/testsuite/ld-alpha/alpha.exp b/ld/testsuite/ld-alpha/alpha.exp index 0d115ba..5b811c1 100644 --- a/ld/testsuite/ld-alpha/alpha.exp +++ b/ld/testsuite/ld-alpha/alpha.exp @@ -37,7 +37,7 @@ if { !([istarget "alpha*-*-elf*"] # readelf: Apply readelf options on result. Compare with regex (last arg). set alphatests { - {"TLS -fpic -shared" "-shared -melf64alpha" "" + {"TLS -fpic -shared" "-shared -melf64alpha --hash-style=sysv" "" "" {align.s tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} @@ -45,12 +45,13 @@ set alphatests { {"Helper shared library" "-shared -melf64alpha" "" "" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec" - "-melf64alpha tmpdir/libtlslib.so" "" "" {align.s tlsbinpic.s tlsbin.s} + "-melf64alpha tmpdir/libtlslib.so --hash-style=sysv" "" + "" {align.s tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"TLS -fpic and -fno-pic exec -relax" - "-relax -melf64alpha tmpdir/libtlslib.so" "" + "-relax -melf64alpha --hash-style=sysv tmpdir/libtlslib.so" "" "" {align.s tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbinr.rd} {objdump -drj.text tlsbinr.dd} {objdump -sj.got tlsbinr.sd}} diff --git a/ld/testsuite/ld-arc/arc.exp b/ld/testsuite/ld-arc/arc.exp index 2f2abe2..66f39cd 100644 --- a/ld/testsuite/ld-arc/arc.exp +++ b/ld/testsuite/ld-arc/arc.exp @@ -40,6 +40,11 @@ set arccommon_tests { {tls-dtpoff.s} {{objdump -fdw tls-dtpoff.dd} {readelf --relocs tls-dtpoff.rd}} "sda-relocs.so" } + { "JLI simple" + "-q -T jli-script.ld -A elf32-arclittle" "" "-mcpu=em4 -EL" + {jli-simple.s} + {{objdump -fdw jli-simple.dd} {readelf --relocs jli-simple.rd}} + "jli-simple.so" } } run_ld_link_tests $arccommon_tests diff --git a/ld/testsuite/ld-arc/jli-overflow.d b/ld/testsuite/ld-arc/jli-overflow.d new file mode 100644 index 0000000..6445b2a --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.d @@ -0,0 +1,4 @@ +#source: jli-overflow.s +#as: -EL +#ld: -q -T jli-script.ld -A elf32-arclittle +#error_output: jli-overflow.err diff --git a/ld/testsuite/ld-arc/jli-overflow.err b/ld/testsuite/ld-arc/jli-overflow.err new file mode 100644 index 0000000..022434e --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.err @@ -0,0 +1,3 @@ +.*\.o: In function `test_1025': +.*: relocation truncated to fit: R_ARC_JLI_SECTOFF against symbol.* +#... diff --git a/ld/testsuite/ld-arc/jli-overflow.s b/ld/testsuite/ld-arc/jli-overflow.s new file mode 100644 index 0000000..7961cc9 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-overflow.s @@ -0,0 +1,1050 @@ +;;;Macro + .macro jlifunc num + .section .text + .align 4 + .global func\num + .type func\num, @function +func\num: + j_s.d [blink] + add_s r0,r0,1 + .size func\num, .-func\num + .align 4 + .global test_\num + .type test_\num, @function +test_\num: + jli_s @__jli.func\num + j_s [blink] + .size test_\num, .-test_\num + .section .jlitab, "axG", @progbits, .jlitab.func\num, comdat + .align 4 +__jli.func\num: + .weak __jli.func\num + b @func\num + .endm + + .cpu HS + jlifunc 1 + jlifunc 2 + jlifunc 3 + jlifunc 4 + jlifunc 5 + jlifunc 6 + jlifunc 7 + jlifunc 8 + jlifunc 9 + jlifunc 10 + jlifunc 11 + jlifunc 12 + jlifunc 13 + jlifunc 14 + jlifunc 15 + jlifunc 16 + jlifunc 17 + jlifunc 18 + jlifunc 19 + jlifunc 20 + jlifunc 21 + jlifunc 22 + jlifunc 23 + jlifunc 24 + jlifunc 25 + jlifunc 26 + jlifunc 27 + jlifunc 28 + jlifunc 29 + jlifunc 30 + jlifunc 31 + jlifunc 32 + jlifunc 33 + jlifunc 34 + jlifunc 35 + jlifunc 36 + jlifunc 37 + jlifunc 38 + jlifunc 39 + jlifunc 40 + jlifunc 41 + jlifunc 42 + jlifunc 43 + jlifunc 44 + jlifunc 45 + jlifunc 46 + jlifunc 47 + jlifunc 48 + jlifunc 49 + jlifunc 50 + jlifunc 51 + jlifunc 52 + jlifunc 53 + jlifunc 54 + jlifunc 55 + jlifunc 56 + jlifunc 57 + jlifunc 58 + jlifunc 59 + jlifunc 60 + jlifunc 61 + jlifunc 62 + jlifunc 63 + jlifunc 64 + jlifunc 65 + jlifunc 66 + jlifunc 67 + jlifunc 68 + jlifunc 69 + jlifunc 70 + jlifunc 71 + jlifunc 72 + jlifunc 73 + jlifunc 74 + jlifunc 75 + jlifunc 76 + jlifunc 77 + jlifunc 78 + jlifunc 79 + jlifunc 80 + jlifunc 81 + jlifunc 82 + jlifunc 83 + jlifunc 84 + jlifunc 85 + jlifunc 86 + jlifunc 87 + jlifunc 88 + jlifunc 89 + jlifunc 90 + jlifunc 91 + jlifunc 92 + jlifunc 93 + jlifunc 94 + jlifunc 95 + jlifunc 96 + jlifunc 97 + jlifunc 98 + jlifunc 99 + jlifunc 100 + jlifunc 101 + jlifunc 102 + jlifunc 103 + jlifunc 104 + jlifunc 105 + jlifunc 106 + jlifunc 107 + jlifunc 108 + jlifunc 109 + jlifunc 110 + jlifunc 111 + jlifunc 112 + jlifunc 113 + jlifunc 114 + jlifunc 115 + jlifunc 116 + jlifunc 117 + jlifunc 118 + jlifunc 119 + jlifunc 120 + jlifunc 121 + jlifunc 122 + jlifunc 123 + jlifunc 124 + jlifunc 125 + jlifunc 126 + jlifunc 127 + jlifunc 128 + jlifunc 129 + jlifunc 130 + jlifunc 131 + jlifunc 132 + jlifunc 133 + jlifunc 134 + jlifunc 135 + jlifunc 136 + jlifunc 137 + jlifunc 138 + jlifunc 139 + jlifunc 140 + jlifunc 141 + jlifunc 142 + jlifunc 143 + jlifunc 144 + jlifunc 145 + jlifunc 146 + jlifunc 147 + jlifunc 148 + jlifunc 149 + jlifunc 150 + jlifunc 151 + jlifunc 152 + jlifunc 153 + jlifunc 154 + jlifunc 155 + jlifunc 156 + jlifunc 157 + jlifunc 158 + jlifunc 159 + jlifunc 160 + jlifunc 161 + jlifunc 162 + jlifunc 163 + jlifunc 164 + jlifunc 165 + jlifunc 166 + jlifunc 167 + jlifunc 168 + jlifunc 169 + jlifunc 170 + jlifunc 171 + jlifunc 172 + jlifunc 173 + jlifunc 174 + jlifunc 175 + jlifunc 176 + jlifunc 177 + jlifunc 178 + jlifunc 179 + jlifunc 180 + jlifunc 181 + jlifunc 182 + jlifunc 183 + jlifunc 184 + jlifunc 185 + jlifunc 186 + jlifunc 187 + jlifunc 188 + jlifunc 189 + jlifunc 190 + jlifunc 191 + jlifunc 192 + jlifunc 193 + jlifunc 194 + jlifunc 195 + jlifunc 196 + jlifunc 197 + jlifunc 198 + jlifunc 199 + jlifunc 200 + jlifunc 201 + jlifunc 202 + jlifunc 203 + jlifunc 204 + jlifunc 205 + jlifunc 206 + jlifunc 207 + jlifunc 208 + jlifunc 209 + jlifunc 210 + jlifunc 211 + jlifunc 212 + jlifunc 213 + jlifunc 214 + jlifunc 215 + jlifunc 216 + jlifunc 217 + jlifunc 218 + jlifunc 219 + jlifunc 220 + jlifunc 221 + jlifunc 222 + jlifunc 223 + jlifunc 224 + jlifunc 225 + jlifunc 226 + jlifunc 227 + jlifunc 228 + jlifunc 229 + jlifunc 230 + jlifunc 231 + jlifunc 232 + jlifunc 233 + jlifunc 234 + jlifunc 235 + jlifunc 236 + jlifunc 237 + jlifunc 238 + jlifunc 239 + jlifunc 240 + jlifunc 241 + jlifunc 242 + jlifunc 243 + jlifunc 244 + jlifunc 245 + jlifunc 246 + jlifunc 247 + jlifunc 248 + jlifunc 249 + jlifunc 250 + jlifunc 251 + jlifunc 252 + jlifunc 253 + jlifunc 254 + jlifunc 255 + jlifunc 256 + jlifunc 257 + jlifunc 258 + jlifunc 259 + jlifunc 260 + jlifunc 261 + jlifunc 262 + jlifunc 263 + jlifunc 264 + jlifunc 265 + jlifunc 266 + jlifunc 267 + jlifunc 268 + jlifunc 269 + jlifunc 270 + jlifunc 271 + jlifunc 272 + jlifunc 273 + jlifunc 274 + jlifunc 275 + jlifunc 276 + jlifunc 277 + jlifunc 278 + jlifunc 279 + jlifunc 280 + jlifunc 281 + jlifunc 282 + jlifunc 283 + jlifunc 284 + jlifunc 285 + jlifunc 286 + jlifunc 287 + jlifunc 288 + jlifunc 289 + jlifunc 290 + jlifunc 291 + jlifunc 292 + jlifunc 293 + jlifunc 294 + jlifunc 295 + jlifunc 296 + jlifunc 297 + jlifunc 298 + jlifunc 299 + jlifunc 300 + jlifunc 301 + jlifunc 302 + jlifunc 303 + jlifunc 304 + jlifunc 305 + jlifunc 306 + jlifunc 307 + jlifunc 308 + jlifunc 309 + jlifunc 310 + jlifunc 311 + jlifunc 312 + jlifunc 313 + jlifunc 314 + jlifunc 315 + jlifunc 316 + jlifunc 317 + jlifunc 318 + jlifunc 319 + jlifunc 320 + jlifunc 321 + jlifunc 322 + jlifunc 323 + jlifunc 324 + jlifunc 325 + jlifunc 326 + jlifunc 327 + jlifunc 328 + jlifunc 329 + jlifunc 330 + jlifunc 331 + jlifunc 332 + jlifunc 333 + jlifunc 334 + jlifunc 335 + jlifunc 336 + jlifunc 337 + jlifunc 338 + jlifunc 339 + jlifunc 340 + jlifunc 341 + jlifunc 342 + jlifunc 343 + jlifunc 344 + jlifunc 345 + jlifunc 346 + jlifunc 347 + jlifunc 348 + jlifunc 349 + jlifunc 350 + jlifunc 351 + jlifunc 352 + jlifunc 353 + jlifunc 354 + jlifunc 355 + jlifunc 356 + jlifunc 357 + jlifunc 358 + jlifunc 359 + jlifunc 360 + jlifunc 361 + jlifunc 362 + jlifunc 363 + jlifunc 364 + jlifunc 365 + jlifunc 366 + jlifunc 367 + jlifunc 368 + jlifunc 369 + jlifunc 370 + jlifunc 371 + jlifunc 372 + jlifunc 373 + jlifunc 374 + jlifunc 375 + jlifunc 376 + jlifunc 377 + jlifunc 378 + jlifunc 379 + jlifunc 380 + jlifunc 381 + jlifunc 382 + jlifunc 383 + jlifunc 384 + jlifunc 385 + jlifunc 386 + jlifunc 387 + jlifunc 388 + jlifunc 389 + jlifunc 390 + jlifunc 391 + jlifunc 392 + jlifunc 393 + jlifunc 394 + jlifunc 395 + jlifunc 396 + jlifunc 397 + jlifunc 398 + jlifunc 399 + jlifunc 400 + jlifunc 401 + jlifunc 402 + jlifunc 403 + jlifunc 404 + jlifunc 405 + jlifunc 406 + jlifunc 407 + jlifunc 408 + jlifunc 409 + jlifunc 410 + jlifunc 411 + jlifunc 412 + jlifunc 413 + jlifunc 414 + jlifunc 415 + jlifunc 416 + jlifunc 417 + jlifunc 418 + jlifunc 419 + jlifunc 420 + jlifunc 421 + jlifunc 422 + jlifunc 423 + jlifunc 424 + jlifunc 425 + jlifunc 426 + jlifunc 427 + jlifunc 428 + jlifunc 429 + jlifunc 430 + jlifunc 431 + jlifunc 432 + jlifunc 433 + jlifunc 434 + jlifunc 435 + jlifunc 436 + jlifunc 437 + jlifunc 438 + jlifunc 439 + jlifunc 440 + jlifunc 441 + jlifunc 442 + jlifunc 443 + jlifunc 444 + jlifunc 445 + jlifunc 446 + jlifunc 447 + jlifunc 448 + jlifunc 449 + jlifunc 450 + jlifunc 451 + jlifunc 452 + jlifunc 453 + jlifunc 454 + jlifunc 455 + jlifunc 456 + jlifunc 457 + jlifunc 458 + jlifunc 459 + jlifunc 460 + jlifunc 461 + jlifunc 462 + jlifunc 463 + jlifunc 464 + jlifunc 465 + jlifunc 466 + jlifunc 467 + jlifunc 468 + jlifunc 469 + jlifunc 470 + jlifunc 471 + jlifunc 472 + jlifunc 473 + jlifunc 474 + jlifunc 475 + jlifunc 476 + jlifunc 477 + jlifunc 478 + jlifunc 479 + jlifunc 480 + jlifunc 481 + jlifunc 482 + jlifunc 483 + jlifunc 484 + jlifunc 485 + jlifunc 486 + jlifunc 487 + jlifunc 488 + jlifunc 489 + jlifunc 490 + jlifunc 491 + jlifunc 492 + jlifunc 493 + jlifunc 494 + jlifunc 495 + jlifunc 496 + jlifunc 497 + jlifunc 498 + jlifunc 499 + jlifunc 500 + jlifunc 501 + jlifunc 502 + jlifunc 503 + jlifunc 504 + jlifunc 505 + jlifunc 506 + jlifunc 507 + jlifunc 508 + jlifunc 509 + jlifunc 510 + jlifunc 511 + jlifunc 512 + jlifunc 513 + jlifunc 514 + jlifunc 515 + jlifunc 516 + jlifunc 517 + jlifunc 518 + jlifunc 519 + jlifunc 520 + jlifunc 521 + jlifunc 522 + jlifunc 523 + jlifunc 524 + jlifunc 525 + jlifunc 526 + jlifunc 527 + jlifunc 528 + jlifunc 529 + jlifunc 530 + jlifunc 531 + jlifunc 532 + jlifunc 533 + jlifunc 534 + jlifunc 535 + jlifunc 536 + jlifunc 537 + jlifunc 538 + jlifunc 539 + jlifunc 540 + jlifunc 541 + jlifunc 542 + jlifunc 543 + jlifunc 544 + jlifunc 545 + jlifunc 546 + jlifunc 547 + jlifunc 548 + jlifunc 549 + jlifunc 550 + jlifunc 551 + jlifunc 552 + jlifunc 553 + jlifunc 554 + jlifunc 555 + jlifunc 556 + jlifunc 557 + jlifunc 558 + jlifunc 559 + jlifunc 560 + jlifunc 561 + jlifunc 562 + jlifunc 563 + jlifunc 564 + jlifunc 565 + jlifunc 566 + jlifunc 567 + jlifunc 568 + jlifunc 569 + jlifunc 570 + jlifunc 571 + jlifunc 572 + jlifunc 573 + jlifunc 574 + jlifunc 575 + jlifunc 576 + jlifunc 577 + jlifunc 578 + jlifunc 579 + jlifunc 580 + jlifunc 581 + jlifunc 582 + jlifunc 583 + jlifunc 584 + jlifunc 585 + jlifunc 586 + jlifunc 587 + jlifunc 588 + jlifunc 589 + jlifunc 590 + jlifunc 591 + jlifunc 592 + jlifunc 593 + jlifunc 594 + jlifunc 595 + jlifunc 596 + jlifunc 597 + jlifunc 598 + jlifunc 599 + jlifunc 600 + jlifunc 601 + jlifunc 602 + jlifunc 603 + jlifunc 604 + jlifunc 605 + jlifunc 606 + jlifunc 607 + jlifunc 608 + jlifunc 609 + jlifunc 610 + jlifunc 611 + jlifunc 612 + jlifunc 613 + jlifunc 614 + jlifunc 615 + jlifunc 616 + jlifunc 617 + jlifunc 618 + jlifunc 619 + jlifunc 620 + jlifunc 621 + jlifunc 622 + jlifunc 623 + jlifunc 624 + jlifunc 625 + jlifunc 626 + jlifunc 627 + jlifunc 628 + jlifunc 629 + jlifunc 630 + jlifunc 631 + jlifunc 632 + jlifunc 633 + jlifunc 634 + jlifunc 635 + jlifunc 636 + jlifunc 637 + jlifunc 638 + jlifunc 639 + jlifunc 640 + jlifunc 641 + jlifunc 642 + jlifunc 643 + jlifunc 644 + jlifunc 645 + jlifunc 646 + jlifunc 647 + jlifunc 648 + jlifunc 649 + jlifunc 650 + jlifunc 651 + jlifunc 652 + jlifunc 653 + jlifunc 654 + jlifunc 655 + jlifunc 656 + jlifunc 657 + jlifunc 658 + jlifunc 659 + jlifunc 660 + jlifunc 661 + jlifunc 662 + jlifunc 663 + jlifunc 664 + jlifunc 665 + jlifunc 666 + jlifunc 667 + jlifunc 668 + jlifunc 669 + jlifunc 670 + jlifunc 671 + jlifunc 672 + jlifunc 673 + jlifunc 674 + jlifunc 675 + jlifunc 676 + jlifunc 677 + jlifunc 678 + jlifunc 679 + jlifunc 680 + jlifunc 681 + jlifunc 682 + jlifunc 683 + jlifunc 684 + jlifunc 685 + jlifunc 686 + jlifunc 687 + jlifunc 688 + jlifunc 689 + jlifunc 690 + jlifunc 691 + jlifunc 692 + jlifunc 693 + jlifunc 694 + jlifunc 695 + jlifunc 696 + jlifunc 697 + jlifunc 698 + jlifunc 699 + jlifunc 700 + jlifunc 701 + jlifunc 702 + jlifunc 703 + jlifunc 704 + jlifunc 705 + jlifunc 706 + jlifunc 707 + jlifunc 708 + jlifunc 709 + jlifunc 710 + jlifunc 711 + jlifunc 712 + jlifunc 713 + jlifunc 714 + jlifunc 715 + jlifunc 716 + jlifunc 717 + jlifunc 718 + jlifunc 719 + jlifunc 720 + jlifunc 721 + jlifunc 722 + jlifunc 723 + jlifunc 724 + jlifunc 725 + jlifunc 726 + jlifunc 727 + jlifunc 728 + jlifunc 729 + jlifunc 730 + jlifunc 731 + jlifunc 732 + jlifunc 733 + jlifunc 734 + jlifunc 735 + jlifunc 736 + jlifunc 737 + jlifunc 738 + jlifunc 739 + jlifunc 740 + jlifunc 741 + jlifunc 742 + jlifunc 743 + jlifunc 744 + jlifunc 745 + jlifunc 746 + jlifunc 747 + jlifunc 748 + jlifunc 749 + jlifunc 750 + jlifunc 751 + jlifunc 752 + jlifunc 753 + jlifunc 754 + jlifunc 755 + jlifunc 756 + jlifunc 757 + jlifunc 758 + jlifunc 759 + jlifunc 760 + jlifunc 761 + jlifunc 762 + jlifunc 763 + jlifunc 764 + jlifunc 765 + jlifunc 766 + jlifunc 767 + jlifunc 768 + jlifunc 769 + jlifunc 770 + jlifunc 771 + jlifunc 772 + jlifunc 773 + jlifunc 774 + jlifunc 775 + jlifunc 776 + jlifunc 777 + jlifunc 778 + jlifunc 779 + jlifunc 780 + jlifunc 781 + jlifunc 782 + jlifunc 783 + jlifunc 784 + jlifunc 785 + jlifunc 786 + jlifunc 787 + jlifunc 788 + jlifunc 789 + jlifunc 790 + jlifunc 791 + jlifunc 792 + jlifunc 793 + jlifunc 794 + jlifunc 795 + jlifunc 796 + jlifunc 797 + jlifunc 798 + jlifunc 799 + jlifunc 800 + jlifunc 801 + jlifunc 802 + jlifunc 803 + jlifunc 804 + jlifunc 805 + jlifunc 806 + jlifunc 807 + jlifunc 808 + jlifunc 809 + jlifunc 810 + jlifunc 811 + jlifunc 812 + jlifunc 813 + jlifunc 814 + jlifunc 815 + jlifunc 816 + jlifunc 817 + jlifunc 818 + jlifunc 819 + jlifunc 820 + jlifunc 821 + jlifunc 822 + jlifunc 823 + jlifunc 824 + jlifunc 825 + jlifunc 826 + jlifunc 827 + jlifunc 828 + jlifunc 829 + jlifunc 830 + jlifunc 831 + jlifunc 832 + jlifunc 833 + jlifunc 834 + jlifunc 835 + jlifunc 836 + jlifunc 837 + jlifunc 838 + jlifunc 839 + jlifunc 840 + jlifunc 841 + jlifunc 842 + jlifunc 843 + jlifunc 844 + jlifunc 845 + jlifunc 846 + jlifunc 847 + jlifunc 848 + jlifunc 849 + jlifunc 850 + jlifunc 851 + jlifunc 852 + jlifunc 853 + jlifunc 854 + jlifunc 855 + jlifunc 856 + jlifunc 857 + jlifunc 858 + jlifunc 859 + jlifunc 860 + jlifunc 861 + jlifunc 862 + jlifunc 863 + jlifunc 864 + jlifunc 865 + jlifunc 866 + jlifunc 867 + jlifunc 868 + jlifunc 869 + jlifunc 870 + jlifunc 871 + jlifunc 872 + jlifunc 873 + jlifunc 874 + jlifunc 875 + jlifunc 876 + jlifunc 877 + jlifunc 878 + jlifunc 879 + jlifunc 880 + jlifunc 881 + jlifunc 882 + jlifunc 883 + jlifunc 884 + jlifunc 885 + jlifunc 886 + jlifunc 887 + jlifunc 888 + jlifunc 889 + jlifunc 890 + jlifunc 891 + jlifunc 892 + jlifunc 893 + jlifunc 894 + jlifunc 895 + jlifunc 896 + jlifunc 897 + jlifunc 898 + jlifunc 899 + jlifunc 900 + jlifunc 901 + jlifunc 902 + jlifunc 903 + jlifunc 904 + jlifunc 905 + jlifunc 906 + jlifunc 907 + jlifunc 908 + jlifunc 909 + jlifunc 910 + jlifunc 911 + jlifunc 912 + jlifunc 913 + jlifunc 914 + jlifunc 915 + jlifunc 916 + jlifunc 917 + jlifunc 918 + jlifunc 919 + jlifunc 920 + jlifunc 921 + jlifunc 922 + jlifunc 923 + jlifunc 924 + jlifunc 925 + jlifunc 926 + jlifunc 927 + jlifunc 928 + jlifunc 929 + jlifunc 930 + jlifunc 931 + jlifunc 932 + jlifunc 933 + jlifunc 934 + jlifunc 935 + jlifunc 936 + jlifunc 937 + jlifunc 938 + jlifunc 939 + jlifunc 940 + jlifunc 941 + jlifunc 942 + jlifunc 943 + jlifunc 944 + jlifunc 945 + jlifunc 946 + jlifunc 947 + jlifunc 948 + jlifunc 949 + jlifunc 950 + jlifunc 951 + jlifunc 952 + jlifunc 953 + jlifunc 954 + jlifunc 955 + jlifunc 956 + jlifunc 957 + jlifunc 958 + jlifunc 959 + jlifunc 960 + jlifunc 961 + jlifunc 962 + jlifunc 963 + jlifunc 964 + jlifunc 965 + jlifunc 966 + jlifunc 967 + jlifunc 968 + jlifunc 969 + jlifunc 970 + jlifunc 971 + jlifunc 972 + jlifunc 973 + jlifunc 974 + jlifunc 975 + jlifunc 976 + jlifunc 977 + jlifunc 978 + jlifunc 979 + jlifunc 980 + jlifunc 981 + jlifunc 982 + jlifunc 983 + jlifunc 984 + jlifunc 985 + jlifunc 986 + jlifunc 987 + jlifunc 988 + jlifunc 989 + jlifunc 990 + jlifunc 991 + jlifunc 992 + jlifunc 993 + jlifunc 994 + jlifunc 995 + jlifunc 996 + jlifunc 997 + jlifunc 998 + jlifunc 999 + jlifunc 1000 + jlifunc 1001 + jlifunc 1002 + jlifunc 1003 + jlifunc 1004 + jlifunc 1005 + jlifunc 1006 + jlifunc 1007 + jlifunc 1008 + jlifunc 1009 + jlifunc 1010 + jlifunc 1011 + jlifunc 1012 + jlifunc 1013 + jlifunc 1014 + jlifunc 1015 + jlifunc 1016 + jlifunc 1017 + jlifunc 1018 + jlifunc 1019 + jlifunc 1020 + jlifunc 1021 + jlifunc 1022 + jlifunc 1023 + jlifunc 1024 + jlifunc 1025 diff --git a/ld/testsuite/ld-arc/jli-script.ld b/ld/testsuite/ld-arc/jli-script.ld new file mode 100644 index 0000000..fdb9e90 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-script.ld @@ -0,0 +1,20 @@ +/* Default linker script, for normal executables. */ +OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", + "elf32-littlearc") + +OUTPUT_ARCH(arc) +ENTRY(__start) + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__start = 0x10000); + . = 0x10000 + SIZEOF_HEADERS; + + .text : {*(.text .stub .text.*)} =0 + .jlitab : {jlitab*.o(.jlitab*) *(.jlitab*) } + .tdata : {.tdata = .; *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : {.tbss = .; *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/ld/testsuite/ld-arc/jli-simple.dd b/ld/testsuite/ld-arc/jli-simple.dd new file mode 100644 index 0000000..cea0194 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.dd @@ -0,0 +1,26 @@ + +.*: file format .* +architecture: ARCv2, flags 0x00000113: +HAS_RELOC, EXEC_P, HAS_SYMS, D_PAGED +start address 0x00010000 + + +Disassembly of section .text: + +00010054 <test>: + 10054: 5800 jli_s 0 + 10056: 5801 jli_s 0x1 + +00010058 <foo>: + 10058: 2000 0000 add r0,r0,r0 + +0001005c <bar>: + 1005c: 2100 0080 add r0,r1,r2 + +Disassembly of section .jlitab: + +00010060 <__jli.foo>: + 10060: 07f9 ffcf b 10058 <foo> + +00010064 <__jli.bar>: + 10064: 07f9 ffcf b 1005c <bar> diff --git a/ld/testsuite/ld-arc/jli-simple.rd b/ld/testsuite/ld-arc/jli-simple.rd new file mode 100644 index 0000000..13b85bb --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.rd @@ -0,0 +1,10 @@ + +Relocation section '\.rela\.text' .*: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +00010054 [0-9a-f]+ R_ARC_JLI_SECTOFF 00010060 __jli\.foo \+ 0 +00010056 [0-9a-f]+ R_ARC_JLI_SECTOFF 00010064 __jli\.bar \+ 0 + +Relocation section '\.rela\.jlitab' .*: + Offset +Info +Type +Sym.Value +Sym. Name \+ Addend +00010060 [0-9a-f]+ R_ARC_S25H_PCREL 00010054 .text \+ 4 +00010064 [0-9a-f]+ R_ARC_S25H_PCREL 00010054 .text \+ 8 diff --git a/ld/testsuite/ld-arc/jli-simple.s b/ld/testsuite/ld-arc/jli-simple.s new file mode 100644 index 0000000..660fa05 --- /dev/null +++ b/ld/testsuite/ld-arc/jli-simple.s @@ -0,0 +1,24 @@ + .cpu em4 + .text + .align 4 +test: + jli_s __jli.foo + jli_s __jli.bar + + .align 4 +foo: + add r0,r0,r0 + + .align 4 +bar: + add r0,r1,r2 + + .section .jlitab,"axG",%progbits,jli_group,comdat + .align 4 +__jli.foo: + .weak __jli.foo + b @foo + .align 4 +__jli.bar: + .weak __jli.bar + b @bar diff --git a/ld/testsuite/ld-arc/nps-1b.err b/ld/testsuite/ld-arc/nps-1b.err index a7d2996..4b13145 100644 --- a/ld/testsuite/ld-arc/nps-1b.err +++ b/ld/testsuite/ld-arc/nps-1b.err @@ -1,2 +1,2 @@ -.*\.o\(\.text\+0x0\): CMEM relocation to `foo' is invalid, 16 MSB should be 0x57f0 \(value is 0x56f03000\) +.*\.o\(\.text\+0\): CMEM relocation to `foo' is invalid, 16 MSB should be 0x57f0 \(value is 0x56f03000\) #... diff --git a/ld/testsuite/ld-arc/tls_gd-01.d b/ld/testsuite/ld-arc/tls_gd-01.d index e789157..1994385 100644 --- a/ld/testsuite/ld-arc/tls_gd-01.d +++ b/ld/testsuite/ld-arc/tls_gd-01.d @@ -1,10 +1,10 @@ #source: tls_gd-01.s #as: -mcpu=arc700 -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #xfail: arc*-*-elf* -[^:]+: file format elf32-littlearc +[^:]+: file format elf32-.*arc Disassembly of section \.text: diff --git a/ld/testsuite/ld-arc/tls_ie-01.d b/ld/testsuite/ld-arc/tls_ie-01.d index 62b3932..e4af7c2 100644 --- a/ld/testsuite/ld-arc/tls_ie-01.d +++ b/ld/testsuite/ld-arc/tls_ie-01.d @@ -4,7 +4,7 @@ #objdump: -s -j .got #xfail: arc*-*-elf* -[^:]+: file format elf32-littlearc +[^:]+: file format elf32-.*arc Contents of section \.got: - [0-9a-f]+ 08000000 0c000000 +.+ + [0-9a-f]+ [08]+ [0c]+ +.+ diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index b15316c..3b33522 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -21,23 +21,24 @@ if {[istarget "arm-*-vxworks"]} { set armvxworkstests { - {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" + {"VxWorks shared library test 1" + "-shared -Tvxworks1.ld --hash-style=sysv" "" "" {vxworks1-lib.s} {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} "libvxworks1.so"} - {"VxWorks executable test 1 (dynamic)" \ - "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" + {"VxWorks executable test 1 (dynamic)" + "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks1.s} {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} "vxworks1"} {"VxWorks executable test 2 (dynamic)" \ - "-Tvxworks1.ld -q --force-dynamic" "" + "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks2.s} {{readelf --segments vxworks2.sd}} "vxworks2"} {"VxWorks executable test 2 (static)" - "-Tvxworks1.ld" "" + "-Tvxworks1.ld --hash-style=sysv" "" "" {vxworks2.s} {{readelf --segments vxworks2-static.sd}} "vxworks2"} @@ -99,43 +100,57 @@ set armelftests_common_1 { {"arm-rel31" "-static -T arm.ld" "" "" {arm-rel31.s} {{objdump -s arm-rel31.d}} "arm-rel31"} - {"arm-rel32" "-shared -T arm-dyn.ld" "" "" {arm-rel32.s} + {"arm-rel32" "-shared -T arm-dyn.ld --hash-style=sysv" "" "" {arm-rel32.s} {{objdump -Rsj.data arm-rel32.d}} "arm-rel32"} {"arm-call" "--no-fix-arm1176 -static -T arm.ld" "" "-meabi=4" {arm-call1.s arm-call2.s} {{objdump -d arm-call.d}} "arm-call"} - {"TLS shared library" "-shared -T arm-lib.ld" "" "" {tls-lib.s} + {"TLS shared library" "-shared -T arm-lib.ld --hash-style=sysv" "" + "" {tls-lib.s} {{objdump -fdw tls-lib.d} {objdump -Rw tls-lib.r}} "tls-lib.so"} - {"TLS dynamic application" "-T arm-dyn.ld tmpdir/tls-lib.so" "" "" {tls-app.s} + {"TLS dynamic application" + "-T arm-dyn.ld --hash-style=sysv tmpdir/tls-lib.so" "" "" {tls-app.s} {{objdump -fdw tls-app.d} {objdump -Rw tls-app.r}} "tls-app"} - {"TLS gnu shared library got" "-shared -T arm-dyn.ld" "" "" {tls-gdesc-got.s} + {"TLS gnu shared library got" + "-shared -T arm-dyn.ld --hash-style=sysv" "" "" {tls-gdesc-got.s} {{objdump "-fDR -j .got" tls-gdesc-got.d}} "tls-lib2-got.so"} - {"TLS gnu GD to IE relaxation" "-static -T arm-dyn.ld" "" "" {tls-gdierelax.s} + {"TLS gnu GD to IE relaxation" + "-static -T arm-dyn.ld --hash-style=sysv" "" "" {tls-gdierelax.s} {{objdump -fdw tls-gdierelax.d}} "tls-app-rel-ie"} - {"TLS gnu GD to IE shared relaxation" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-gdierelax2.s} + {"TLS gnu GD to IE shared relaxation" + "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" "" + "" {tls-gdierelax2.s} {{objdump -fdw tls-gdierelax2.d}} "tls-app-rel-ie2"} - {"TLS gnu GD to LE relaxation" "-T arm-dyn.ld" "" "" {tls-gdlerelax.s} + {"TLS gnu GD to LE relaxation" "-T arm-dyn.ld --hash-style=sysv" "" + "" {tls-gdlerelax.s} {{objdump -fdw tls-gdlerelax.d}} "tls-app-rel-le"} - {"TLS mixed models shared lib" "-shared -T arm-dyn.ld" "" "" {tls-mixed.s} + {"TLS mixed models shared lib" + "-shared -T arm-dyn.ld --hash-style=sysv" "" "" {tls-mixed.s} {{objdump -Rw tls-mixed.r}} "tls-mixed.so"} - {"TLS descseq relaxation" "-T arm-dyn.ld" "" "" {tls-descrelax.s} + {"TLS descseq relaxation" + "-T arm-dyn.ld --hash-style=sysv" "" "" {tls-descrelax.s} {{objdump -fdw tls-descrelax.d}} "tls-descrelax"} - {"TLS descseq relaxation v7" "-T arm-dyn.ld" "" "" {tls-descrelax-v7.s} + {"TLS descseq relaxation v7" + "-T arm-dyn.ld --hash-style=sysv" "" "" {tls-descrelax-v7.s} {{objdump -fdw tls-descrelax-v7.d}} "tls-descrelax-v7"} - {"TLS descseq relaxation BE8" "-T arm-dyn.ld -EB --be8" "" "-mbig-endian" {tls-descrelax-be8.s} + {"TLS descseq relaxation BE8" + "-T arm-dyn.ld --hash-style=sysv -EB --be8" "" + "-mbig-endian" {tls-descrelax-be8.s} {{objdump -fdw tls-descrelax-be8.d}} "tls-descrelax-be8"} - {"TLS descseq relaxation BE32" "-T arm-dyn.ld -EB" "" "-mbig-endian" {tls-descrelax-be32.s} + {"TLS descseq relaxation BE32" + "-T arm-dyn.ld --hash-style=sysv -EB" "" + "-mbig-endian" {tls-descrelax-be32.s} {{objdump -fdw tls-descrelax-be32.d}} "tls-descrelax-be32"} {"TLS local PIC symbol static link" "-T arm.ld" "" "" {tls-local-static.s} @@ -229,7 +244,7 @@ set armelftests_common_3 { {"EABI ABI flags ld -r" "-r" "" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s} {{readelf -h eabi-soft-float-r.d}} "eabi-soft-float-r.o"} - {"PC-relative in -shared" "-shared" "" + {"PC-relative in -shared" "-shared --hash-style=sysv" "" "" {pcrel-shared.s} {{readelf -dr pcrel-shared.rd}} "pcrel-shared.so"} @@ -267,7 +282,8 @@ set armelftests_nonacl { {"jump19" "-static -T arm.ld" "" "" {jump19.s} {{objdump -dr jump19.d}} "jump19"} - {"Thumb and -gc-sections" "-shared -T arm-dyn.ld" "" "" {gc-thumb-lib.s} + {"Thumb and -gc-sections" + "-shared -T arm-dyn.ld --hash-style=sysv" "" "" {gc-thumb-lib.s} {} "gc-thumb-lib.so"} {"Thumb and -gc-sections" "-pie -T arm.ld -gc-sections tmpdir/gc-thumb-lib.so" "" "" {gc-thumb.s} @@ -294,32 +310,42 @@ set armelftests_nonacl { {"Non-pcrel function reference" "tmpdir/arm-lib.so" "" "" {arm-app-abs32.s} {{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}} "arm-app-abs32"} - {"Thumb shared library with ARM entry points" "-shared -T arm-lib.ld" "" "-mthumb-interwork" - {mixed-lib.s} + {"Thumb shared library with ARM entry points" + "-shared -T arm-lib.ld --hash-style=sysv" "" + "-mthumb-interwork" {mixed-lib.s} {{objdump -fdw armthumb-lib.d} {readelf -Ds armthumb-lib.sym}} "armthumb-lib.so"} - {"Mixed ARM/Thumb shared library" "-shared -T arm-lib.ld -use-blx" "" "" - {mixed-lib.s} + {"Mixed ARM/Thumb shared library" + "-shared -T arm-lib.ld --hash-style=sysv -use-blx" "" + "" {mixed-lib.s} {{objdump -fdw mixed-lib.d} {objdump -Rw mixed-lib.r} {readelf -Ds mixed-lib.sym}} "mixed-lib.so"} - {"Mixed ARM/Thumb dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld" "" "" - {mixed-app.s} + {"Mixed ARM/Thumb dynamic application" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv" "" + "" {mixed-app.s} {{objdump -fdw mixed-app.d} {objdump -Rw mixed-app.r} {readelf -Ds mixed-app.sym}} "mixed-app"} - {"Mixed ARM/Thumb arch5 dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" "" "" - {mixed-app.s} + {"Mixed ARM/Thumb arch5 dynamic application" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx" "" + "" {mixed-app.s} {{objdump -fdw mixed-app-v5.d} {objdump -Rw mixed-app.r} {readelf -Ds mixed-app.sym}} "mixed-app-v5"} - {"Using Thumb lib by another lib" "-shared tmpdir/mixed-lib.so" "" "" {use-thumb-lib.s} + {"Using Thumb lib by another lib" + "-shared --hash-style=sysv tmpdir/mixed-lib.so" "" + "" {use-thumb-lib.s} {{readelf -Ds use-thumb-lib.sym}} "use-thumb-lib.so"} - {"TLS gnu shared library inlined trampoline" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-descseq.s} + {"TLS gnu shared library inlined trampoline" + "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" "" + "" {tls-descseq.s} {{objdump -fdw tls-descseq.d} {objdump -Rw tls-descseq.r}} "tls-lib2inline.so"} - {"TLS shared library gdesc local" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-lib-loc.s} + {"TLS shared library gdesc local" + "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" "" + "" {tls-lib-loc.s} {{objdump -fdw tls-lib-loc.d} {objdump -Rw tls-lib-loc.r}} "tls-lib-loc.so"} } @@ -555,30 +581,35 @@ set armeabitests_nonacl { {{objdump -d farcall-mix2.d}} "farcall-mix2"} - {"Mixed ARM/Thumb dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" "" - {farcall-mixed-app.s} + {"Mixed ARM/Thumb dynamic application with farcalls" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" + "" {farcall-mixed-app.s} {{objdump -fdw farcall-mixed-app.d} {objdump -Rw farcall-mixed-app.r} {readelf -Ds farcall-mixed-app.sym}} "farcall-mixed-app"} - {"Mixed ARM/Thumb arch5 dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" "" - {farcall-mixed-app.s} + {"Mixed ARM/Thumb arch5 dynamic application with farcalls" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" + "" {farcall-mixed-app.s} {{objdump -fdw farcall-mixed-app-v5.d} {objdump -Rw farcall-mixed-app.r} {readelf -Ds farcall-mixed-app.sym}} "farcall-mixed-app-v5"} - {"Mixed ARM/Thumb2 dynamic application with farcalls" "tmpdir/mixed-lib.so -T arm-dyn.ld --section-start .mid_thumb=0x10081c0 --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" "" - {farcall-mixed-app2.s} + {"Mixed ARM/Thumb2 dynamic application with farcalls" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .mid_thumb=0x10081c0 --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" "" + "" {farcall-mixed-app2.s} {{objdump -fdw farcall-mixed-app2.d} {objdump -Rw farcall-mixed-app2.r} {readelf -Ds farcall-mixed-app2.sym}} "farcall-mixed-app2"} - {"Mixed ARM/Thumb shared library with long branches (v4t)" "-shared -T arm-lib.ld" "" "-march=armv4t" - {farcall-mixed-lib1.s farcall-mixed-lib2.s} + {"Mixed ARM/Thumb shared library with long branches (v4t)" + "-shared -T arm-lib.ld --hash-style=sysv" "" + "-march=armv4t" {farcall-mixed-lib1.s farcall-mixed-lib2.s} {{objdump -fdw farcall-mixed-lib-v4t.d}} "farcall-mixed-lib.so"} - {"Mixed ARM/Thumb shared library with long branches (v5t)" "--no-fix-arm1176 -shared -T arm-lib.ld" "" "-march=armv5t" - {farcall-mixed-lib1.s farcall-mixed-lib2.s} + {"Mixed ARM/Thumb shared library with long branches (v5t)" + "--no-fix-arm1176 -shared -T arm-lib.ld --hash-style=sysv" "" + "-march=armv5t" {farcall-mixed-lib1.s farcall-mixed-lib2.s} {{objdump -fdw farcall-mixed-lib.d}} "farcall-mixed-lib.so"} @@ -773,19 +804,29 @@ set armeabitests_nonacl { {{objdump -d farcall-group-limit.d}} "farcall-group-limit"} - {"TLS gnu shared library" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-gdesc.s} + {"TLS gnu shared library" + "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" "" + "" {tls-gdesc.s} {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}} "tls-lib2.so"} - {"TLS gnu shared library non-lazy" "-z now -shared -T arm-dyn.ld" "" "" {tls-gdesc.s} + {"TLS gnu shared library non-lazy" + "-z now -shared -T arm-dyn.ld --hash-style=sysv" "" + "" {tls-gdesc.s} {{readelf "-x .got" tls-gdesc-nlazy.g}} "tls-lib2-nlazy.so"} - {"TLS long plt library" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" "" {tls-longplt-lib.s} + {"TLS long plt library" + "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" "" + "" {tls-longplt-lib.s} {{objdump -fdw tls-longplt-lib.d}} "tls-longplt-lib.so"} - {"TLS long plt" "-T arm-dyn.ld --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" "" "" {tls-longplt.s} + {"TLS long plt" + "-T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" "" + "" {tls-longplt.s} {{objdump -fdw tls-longplt.d}} "tls-longplt"} - {"TLS thumb1" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" "" {tls-thumb1.s} + {"TLS thumb1" + "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" "" + "" {tls-thumb1.s} {{objdump -fdw tls-thumb1.d}} "tls-thumb1"} {"Cortex-A8 erratum fix, b.w" @@ -867,7 +908,7 @@ set armeabitests_nonacl { {{objdump -dr cortex-a8-fix-blx-plt.d}} "cortex-a8-fix-blx-plt"} {"Cortex-A8 erratum fix, relocate bl.w to PLT" - "-EL --section-start=.plt=0x8e00 -Ttext=0x8f00 --fix-cortex-a8 -shared" "" + "-EL --section-start=.plt=0x8e00 -Ttext=0x8f00 --fix-cortex-a8 -shared --hash-style=sysv" "" "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s} {{objdump -dr cortex-a8-fix-bl-rel-plt.d}} "cortex-a8-fix-bl-rel-thumb"} @@ -962,14 +1003,17 @@ set armeabitests_nonacl { "" {long-plt-format.s} {{objdump "-d -j .plt" long-plt-format.d}} "long-plt-format"} - {"IFUNC and TLS descriptor shared library" "-shared -T arm-lib.ld --version-script=ifunc-gdesc.ver" "" "" {ifunc-gdesc.s} + {"IFUNC and TLS descriptor shared library" + "-shared -T arm-lib.ld --hash-style=sysv --version-script=ifunc-gdesc.ver" "" + "" {ifunc-gdesc.s} {{objdump "-Rw" ifunc-gdesc.r}} "ifunc-gdesc.so"} {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s} {{objdump -d arm-pic-veneer.d}} "arm-pic-veneer"} - {"Preempt Thumb symbol" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" "" "" - {preempt-app.s} + {"Preempt Thumb symbol" + "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx" "" + "" {preempt-app.s} {{readelf -Ds preempt-app.sym}} "preempt-app"} } diff --git a/ld/testsuite/ld-cris/dso-pltdis1.d b/ld/testsuite/ld-cris/dso-pltdis1.d index e2c0f93..241328c 100644 --- a/ld/testsuite/ld-cris/dso-pltdis1.d +++ b/ld/testsuite/ld-cris/dso-pltdis1.d @@ -2,7 +2,7 @@ #source: dsov32-2.s #source: dsofn4g.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -d -R # Check dissassembly of the .plt section, specifically the synthetic diff --git a/ld/testsuite/ld-cris/dso-pltdis2.d b/ld/testsuite/ld-cris/dso-pltdis2.d index 24da97a..1acea4e 100644 --- a/ld/testsuite/ld-cris/dso-pltdis2.d +++ b/ld/testsuite/ld-cris/dso-pltdis2.d @@ -2,7 +2,7 @@ #source: dsov32-2.s #source: dsofng.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -d # Complement to dso-pltdis1.d; merging the other .got.plt entry. diff --git a/ld/testsuite/ld-cris/dso12-pltdis.d b/ld/testsuite/ld-cris/dso12-pltdis.d index 187730b..0bfb846 100644 --- a/ld/testsuite/ld-cris/dso12-pltdis.d +++ b/ld/testsuite/ld-cris/dso12-pltdis.d @@ -2,7 +2,7 @@ #source: dsov32-1.s #source: dsov32-2.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux -z nocombreloc +#ld: --shared -m crislinux -z nocombreloc --hash-style=sysv #objdump: -d # Check dissassembly of .plt section. diff --git a/ld/testsuite/ld-cris/expdyn1.d b/ld/testsuite/ld-cris/expdyn1.d index 51d875d..37cbe4d 100644 --- a/ld/testsuite/ld-cris/expdyn1.d +++ b/ld/testsuite/ld-cris/expdyn1.d @@ -1,6 +1,6 @@ #source: expdyn1.s #as: --no-underscore --em=criself -#ld: -m crislinux -export-dynamic tmpdir/libdso-1.so +#ld: -m crislinux -export-dynamic tmpdir/libdso-1.so --hash-style=sysv #objdump: -T .*: file format elf32-cris diff --git a/ld/testsuite/ld-cris/expdyn5.d b/ld/testsuite/ld-cris/expdyn5.d index 5504534..818ee4f 100644 --- a/ld/testsuite/ld-cris/expdyn5.d +++ b/ld/testsuite/ld-cris/expdyn5.d @@ -1,7 +1,7 @@ #source: expdyn1.s #source: expdref1.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so +#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so --hash-style=sysv #objdump: -s -j .got # Like expdyn2.d, but testing that the .got contents is correct. There diff --git a/ld/testsuite/ld-cris/expdyn6.d b/ld/testsuite/ld-cris/expdyn6.d index 43d04ff..cf4a578 100644 --- a/ld/testsuite/ld-cris/expdyn6.d +++ b/ld/testsuite/ld-cris/expdyn6.d @@ -2,7 +2,7 @@ #source: expdref1.s --pic #source: euwref1.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so +#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so --hash-style=sysv #objdump: -s -j .got # Like expdyn5.d, weakly referencing symbols. diff --git a/ld/testsuite/ld-cris/expdyn7.d b/ld/testsuite/ld-cris/expdyn7.d index 7bd91e0..6028343 100644 --- a/ld/testsuite/ld-cris/expdyn7.d +++ b/ld/testsuite/ld-cris/expdyn7.d @@ -2,7 +2,7 @@ #source: expdref1.s --pic #source: comref1.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so +#ld: -m crislinux --export-dynamic tmpdir/libdso-1.so --hash-style=sysv #objdump: -s -j .got # Like expdyn5.d, referencing COMMON symbols. diff --git a/ld/testsuite/ld-cris/gotplt1.d b/ld/testsuite/ld-cris/gotplt1.d index 8fcb7b5..0f5472f 100644 --- a/ld/testsuite/ld-cris/gotplt1.d +++ b/ld/testsuite/ld-cris/gotplt1.d @@ -2,7 +2,7 @@ #source: dsofnf2.s #source: gotrel1.s #as: --pic --no-underscore --em=criself -#ld: -m crislinux tmpdir/libdso-1.so +#ld: -m crislinux tmpdir/libdso-1.so --hash-style=sysv #objdump: -sR # Make sure we don't merge a PLT-specific entry diff --git a/ld/testsuite/ld-cris/gotplt2.d b/ld/testsuite/ld-cris/gotplt2.d index 48f1413..3a28111 100644 --- a/ld/testsuite/ld-cris/gotplt2.d +++ b/ld/testsuite/ld-cris/gotplt2.d @@ -2,7 +2,7 @@ #source: dsofnf.s #source: gotrel1.s #as: --pic --no-underscore --em=criself -#ld: -shared -m crislinux -z nocombreloc +#ld: -shared -m crislinux -z nocombreloc --hash-style=sysv #objdump: -sR # Make sure we merge a PLT-specific entry (usually diff --git a/ld/testsuite/ld-cris/gotplt3.d b/ld/testsuite/ld-cris/gotplt3.d index f4cb4be..727a17c 100644 --- a/ld/testsuite/ld-cris/gotplt3.d +++ b/ld/testsuite/ld-cris/gotplt3.d @@ -3,7 +3,7 @@ #source: gotrel1.s #source: dso-1.s #as: --pic --no-underscore --em=criself -#ld: -shared -m crislinux -z nocombreloc +#ld: -shared -m crislinux -z nocombreloc --hash-style=sysv #objdump: -sR # Like gotplt2, but make sure we merge right when we have a diff --git a/ld/testsuite/ld-cris/hiddef1.d b/ld/testsuite/ld-cris/hiddef1.d index 0be90a1..0f16b62 100644 --- a/ld/testsuite/ld-cris/hiddef1.d +++ b/ld/testsuite/ld-cris/hiddef1.d @@ -1,7 +1,7 @@ #source: gotrel1.s #source: hiddef1.s #source: hidrefgotplt1.s -#ld: -shared -m crislinux +#ld: -shared -m crislinux --hash-style=sysv #as: --pic --no-underscore -I$srcdir/$subdir --em=criself #readelf: -S -s -r diff --git a/ld/testsuite/ld-cris/libdso-10.d b/ld/testsuite/ld-cris/libdso-10.d index 43d96bd..83a1464 100644 --- a/ld/testsuite/ld-cris/libdso-10.d +++ b/ld/testsuite/ld-cris/libdso-10.d @@ -1,6 +1,6 @@ #source: dso-1.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -p -h # Sanity check; just an empty GOT. diff --git a/ld/testsuite/ld-cris/libdso-11.d b/ld/testsuite/ld-cris/libdso-11.d index dc7b75a..b462433 100644 --- a/ld/testsuite/ld-cris/libdso-11.d +++ b/ld/testsuite/ld-cris/libdso-11.d @@ -1,7 +1,7 @@ #source: dso-1.s #source: dsov32-1.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -T .*: file format elf32-cris diff --git a/ld/testsuite/ld-cris/libdso-12.d b/ld/testsuite/ld-cris/libdso-12.d index c8a4f62d..eba3ef4 100644 --- a/ld/testsuite/ld-cris/libdso-12.d +++ b/ld/testsuite/ld-cris/libdso-12.d @@ -2,7 +2,7 @@ #source: dsov32-1.s #source: dsov32-2.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux -z nocombreloc +#ld: --shared -m crislinux -z nocombreloc --hash-style=sysv #objdump: -s -T # Check for common DSO contents; load of GOT register, branch to diff --git a/ld/testsuite/ld-cris/libdso-12b.d b/ld/testsuite/ld-cris/libdso-12b.d index 87506ed..fb63d84 100644 --- a/ld/testsuite/ld-cris/libdso-12b.d +++ b/ld/testsuite/ld-cris/libdso-12b.d @@ -2,7 +2,7 @@ #source: dsov32-1.s #source: dsov32-2.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -T # Like libdso-12.d but without -z nocombreloc. diff --git a/ld/testsuite/ld-cris/libdso-12c.d b/ld/testsuite/ld-cris/libdso-12c.d index 37eab56..5936956 100644 --- a/ld/testsuite/ld-cris/libdso-12c.d +++ b/ld/testsuite/ld-cris/libdso-12c.d @@ -3,7 +3,7 @@ #source: dsov32-2.s #source: dso-1.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 +#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 --hash-style=sysv #objdump: -s -T # Like libdso-12b.d, but dsofn is defined and the two called functions diff --git a/ld/testsuite/ld-cris/libdso-13.d b/ld/testsuite/ld-cris/libdso-13.d index 772480e..1ef3cc4 100644 --- a/ld/testsuite/ld-cris/libdso-13.d +++ b/ld/testsuite/ld-cris/libdso-13.d @@ -1,7 +1,7 @@ #source: dso-1.s #source: dsov32-3.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux -z nocombreloc --enable-new-dtags +#ld: --shared -m crislinux -z nocombreloc --enable-new-dtags --hash-style=sysv #readelf: -d -r #warning: relocation R_CRIS_32_PCREL should not be used in a shared object; recompile with -fPIC diff --git a/ld/testsuite/ld-cris/libdso-13b.d b/ld/testsuite/ld-cris/libdso-13b.d index cd6f4e2..4008946 100644 --- a/ld/testsuite/ld-cris/libdso-13b.d +++ b/ld/testsuite/ld-cris/libdso-13b.d @@ -1,7 +1,7 @@ #source: dso-1.s #source: dsov32-3.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 +#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 --hash-style=sysv #readelf: -d -r # Like libdso-13.d, but without -z nocombreloc and with a version diff --git a/ld/testsuite/ld-cris/libdso-14.d b/ld/testsuite/ld-cris/libdso-14.d index c0a20e8..b60f5e5 100644 --- a/ld/testsuite/ld-cris/libdso-14.d +++ b/ld/testsuite/ld-cris/libdso-14.d @@ -1,7 +1,7 @@ #source: dso-1.s #source: dsov32-4.s #as: --pic --no-underscore --march=v32 --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #readelf: -d -r # Checking that a bsr to a non-PLT-decorated nonvisible function diff --git a/ld/testsuite/ld-cris/libdso-15.d b/ld/testsuite/ld-cris/libdso-15.d index ce57e97..61b546b 100644 --- a/ld/testsuite/ld-cris/libdso-15.d +++ b/ld/testsuite/ld-cris/libdso-15.d @@ -1,6 +1,6 @@ #source: expdyn2.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux --version-script $srcdir/$subdir/expalltst3 +#ld: --shared -m crislinux --version-script $srcdir/$subdir/expalltst3 --hash-style=sysv #objdump: -s -T # A DSO that has two versioned symbols, each with a weak alias. diff --git a/ld/testsuite/ld-cris/libdso-15b.d b/ld/testsuite/ld-cris/libdso-15b.d index 308b110..61ead56 100644 --- a/ld/testsuite/ld-cris/libdso-15b.d +++ b/ld/testsuite/ld-cris/libdso-15b.d @@ -1,6 +1,6 @@ #source: expdref2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/libdso-15.so #objdump: -s -T diff --git a/ld/testsuite/ld-cris/libdso-1b.d b/ld/testsuite/ld-cris/libdso-1b.d index 9ad2143..56e5788 100644 --- a/ld/testsuite/ld-cris/libdso-1b.d +++ b/ld/testsuite/ld-cris/libdso-1b.d @@ -1,6 +1,6 @@ #source: dso-1b.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 +#ld: --shared -m crislinux --version-script $srcdir/$subdir/hidedsofns2468 --hash-style=sysv #objdump: -T # Like libdso-1, but export the function as expfn@@TST2 and another diff --git a/ld/testsuite/ld-cris/libdso-1c.d b/ld/testsuite/ld-cris/libdso-1c.d index 066d5e2..0588d39 100644 --- a/ld/testsuite/ld-cris/libdso-1c.d +++ b/ld/testsuite/ld-cris/libdso-1c.d @@ -1,6 +1,6 @@ #source: expdref1.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/libdso-1b.so #objdump: -s -T diff --git a/ld/testsuite/ld-cris/libdso-1d.d b/ld/testsuite/ld-cris/libdso-1d.d index 47721de..a2a0ce5 100644 --- a/ld/testsuite/ld-cris/libdso-1d.d +++ b/ld/testsuite/ld-cris/libdso-1d.d @@ -1,7 +1,7 @@ #source: expdref1.s #source: expdyn1w.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/libdso-1b.so #objdump: -s -T diff --git a/ld/testsuite/ld-cris/libdso-2.d b/ld/testsuite/ld-cris/libdso-2.d index aa4a7c8..f04b64b 100644 --- a/ld/testsuite/ld-cris/libdso-2.d +++ b/ld/testsuite/ld-cris/libdso-2.d @@ -1,7 +1,7 @@ #source: dso-1.s #source: dso-2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux --version-script $srcdir/$subdir/hide1 +#ld: --shared -m crislinux --hash-style=sysv --version-script $srcdir/$subdir/hide1 #readelf: -S -s -r # Use "dsofn" from dso-1 in a GOTPLT reloc, but hide it in a diff --git a/ld/testsuite/ld-cris/libdso-4.d b/ld/testsuite/ld-cris/libdso-4.d index b7cc840..3d57395 100644 --- a/ld/testsuite/ld-cris/libdso-4.d +++ b/ld/testsuite/ld-cris/libdso-4.d @@ -1,6 +1,6 @@ #source: dso-2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -T # DSO with an undef symbol "dsofn". See undef1.d. diff --git a/ld/testsuite/ld-cris/pic-gc-72.d b/ld/testsuite/ld-cris/pic-gc-72.d index 7e72752..a471da5 100644 --- a/ld/testsuite/ld-cris/pic-gc-72.d +++ b/ld/testsuite/ld-cris/pic-gc-72.d @@ -2,7 +2,7 @@ #source: expdref1.s #source: expdyn1.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux --gc-sections +#ld: --shared -m crislinux --gc-sections --hash-style=sysv #objdump: -s -t -R -p -T # Exercise PIC relocs through changed GC sweep function. diff --git a/ld/testsuite/ld-cris/pic-gc-73.d b/ld/testsuite/ld-cris/pic-gc-73.d index 1ef22de..8fd7f38 100644 --- a/ld/testsuite/ld-cris/pic-gc-73.d +++ b/ld/testsuite/ld-cris/pic-gc-73.d @@ -1,7 +1,7 @@ #source: pic-gc-73.s #source: expdyn1.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux --gc-sections +#ld: --shared -m crislinux --gc-sections --hash-style=sysv #objdump: -s -t -R -p -T # Left-over code coverage case from pic-gc-72; local symbol. diff --git a/ld/testsuite/ld-cris/pr16044.d b/ld/testsuite/ld-cris/pr16044.d index e5d373d..f8546f1 100644 --- a/ld/testsuite/ld-cris/pr16044.d +++ b/ld/testsuite/ld-cris/pr16044.d @@ -2,7 +2,7 @@ #source: dso-2b.s #source: dso-1c.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #readelf: -s -r # PR 16044 is about a (compile-time-non-local) hidden function symbol, diff --git a/ld/testsuite/ld-cris/pv32-1.d b/ld/testsuite/ld-cris/pv32-1.d index c963ed1..c811744 100644 --- a/ld/testsuite/ld-cris/pv32-1.d +++ b/ld/testsuite/ld-cris/pv32-1.d @@ -1,6 +1,6 @@ #source: pv32.s #as: --march=v32 --no-underscore --em=criself -#ld: -e here -m crislinux tmpdir/libdso-12.so +#ld: -e here -m crislinux tmpdir/libdso-12.so --hash-style=sysv #objdump: -s -T # Trivial test of linking a program to a v32 DSO. diff --git a/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d b/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d index 1db2b9a..7459d9f 100644 --- a/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d +++ b/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d @@ -4,7 +4,7 @@ #source: tls128.s #source: tls-x.s #as: --no-underscore --em=criself --pic -I$srcdir/$subdir -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv --hash-style=sysv #objdump: -d -s -t -r -p # Linking a file with a DTPOFF from a .dtpoffd of a GD variable, PIC diff --git a/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d b/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d index 0f54e61..c66a982 100644 --- a/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d +++ b/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d @@ -4,7 +4,7 @@ #source: tls128.s #source: tls-commx.s #as: --no-underscore --em=criself --pic -I$srcdir/$subdir -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #objdump: -d -s -t -r -p # Linking a file with a DTPOFF from a .dtpoffd of a GD COMMON diff --git a/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d b/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d index 0a2ee06..cfb44ac 100644 --- a/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d +++ b/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d @@ -1,7 +1,7 @@ #source: start1.s #source: tls-dso-tpoffgotcomm1.s #as: --no-underscore --pic --em=criself -I$srcdir/$subdir -#ld: -m crislinux -shared +#ld: -m crislinux -shared --hash-style=sysv #objdump: -d -h -s -t -r -R -p # Make sure we can link a file with TPOFFGOT relocs against common diff --git a/ld/testsuite/ld-cris/tls-dso-x1x2-1.d b/ld/testsuite/ld-cris/tls-dso-x1x2-1.d index b539748..6168701 100644 --- a/ld/testsuite/ld-cris/tls-dso-x1x2-1.d +++ b/ld/testsuite/ld-cris/tls-dso-x1x2-1.d @@ -1,7 +1,7 @@ #source: tls-hx.s #source: tls-x1x2.s #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #objdump: -T # A DSO providing the TLS variables x1 and x2. diff --git a/ld/testsuite/ld-cris/tls-gc-71.d b/ld/testsuite/ld-cris/tls-gc-71.d index 9d87500..14feb3d 100644 --- a/ld/testsuite/ld-cris/tls-gc-71.d +++ b/ld/testsuite/ld-cris/tls-gc-71.d @@ -3,7 +3,7 @@ #source: tls128g.s #source: tls-hx.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux --gc-sections +#ld: --shared -m crislinux --gc-sections --hash-style=sysv #objdump: -s -t -R -p -T # DSO with a single R_CRIS_16_DTPREL against a hidden symbol, gc:ed. diff --git a/ld/testsuite/ld-cris/tls-gd-1.d b/ld/testsuite/ld-cris/tls-gd-1.d index 25de32d..789c54e 100644 --- a/ld/testsuite/ld-cris/tls-gd-1.d +++ b/ld/testsuite/ld-cris/tls-gd-1.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-gd-1.s #source: tls128.s #source: tls-x.s diff --git a/ld/testsuite/ld-cris/tls-gd-1h.d b/ld/testsuite/ld-cris/tls-gd-1h.d index 2e024bd..db60081 100644 --- a/ld/testsuite/ld-cris/tls-gd-1h.d +++ b/ld/testsuite/ld-cris/tls-gd-1h.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-gd-1.s #source: tls128g.s #source: tls-hx.s diff --git a/ld/testsuite/ld-cris/tls-gd-2.d b/ld/testsuite/ld-cris/tls-gd-2.d index 2f2546e..cc35710 100644 --- a/ld/testsuite/ld-cris/tls-gd-2.d +++ b/ld/testsuite/ld-cris/tls-gd-2.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-gd-2.s #source: tls128g.s #source: tls-x.s diff --git a/ld/testsuite/ld-cris/tls-gd-2h.d b/ld/testsuite/ld-cris/tls-gd-2h.d index f63be5c..da3ef7d 100644 --- a/ld/testsuite/ld-cris/tls-gd-2h.d +++ b/ld/testsuite/ld-cris/tls-gd-2h.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-gd-2.s #source: tls128g.s #source: tls-hx.s diff --git a/ld/testsuite/ld-cris/tls-ie-10.d b/ld/testsuite/ld-cris/tls-ie-10.d index 869173c..7e9c32d 100644 --- a/ld/testsuite/ld-cris/tls-ie-10.d +++ b/ld/testsuite/ld-cris/tls-ie-10.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ie-10.s #source: tls128g.s #source: tls-x.s diff --git a/ld/testsuite/ld-cris/tls-ie-11.d b/ld/testsuite/ld-cris/tls-ie-11.d index d326fbe..e231040 100644 --- a/ld/testsuite/ld-cris/tls-ie-11.d +++ b/ld/testsuite/ld-cris/tls-ie-11.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ie-11.s #source: tls128g.s #source: tls-x1x2.s diff --git a/ld/testsuite/ld-cris/tls-ie-78.d b/ld/testsuite/ld-cris/tls-ie-78.d index 3994df8..a402115 100644 --- a/ld/testsuite/ld-cris/tls-ie-78.d +++ b/ld/testsuite/ld-cris/tls-ie-78.d @@ -2,7 +2,7 @@ #source: tls128.s #source: tls-ie-8e.s #as: --no-underscore --em=criself -#ld: -m crislinux +#ld: -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/tls-dso-xz-1.so #objdump: -s -h -t -T -R -r -p diff --git a/ld/testsuite/ld-cris/tls-ie-8.d b/ld/testsuite/ld-cris/tls-ie-8.d index 3c7769b..f62d599 100644 --- a/ld/testsuite/ld-cris/tls-ie-8.d +++ b/ld/testsuite/ld-cris/tls-ie-8.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ie-8.s #source: tls128g.s #source: tls-x.s diff --git a/ld/testsuite/ld-cris/tls-ie-9.d b/ld/testsuite/ld-cris/tls-ie-9.d index 673ae4f..b9d9ee6 100644 --- a/ld/testsuite/ld-cris/tls-ie-9.d +++ b/ld/testsuite/ld-cris/tls-ie-9.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ie-9.s #source: tls128g.s #source: tls-x1x2.s diff --git a/ld/testsuite/ld-cris/tls-js1.d b/ld/testsuite/ld-cris/tls-js1.d index 0c1509f..3ac1c68 100644 --- a/ld/testsuite/ld-cris/tls-js1.d +++ b/ld/testsuite/ld-cris/tls-js1.d @@ -5,7 +5,7 @@ #source: tls-hx.s #source: dso-1.s #as: --pic --no-underscore --em=criself --march=v32 -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #readelf: -a # DSO with a R_CRIS_16_DTPREL and a R_CRIS_32_PLT_PCREL. The .got.plt diff --git a/ld/testsuite/ld-cris/tls-ld-4.d b/ld/testsuite/ld-cris/tls-ld-4.d index 2ac3d71..46e5e9b 100644 --- a/ld/testsuite/ld-cris/tls-ld-4.d +++ b/ld/testsuite/ld-cris/tls-ld-4.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ld-4.s #source: tls128g.s #source: tls-hx.s diff --git a/ld/testsuite/ld-cris/tls-ld-5.d b/ld/testsuite/ld-cris/tls-ld-5.d index c2ea111..d5982d9 100644 --- a/ld/testsuite/ld-cris/tls-ld-5.d +++ b/ld/testsuite/ld-cris/tls-ld-5.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ld-5.s #source: tls128g.s #source: tls-hx1x2.s diff --git a/ld/testsuite/ld-cris/tls-ld-6.d b/ld/testsuite/ld-cris/tls-ld-6.d index 0b54114..487c63e 100644 --- a/ld/testsuite/ld-cris/tls-ld-6.d +++ b/ld/testsuite/ld-cris/tls-ld-6.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls128g.s #source: tls-ld-6.s #source: tls-hx.s diff --git a/ld/testsuite/ld-cris/tls-ld-7.d b/ld/testsuite/ld-cris/tls-ld-7.d index c537050..db034af 100644 --- a/ld/testsuite/ld-cris/tls-ld-7.d +++ b/ld/testsuite/ld-cris/tls-ld-7.d @@ -1,5 +1,5 @@ #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #source: tls-ld-7.s #source: tls128g.s #source: tls-hx1x2.s diff --git a/ld/testsuite/ld-cris/tls-ldgd-14.d b/ld/testsuite/ld-cris/tls-ldgd-14.d index 4634dd2..01cb975 100644 --- a/ld/testsuite/ld-cris/tls-ldgd-14.d +++ b/ld/testsuite/ld-cris/tls-ldgd-14.d @@ -6,7 +6,7 @@ #source: tls-z.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -t -R -p -T # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-ldgd-15.d b/ld/testsuite/ld-cris/tls-ldgd-15.d index 8583bd2..6d5ac81 100644 --- a/ld/testsuite/ld-cris/tls-ldgd-15.d +++ b/ld/testsuite/ld-cris/tls-ldgd-15.d @@ -6,7 +6,7 @@ #source: tls-z.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -t -R -p -T # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-ldgdex-14.d b/ld/testsuite/ld-cris/tls-ldgdex-14.d index 83d94a7..bb497bb 100644 --- a/ld/testsuite/ld-cris/tls-ldgdex-14.d +++ b/ld/testsuite/ld-cris/tls-ldgdex-14.d @@ -5,7 +5,7 @@ #source: tls-ldgd-14.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: -m crislinux tmpdir/tls-dso-xz-1.so +#ld: -m crislinux tmpdir/tls-dso-xz-1.so --hash-style=sysv #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-ldgdex-15.d b/ld/testsuite/ld-cris/tls-ldgdex-15.d index fca739b..45e5ec3 100644 --- a/ld/testsuite/ld-cris/tls-ldgdex-15.d +++ b/ld/testsuite/ld-cris/tls-ldgdex-15.d @@ -5,7 +5,7 @@ #source: tls-ldgd-15.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: -m crislinux tmpdir/tls-dso-xz-1.so +#ld: -m crislinux tmpdir/tls-dso-xz-1.so --hash-style=sysv #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-ldgdx-14.d b/ld/testsuite/ld-cris/tls-ldgdx-14.d index 53fde9c..1d3dcde 100644 --- a/ld/testsuite/ld-cris/tls-ldgdx-14.d +++ b/ld/testsuite/ld-cris/tls-ldgdx-14.d @@ -4,7 +4,7 @@ #source: tls-ldgd-14.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux tmpdir/tls-dso-xz-1.so +#ld: --shared -m crislinux --hash-style=sysv tmpdir/tls-dso-xz-1.so #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-ldgdx-15.d b/ld/testsuite/ld-cris/tls-ldgdx-15.d index 8b0af3f..59f3aae 100644 --- a/ld/testsuite/ld-cris/tls-ldgdx-15.d +++ b/ld/testsuite/ld-cris/tls-ldgdx-15.d @@ -4,7 +4,7 @@ #source: tls-ldgd-15.s #source: tls-hx1x2.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux tmpdir/tls-dso-xz-1.so +#ld: --shared -m crislinux --hash-style=sysv tmpdir/tls-dso-xz-1.so #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for two diff --git a/ld/testsuite/ld-cris/tls-legdx-16.d b/ld/testsuite/ld-cris/tls-legdx-16.d index 1e3bc3e..a597167 100644 --- a/ld/testsuite/ld-cris/tls-legdx-16.d +++ b/ld/testsuite/ld-cris/tls-legdx-16.d @@ -5,7 +5,7 @@ #source: tls-legd-16.s #source: tls-x1x2.s #as: --no-underscore --em=criself -#ld: -m crislinux tmpdir/tls-dso-xz-1.so +#ld: -m crislinux tmpdir/tls-dso-xz-1.so --hash-style=sysv #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for an diff --git a/ld/testsuite/ld-cris/tls-legdx-17.d b/ld/testsuite/ld-cris/tls-legdx-17.d index 1d1c5ea..c5b7b4b 100644 --- a/ld/testsuite/ld-cris/tls-legdx-17.d +++ b/ld/testsuite/ld-cris/tls-legdx-17.d @@ -5,7 +5,7 @@ #source: tls-ldgd-14.s --pic #source: tls-x1x2.s #as: --no-underscore --em=criself -#ld: -m crislinux tmpdir/tls-dso-xz-1.so +#ld: -m crislinux tmpdir/tls-dso-xz-1.so --hash-style=sysv #objdump: -s -h -t -T -R -r -p # Check that we have proper NPTL/TLS markings and GOT for an diff --git a/ld/testsuite/ld-cris/tls-local-54.d b/ld/testsuite/ld-cris/tls-local-54.d index 7c0deb6..337fbd5 100644 --- a/ld/testsuite/ld-cris/tls-local-54.d +++ b/ld/testsuite/ld-cris/tls-local-54.d @@ -1,6 +1,6 @@ #source: tls-local-54.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -t -R -p -T # A DSO with a R_CRIS_32_GOT_GD against a local symbol. diff --git a/ld/testsuite/ld-cris/tls-local-60.d b/ld/testsuite/ld-cris/tls-local-60.d index 958a296..a2ed601 100644 --- a/ld/testsuite/ld-cris/tls-local-60.d +++ b/ld/testsuite/ld-cris/tls-local-60.d @@ -1,7 +1,7 @@ #source: tls-x.s #source: tls-local-59.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #objdump: -s -t -r -p -R -T # A DSO with a R_CRIS_32_GOT_GD, a R_CRIS_16_GOT_GD, a diff --git a/ld/testsuite/ld-cris/tls-local-61.d b/ld/testsuite/ld-cris/tls-local-61.d index bfa4a25..54d2786 100644 --- a/ld/testsuite/ld-cris/tls-local-61.d +++ b/ld/testsuite/ld-cris/tls-local-61.d @@ -1,6 +1,6 @@ #source: tls-local-59.s #as: --pic --no-underscore --em=criself -I$srcdir/$subdir -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #objdump: -s -t -r -p -R -T # A DSO with a R_CRIS_32_GOT_GD, a R_CRIS_16_GOT_GD, a diff --git a/ld/testsuite/ld-cris/tls-local-63.d b/ld/testsuite/ld-cris/tls-local-63.d index 320e717..256542c 100644 --- a/ld/testsuite/ld-cris/tls-local-63.d +++ b/ld/testsuite/ld-cris/tls-local-63.d @@ -1,7 +1,7 @@ #source: tls-ie-8.s --pic #source: tls-hx.s #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 6 -x 8 -x 5 # A R_CRIS_16_GOT_TPREL in a DSO against a hidden symbol. Make sure diff --git a/ld/testsuite/ld-cris/tls-local-64.d b/ld/testsuite/ld-cris/tls-local-64.d index 8fb44ee..9449f1f 100644 --- a/ld/testsuite/ld-cris/tls-local-64.d +++ b/ld/testsuite/ld-cris/tls-local-64.d @@ -2,7 +2,7 @@ #source: tls128.s #source: tls-hx.s #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 6 -x 8 -x 5 # A R_CRIS_16_GOT_TPREL in a DSO against a hidden symbol, at an offset diff --git a/ld/testsuite/ld-cris/tls-ok-30.d b/ld/testsuite/ld-cris/tls-ok-30.d index 94ed194..fef40b3 100644 --- a/ld/testsuite/ld-cris/tls-ok-30.d +++ b/ld/testsuite/ld-cris/tls-ok-30.d @@ -1,6 +1,6 @@ #source: tls-gdgotrelm.s --defsym r=8191 #as: --no-underscore --em=criself --pic -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -j .got -R # Verify that the first and last R_CRIS_16_GOT_GD entries are ok just diff --git a/ld/testsuite/ld-cris/tls-ok-32.d b/ld/testsuite/ld-cris/tls-ok-32.d index 8042e28..602710e 100644 --- a/ld/testsuite/ld-cris/tls-ok-32.d +++ b/ld/testsuite/ld-cris/tls-ok-32.d @@ -1,6 +1,6 @@ #source: tls-dtprelm.s --defsym r=32767 #as: --no-underscore --em=criself --pic -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -j .got -j .text -j .tdata -R # Check that a R_CRIS_16_DTPREL just below the theoretical limit diff --git a/ld/testsuite/ld-cris/tls-ok-34.d b/ld/testsuite/ld-cris/tls-ok-34.d index f534c993..ba3d1ae 100644 --- a/ld/testsuite/ld-cris/tls-ok-34.d +++ b/ld/testsuite/ld-cris/tls-ok-34.d @@ -1,6 +1,6 @@ #source: tls-gottprelm.s --defsym r=8189 #as: --no-underscore --em=criself --pic -#ld: --shared -m crislinux +#ld: --shared -m crislinux --hash-style=sysv #objdump: -s -j .got -R # Check that a R_CRIS_16_DTPREL just below the theoretical limit diff --git a/ld/testsuite/ld-cris/tls-und-38.d b/ld/testsuite/ld-cris/tls-und-38.d index 7830672..8cda650 100644 --- a/ld/testsuite/ld-cris/tls-und-38.d +++ b/ld/testsuite/ld-cris/tls-und-38.d @@ -1,6 +1,6 @@ #source: tls-gd-2.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 7 # Undefined reference for a R_CRIS_32_GOT_GD in a DSO. Not an error; diff --git a/ld/testsuite/ld-cris/tls-und-42.d b/ld/testsuite/ld-cris/tls-und-42.d index db45264..7a1a831 100644 --- a/ld/testsuite/ld-cris/tls-und-42.d +++ b/ld/testsuite/ld-cris/tls-und-42.d @@ -1,6 +1,6 @@ #source: tls-ie-10.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 7 # Undefined reference for a R_CRIS_32_GOT_TPREL in a DSO. Not an diff --git a/ld/testsuite/ld-cris/tls-und-46.d b/ld/testsuite/ld-cris/tls-und-46.d index 92755d4..bb38da4 100644 --- a/ld/testsuite/ld-cris/tls-und-46.d +++ b/ld/testsuite/ld-cris/tls-und-46.d @@ -1,6 +1,6 @@ #source: tls-gd-1.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 7 # Undefined reference for a R_CRIS_16_GOT_GD in a DSO. Not an error; diff --git a/ld/testsuite/ld-cris/tls-und-50.d b/ld/testsuite/ld-cris/tls-und-50.d index 6814aac..30274f5 100644 --- a/ld/testsuite/ld-cris/tls-und-50.d +++ b/ld/testsuite/ld-cris/tls-und-50.d @@ -1,6 +1,6 @@ #source: tls-ie-8.s --pic #as: --no-underscore --em=criself -#ld: -m crislinux --shared +#ld: -m crislinux --shared --hash-style=sysv #readelf: -a -x 7 # Undefined reference for a R_CRIS_16_GOT_TPREL in a DSO. Not an diff --git a/ld/testsuite/ld-cris/weakhiddso.d b/ld/testsuite/ld-cris/weakhiddso.d index 01940f7..71a4bdb 100644 --- a/ld/testsuite/ld-cris/weakhiddso.d +++ b/ld/testsuite/ld-cris/weakhiddso.d @@ -1,6 +1,6 @@ #source: weakhid.s #as: --pic --no-underscore --em=criself -#ld: --shared -m crislinux -z nocombreloc +#ld: --shared -m crislinux -z nocombreloc --hash-style=sysv #objdump: -s -R -T # Check that .weak and .weak .hidden object references are handled diff --git a/ld/testsuite/ld-cris/weakref2.d b/ld/testsuite/ld-cris/weakref2.d index b78ccca..9b50dbf 100644 --- a/ld/testsuite/ld-cris/weakref2.d +++ b/ld/testsuite/ld-cris/weakref2.d @@ -1,6 +1,6 @@ #source: gotrel2.s #as: --pic --no-underscore --em=criself -#ld: -m crislinux tmpdir/libdso-1.so +#ld: -m crislinux tmpdir/libdso-1.so --hash-style=sysv #objdump: -s -j .got # Like weakref1.d, but check contents of .got. diff --git a/ld/testsuite/ld-cris/weakref3.d b/ld/testsuite/ld-cris/weakref3.d index 4807106..aa59325 100644 --- a/ld/testsuite/ld-cris/weakref3.d +++ b/ld/testsuite/ld-cris/weakref3.d @@ -1,7 +1,7 @@ #source: start1.s #source: expdref3.s #as: --no-underscore --em=criself -#ld: -m crislinux +#ld: -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/libdso-15.so #readelf: -a -x 10 diff --git a/ld/testsuite/ld-cris/weakref4.d b/ld/testsuite/ld-cris/weakref4.d index aed0f39..3cc3c76 100644 --- a/ld/testsuite/ld-cris/weakref4.d +++ b/ld/testsuite/ld-cris/weakref4.d @@ -1,7 +1,7 @@ #source: start1.s #source: expdref4.s #as: --no-underscore --em=criself -#ld: -m crislinux +#ld: -m crislinux --hash-style=sysv #ld_after_inputfiles: tmpdir/libdso-15.so #readelf: -a -x 11 diff --git a/ld/testsuite/ld-elf/audit.exp b/ld/testsuite/ld-elf/audit.exp index 83ee355..b7af4b7 100644 --- a/ld/testsuite/ld-elf/audit.exp +++ b/ld/testsuite/ld-elf/audit.exp @@ -60,6 +60,9 @@ set build_tests { {"Run with -lusesaudit -lusesaudit2" "-Ltmpdir/ -lusesaudit -lusesaudit2" "" {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"} + {"Link with -z globalaudit" + "-Wl,-Paudit.so -Wl,-z,globalaudit" "" + {main.c} {{"readelf" {-d} "globalaudit.rd"}} "globalaudit.out"} } run_cc_link_tests $build_tests diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp index 61e6031..fcd0d96 100644 --- a/ld/testsuite/ld-elf/binutils.exp +++ b/ld/testsuite/ld-elf/binutils.exp @@ -81,13 +81,35 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options " } if [string match "*-z relro*" $ld_options] { + # These targets set TEXT_DYNAMIC and therefore have `.dynamic' + # in the (read-only) text segment rather than data segment. + set relro_dynamic [expr !([istarget "hppa64*-*-*"] \ + || ([istarget "mips*-*-*"] \ + && ![istarget "*-*-vxworks*"]))] + # These targets have `.got' in regular data even though they do + # not have `.got' there. + set relro_gotplt [expr [istarget "mips*-*-*"]] + # These targets do not set NO_SMALL_DATA or DATA_GOT and therefore + # have `.got' in (read-write) small data rather than regular data. + set relro_got [expr !([istarget "alpha*-*-*"] \ + || [istarget "hppa*-*-linux-*"] \ + || [istarget "hppa*-*-netbsd*"] \ + || [istarget "hppa*-*-openbsd*"] \ + || [istarget "metag-*-*"] \ + || [istarget "mips*-*-*"] \ + || [istarget "nios2*-*-*"] \ + || [istarget "or1k-*-*"] \ + || [istarget "riscv*-*-*"] \ + || [istarget "sh*-*-*"] \ + || [istarget "x86_64-*-rdos*"])] # Check if GNU_RELRO segment is generated. set got [remote_exec host "grep GNU_RELRO tmpdir/$test.exp"] if { ![string match "*GNU_RELRO*" $got] } then { set got [remote_exec host "cat tmpdir/$test.exp"] if { [string match "*.data.rel.ro*" $got] - || [string match "*.dynamic*" $got] - || [string match "*.got*" $got] + || ($relro_dynamic && [string match "*.dynamic*" $got]) + || ($relro_gotplt && [string match "*.got.plt*" $got]) + || ($relro_got && [string match "*.got*" $got]) || [string match "*.eh_frame*" $got] || [string match "*.gcc_except_table*" $got] || [string match "*.exception_ranges*" $got] diff --git a/ld/testsuite/ld-elf/comm-data2.ld b/ld/testsuite/ld-elf/comm-data2.ld index 3244453..ea1ac5b 100644 --- a/ld/testsuite/ld-elf/comm-data2.ld +++ b/ld/testsuite/ld-elf/comm-data2.ld @@ -9,6 +9,7 @@ SECTIONS .rela.dyn : { *(.rela.*) } .interp : { *(.interp) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } . = 0x76540000; diff --git a/ld/testsuite/ld-elf/eh3.d b/ld/testsuite/ld-elf/eh3.d index 3811341..6ac584a 100644 --- a/ld/testsuite/ld-elf/eh3.d +++ b/ld/testsuite/ld-elf/eh3.d @@ -23,20 +23,12 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+400078\.\.0+400090 +0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078\.\.0+400090 DW_CFA_advance_loc: 8 to 0+400080 DW_CFA_def_cfa_offset: 16 DW_CFA_offset: r6 \(rbp\) at cfa-16 DW_CFA_advance_loc: 8 to 0+400088 DW_CFA_def_cfa_register: r6 \(rbp\) - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop -0+0040 ZERO terminator +0+0038 ZERO terminator #pass diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d index b5eec2f..6c1cb32 100644 --- a/ld/testsuite/ld-elf/eh4.d +++ b/ld/testsuite/ld-elf/eh4.d @@ -28,14 +28,12 @@ Contents of the .eh_frame section: DW_CFA_set_loc: 0+0417 DW_CFA_def_cfa_offset: 80 -0+0048 0+0024 0+004c FDE cie=0+0000 pc=[0-9a-f]+\.\.[0-9a-f]+ +0+0048 0+002[04] 0+004c FDE cie=0+0000 pc=[0-9a-f]+\.\.[0-9a-f]+ DW_CFA_def_cfa_offset: 16 DW_CFA_advance_loc: [0-9a-f]+ to [0-9a-f]+ DW_CFA_def_cfa_offset: 24 DW_CFA_advance_loc: [0-9a-f]+ to [0-9a-f]+ DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0;.* - DW_CFA_nop #... - [0-9a-f]+ ZERO terminator #pass diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 80a8c42..655f0da 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -104,7 +104,7 @@ if { [check_shared_lib_support] } then { setup_xfail "tic6x-*-*" run_ld_link_tests { {"Build shared library for next test" - "-shared" "" "" "note-3.s" {} "note-3.so" } + "-shared --hash-style=sysv" "" "" "note-3.s" {} "note-3.so" } {"Link using broken linker script" "--script note-3.t tmpdir/note-3.so" "" "" "" { { ld "note-3.l" } } diff --git a/ld/testsuite/ld-elf/globalaudit.rd b/ld/testsuite/ld-elf/globalaudit.rd new file mode 100644 index 0000000..41dcaad --- /dev/null +++ b/ld/testsuite/ld-elf/globalaudit.rd @@ -0,0 +1,3 @@ +#... +.*\(FLAGS_1\).*Flags: .*GLOBAUDIT.* +#pass diff --git a/ld/testsuite/ld-elf/linkinfo1a.d b/ld/testsuite/ld-elf/linkinfo1a.d index b5ccf6f..1aeaf00 100644 --- a/ld/testsuite/ld-elf/linkinfo1a.d +++ b/ld/testsuite/ld-elf/linkinfo1a.d @@ -1,5 +1,5 @@ #source: linkinfo1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -SW #target: x86_64-* i?86-* diff --git a/ld/testsuite/ld-elf/linkinfo1b.d b/ld/testsuite/ld-elf/linkinfo1b.d index cb17683..f8e3bd0 100644 --- a/ld/testsuite/ld-elf/linkinfo1b.d +++ b/ld/testsuite/ld-elf/linkinfo1b.d @@ -1,5 +1,5 @@ #source: linkinfo1.s -#ld: -shared +#ld: -shared --hash-style=sysv #objcopy_linked_file: --strip-debug #readelf: -SW #target: x86_64-* i?86-* diff --git a/ld/testsuite/ld-elf/note-3.l b/ld/testsuite/ld-elf/note-3.l index 551ebaa..7e99bed 100644 --- a/ld/testsuite/ld-elf/note-3.l +++ b/ld/testsuite/ld-elf/note-3.l @@ -1,2 +1,2 @@ -.*warning: section '.hash' is being made into a note +.*warning: section '(.gnu|).hash' is being made into a note .* diff --git a/ld/testsuite/ld-elf/note-3.t b/ld/testsuite/ld-elf/note-3.t index 13324ae..47f3fe1 100644 --- a/ld/testsuite/ld-elf/note-3.t +++ b/ld/testsuite/ld-elf/note-3.t @@ -14,6 +14,7 @@ SECTIONS treated as notes... */ .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynstr : { *(.dynstr) } .dynsym : { *(.dynsym) } diff --git a/ld/testsuite/ld-elf/orphan-11.d b/ld/testsuite/ld-elf/orphan-11.d new file mode 100644 index 0000000..3daefba --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-11.d @@ -0,0 +1,9 @@ +#source: orphan-11.s +#ld: -T orphan-11.ld --orphan-handling=error +#objdump: -wh +#notarget: d30v-* dlx-* fr30-* frv-* ft32-* i860-* i960-* iq2000-* mn10200-* moxie-* ms1-* msp430-* mt-* pj-* + +#... + . \.text .* + . \.data .* +#pass diff --git a/ld/testsuite/ld-elf/orphan-11.ld b/ld/testsuite/ld-elf/orphan-11.ld new file mode 100644 index 0000000..b72f7d4 --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-11.ld @@ -0,0 +1,16 @@ +SECTIONS +{ + . = SIZEOF_HEADERS; + .text : { *(.text .text.*) } + .data : { *(.data .data.*) } + .bss : { *(.bss .bss.*) *(COMMON) } + .sbss : { *(.sbss .sbss.*) } + .note : { *(.note .note.*) } + .rela : { *(.rela .rela.*) } + .rel : { *(.rel .rel.*) } + + /DISCARD/ : { + *(.reginfo) *(.MIPS.abiflags) *(.MIPS.options) *(.trampolines) + *(.iplt*) *(.note*) *(.got*) *(.igot*) *(.*.attributes) *(.*.info) + *(.pdr) "linker stubs*"(*) } +} diff --git a/ld/testsuite/ld-elf/orphan-11.s b/ld/testsuite/ld-elf/orphan-11.s new file mode 100644 index 0000000..3d7961b --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-11.s @@ -0,0 +1,11 @@ + .section .text.foo,"axG",%progbits,foo_group + .word 0 + + .section .data.foo,"waG",%progbits,foo_group + .word 1 + + .section .text, "ax" + .word 0 + + .section .data, "wa" + .word 1 diff --git a/ld/testsuite/ld-elf/orphan-12.d b/ld/testsuite/ld-elf/orphan-12.d new file mode 100644 index 0000000..71a8c93 --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-12.d @@ -0,0 +1,9 @@ +#source: orphan-12.s +#ld: -T orphan-11.ld --strip-debug --orphan-handling=error +#objdump: -wh +#notarget: d30v-* dlx-* fr30-* frv-* ft32-* i860-* i960-* iq2000-* mn10200-* moxie-* ms1-* msp430-* mt-* pj-* + +#... + . \.text .* + . \.data .* +#pass diff --git a/ld/testsuite/ld-elf/orphan-12.s b/ld/testsuite/ld-elf/orphan-12.s new file mode 100644 index 0000000..f9cbcf7 --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-12.s @@ -0,0 +1,8 @@ + .section .debug_info, "",%progbits + .word 0 + + .section .text, "ax" + .word 0 + + .section .data, "wa" + .word 1 diff --git a/ld/testsuite/ld-elf/pr19617a.d b/ld/testsuite/ld-elf/pr19617a.d index 132021f..a565e29 100644 --- a/ld/testsuite/ld-elf/pr19617a.d +++ b/ld/testsuite/ld-elf/pr19617a.d @@ -1,5 +1,5 @@ #source: pr19617.s -#ld: -E --no-dynamic-linker +#ld: -E --no-dynamic-linker --hash-style=sysv #readelf : --dyn-syms --wide #target: *-*-linux* *-*-gnu* *-*-solaris* diff --git a/ld/testsuite/ld-elf/pr20828-v.ld b/ld/testsuite/ld-elf/pr20828-v.ld index cdba796..5800aa0 100644 --- a/ld/testsuite/ld-elf/pr20828-v.ld +++ b/ld/testsuite/ld-elf/pr20828-v.ld @@ -1,6 +1,7 @@ SECTIONS { .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } diff --git a/ld/testsuite/ld-elf/pr20828.ld b/ld/testsuite/ld-elf/pr20828.ld index 034887d..9bea8d2 100644 --- a/ld/testsuite/ld-elf/pr20828.ld +++ b/ld/testsuite/ld-elf/pr20828.ld @@ -8,6 +8,7 @@ SECTIONS } .dynamic : { *(.dynamic) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } diff --git a/ld/testsuite/ld-elf/pr21233.ld b/ld/testsuite/ld-elf/pr21233.ld index a3b547b..03a28cc 100644 --- a/ld/testsuite/ld-elf/pr21233.ld +++ b/ld/testsuite/ld-elf/pr21233.ld @@ -1,6 +1,7 @@ SECTIONS { .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .rel.dyn : { *(.rel.dyn) } diff --git a/ld/testsuite/ld-elf/pr21384.ld b/ld/testsuite/ld-elf/pr21384.ld index 034887d..9bea8d2 100644 --- a/ld/testsuite/ld-elf/pr21384.ld +++ b/ld/testsuite/ld-elf/pr21384.ld @@ -8,6 +8,7 @@ SECTIONS } .dynamic : { *(.dynamic) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } diff --git a/ld/testsuite/ld-elf/pr21562a.d b/ld/testsuite/ld-elf/pr21562a.d index ecf013f..e978734 100644 --- a/ld/testsuite/ld-elf/pr21562a.d +++ b/ld/testsuite/ld-elf/pr21562a.d @@ -8,5 +8,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562b.d b/ld/testsuite/ld-elf/pr21562b.d index 063a141..f1d058a 100644 --- a/ld/testsuite/ld-elf/pr21562b.d +++ b/ld/testsuite/ld-elf/pr21562b.d @@ -8,5 +8,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562c.d b/ld/testsuite/ld-elf/pr21562c.d index 1d72a0d..1bfbff3 100644 --- a/ld/testsuite/ld-elf/pr21562c.d +++ b/ld/testsuite/ld-elf/pr21562c.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562d.d b/ld/testsuite/ld-elf/pr21562d.d index f752a24..4f8e91e 100644 --- a/ld/testsuite/ld-elf/pr21562d.d +++ b/ld/testsuite/ld-elf/pr21562d.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562e.d b/ld/testsuite/ld-elf/pr21562e.d index 769f2f8..ee969bd 100644 --- a/ld/testsuite/ld-elf/pr21562e.d +++ b/ld/testsuite/ld-elf/pr21562e.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562f.d b/ld/testsuite/ld-elf/pr21562f.d index cb81c2a..119f43e 100644 --- a/ld/testsuite/ld-elf/pr21562f.d +++ b/ld/testsuite/ld-elf/pr21562f.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562g.d b/ld/testsuite/ld-elf/pr21562g.d index 9926416..f3d2a31 100644 --- a/ld/testsuite/ld-elf/pr21562g.d +++ b/ld/testsuite/ld-elf/pr21562g.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562h.d b/ld/testsuite/ld-elf/pr21562h.d index 1e723ba..0517aec 100644 --- a/ld/testsuite/ld-elf/pr21562h.d +++ b/ld/testsuite/ld-elf/pr21562h.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562i.d b/ld/testsuite/ld-elf/pr21562i.d index f5b59c5..8baa583 100644 --- a/ld/testsuite/ld-elf/pr21562i.d +++ b/ld/testsuite/ld-elf/pr21562i.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562j.d b/ld/testsuite/ld-elf/pr21562j.d index 70e311e..99d987c 100644 --- a/ld/testsuite/ld-elf/pr21562j.d +++ b/ld/testsuite/ld-elf/pr21562j.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562k.d b/ld/testsuite/ld-elf/pr21562k.d index 4c62eb7..6aa8334 100644 --- a/ld/testsuite/ld-elf/pr21562k.d +++ b/ld/testsuite/ld-elf/pr21562k.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562l.d b/ld/testsuite/ld-elf/pr21562l.d index b0ba90d..82bab1e 100644 --- a/ld/testsuite/ld-elf/pr21562l.d +++ b/ld/testsuite/ld-elf/pr21562l.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562m.d b/ld/testsuite/ld-elf/pr21562m.d index fbcf76f..e1ad876 100644 --- a/ld/testsuite/ld-elf/pr21562m.d +++ b/ld/testsuite/ld-elf/pr21562m.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562n.d b/ld/testsuite/ld-elf/pr21562n.d index 2453169..583c771 100644 --- a/ld/testsuite/ld-elf/pr21562n.d +++ b/ld/testsuite/ld-elf/pr21562n.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21884.d b/ld/testsuite/ld-elf/pr21884.d new file mode 100644 index 0000000..0de7b83 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21884.d @@ -0,0 +1,11 @@ +#source: pr21884a.s +#source: pr21884b.s +#ld: -T pr21884.t +#objdump: -b binary -s +#notarget: aarch64*-*-* arm*-*-* avr-*-* hppa-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-* +# Skip targets which can't change output format to binary. + +.*: file format binary + +Contents of section .data: +#pass diff --git a/ld/testsuite/ld-elf/pr21884.t b/ld/testsuite/ld-elf/pr21884.t new file mode 100644 index 0000000..d483911 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21884.t @@ -0,0 +1,7 @@ +OUTPUT_FORMAT("binary") + +ENTRY(_main); +SECTIONS { + . = 0; + .setup : { *(.setup) } +} diff --git a/ld/testsuite/ld-elf/pr21884a.s b/ld/testsuite/ld-elf/pr21884a.s new file mode 100644 index 0000000..a3361b2 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21884a.s @@ -0,0 +1,5 @@ + .text + .globl _main + .type _main,%function +_main: + .dc.a bar diff --git a/ld/testsuite/ld-elf/pr21884b.s b/ld/testsuite/ld-elf/pr21884b.s new file mode 100644 index 0000000..e533837 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21884b.s @@ -0,0 +1,5 @@ + .text + .globl bar + .type bar,%function +bar: + .byte 0 diff --git a/ld/testsuite/ld-elf/pr21903.s b/ld/testsuite/ld-elf/pr21903.s new file mode 100644 index 0000000..ce26b33 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903.s @@ -0,0 +1,11 @@ + .text + .global bar +bar: + .byte 0 + .data + .dc.a foo + .ifdef HPUX +foo .comm 4 + .else + .comm foo, 4, 4 + .endif diff --git a/ld/testsuite/ld-elf/pr21903a.d b/ld/testsuite/ld-elf/pr21903a.d new file mode 100644 index 0000000..020c561 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903a.d @@ -0,0 +1,8 @@ +#source: pr21903.s +#ld: -shared --no-define-common +#readelf: --dyn-syms +#target: *-*-linux* *-*-gnu* + +#... +.*: 0+0 +0 +OBJECT +GLOBAL +DEFAULT +UND foo +#pass diff --git a/ld/testsuite/ld-elf/pr21903b.d b/ld/testsuite/ld-elf/pr21903b.d new file mode 100644 index 0000000..decd4f3 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903b.d @@ -0,0 +1,8 @@ +#source: pr21903.s +#ld: -shared +#readelf: --dyn-syms +#target: *-*-linux* *-*-gnu* + +#... +.*: [0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/pr21903c.d b/ld/testsuite/ld-elf/pr21903c.d new file mode 100644 index 0000000..d3910ec --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903c.d @@ -0,0 +1,3 @@ +#source: pr21903.s +#ld: --no-define-common +#error: --no-define-common may not be used without -shared diff --git a/ld/testsuite/ld-elf/pr21903d.d b/ld/testsuite/ld-elf/pr21903d.d new file mode 100644 index 0000000..ec72900 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903d.d @@ -0,0 +1,4 @@ +#source: pr21903.s +#ld: --no-define-common -pie +#target: *-*-linux* *-*-gnu* +#error: --no-define-common may not be used without -shared diff --git a/ld/testsuite/ld-elf/pr21903e.d b/ld/testsuite/ld-elf/pr21903e.d new file mode 100644 index 0000000..894c595 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21903e.d @@ -0,0 +1,3 @@ +#source: pr21903.s +#ld: -r --no-define-common +#error: --no-define-common may not be used without -shared diff --git a/ld/testsuite/ld-elf/pr21904.d b/ld/testsuite/ld-elf/pr21904.d new file mode 100644 index 0000000..1d464fc --- /dev/null +++ b/ld/testsuite/ld-elf/pr21904.d @@ -0,0 +1,6 @@ +#ld: -d -r +#readelf: -s + +#... +.*: [0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ foo +#pass diff --git a/ld/testsuite/ld-elf/pr21904.s b/ld/testsuite/ld-elf/pr21904.s new file mode 100644 index 0000000..587a226 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21904.s @@ -0,0 +1,5 @@ + .ifdef HPUX +foo .comm 4 + .else + .comm foo, 4, 4 + .endif diff --git a/ld/testsuite/ld-elf/pr21964-1a.c b/ld/testsuite/ld-elf/pr21964-1a.c new file mode 100644 index 0000000..680bda4 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-1a.c @@ -0,0 +1,12 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int +foo1 (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 5; + if (__start___verbose == __stop___verbose + || __start___verbose[0] != 5) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-1b.c b/ld/testsuite/ld-elf/pr21964-1b.c new file mode 100644 index 0000000..1507b22 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-1b.c @@ -0,0 +1,12 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int +foo2 (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 10; + if (__start___verbose == __stop___verbose + || __start___verbose[0] != 10) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-1c.c b/ld/testsuite/ld-elf/pr21964-1c.c new file mode 100644 index 0000000..996a9e1 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-1c.c @@ -0,0 +1,29 @@ +#include <stdio.h> + +extern int foo1 (void); +extern int foo2 (void); + +extern int __start___verbose[]; +extern int __stop___verbose[]; +static int my_var __attribute__((used, section("__verbose"))) = 6; +int +bar (void) +{ + if (__start___verbose == __stop___verbose) + return -1; + + if (__start___verbose[0] != 6) + return -2; + else + return 0; +} + +int +main () +{ + if (bar () == 0 + && foo1 () == 0 + && foo2 () == 0) + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-2a.c b/ld/testsuite/ld-elf/pr21964-2a.c new file mode 100644 index 0000000..6331ff0 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-2a.c @@ -0,0 +1,12 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int +foo1 (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 5; + if (__start___verbose == __stop___verbose + && __start___verbose[0] != 5) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-2b.c b/ld/testsuite/ld-elf/pr21964-2b.c new file mode 100644 index 0000000..1507b22 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-2b.c @@ -0,0 +1,12 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int +foo2 (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 10; + if (__start___verbose == __stop___verbose + || __start___verbose[0] != 10) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-2c.c b/ld/testsuite/ld-elf/pr21964-2c.c new file mode 100644 index 0000000..f879dd5 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-2c.c @@ -0,0 +1,32 @@ +#include <dlfcn.h> +#include <stdio.h> + +extern int foo1 (void); + +int main() +{ + void *dl; + void *sym; + int (*func) (void); + + if (foo1 () != 0) + return 1; + + dl = dlopen("pr21964-2b.so", RTLD_LAZY); + if (!dl) + return 2; + + sym = dlsym(dl, "__start___verbose"); + if (!sym) + return 3; + + func = dlsym(dl, "foo2"); + if (!func) + return 4; + if (func () == 0) + printf ("PASS\n"); + + dlclose(dl); + + return 0; +} diff --git a/ld/testsuite/ld-elf/pr22150.vd b/ld/testsuite/ld-elf/pr22150.vd new file mode 100644 index 0000000..d43f7fe --- /dev/null +++ b/ld/testsuite/ld-elf/pr22150.vd @@ -0,0 +1,2 @@ + +No version information found in this file. diff --git a/ld/testsuite/ld-elf/pr22150.ver b/ld/testsuite/ld-elf/pr22150.ver new file mode 100644 index 0000000..962d6d2 --- /dev/null +++ b/ld/testsuite/ld-elf/pr22150.ver @@ -0,0 +1,6 @@ +BAR { +global: + bar; +local: + *; +}; diff --git a/ld/testsuite/ld-elf/pr22150a.s b/ld/testsuite/ld-elf/pr22150a.s new file mode 100644 index 0000000..051a965 --- /dev/null +++ b/ld/testsuite/ld-elf/pr22150a.s @@ -0,0 +1,6 @@ + .text + .globl bar + .type bar, %function +bar: + .byte 0 + .size bar, .-bar diff --git a/ld/testsuite/ld-elf/pr22150b.s b/ld/testsuite/ld-elf/pr22150b.s new file mode 100644 index 0000000..dcdf509 --- /dev/null +++ b/ld/testsuite/ld-elf/pr22150b.s @@ -0,0 +1,13 @@ + .section .text._start,"ax",%progbits + .globl _start + .type _start, %function +_start: + .byte 0 + .size _start, .-_start + + .section .text.bar,"ax",%progbits + .globl foo + .type foo, %function +foo: + .dc.a bar + .size foo, .-foo diff --git a/ld/testsuite/ld-elf/provide-hidden-1.ld b/ld/testsuite/ld-elf/provide-hidden-1.ld index 479862d..ab10bc9 100644 --- a/ld/testsuite/ld-elf/provide-hidden-1.ld +++ b/ld/testsuite/ld-elf/provide-hidden-1.ld @@ -13,4 +13,5 @@ SECTIONS .dynstr : { *(.dynstr) } .dynamic : { *(.dynamic) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } } diff --git a/ld/testsuite/ld-elf/provide-hidden-2.ld b/ld/testsuite/ld-elf/provide-hidden-2.ld index 17e526b..3fc7513 100644 --- a/ld/testsuite/ld-elf/provide-hidden-2.ld +++ b/ld/testsuite/ld-elf/provide-hidden-2.ld @@ -9,4 +9,5 @@ SECTIONS .dynstr : { *(.dynstr) } .dynamic : { *(.dynamic) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } } diff --git a/ld/testsuite/ld-elf/provide-hidden-s.ld b/ld/testsuite/ld-elf/provide-hidden-s.ld index fc5761a..bd6aaf0 100644 --- a/ld/testsuite/ld-elf/provide-hidden-s.ld +++ b/ld/testsuite/ld-elf/provide-hidden-s.ld @@ -9,4 +9,5 @@ SECTIONS .dynstr : { *(.dynstr) } .dynamic : { *(.dynamic) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } } diff --git a/ld/testsuite/ld-elf/readelf.exp b/ld/testsuite/ld-elf/readelf.exp index 6831c19..82673f6 100644 --- a/ld/testsuite/ld-elf/readelf.exp +++ b/ld/testsuite/ld-elf/readelf.exp @@ -44,7 +44,7 @@ if [check_shared_lib_support] { [list \ "readelf version information" \ "$LFLAGS --no-dynamic-linker -e 0 --export-dynamic -T ver_def.ld\ - --version-script=ver_def.ver" \ + --hash-style=sysv --version-script=ver_def.ver" \ "" "" \ {ver_def.s} \ [list [list readelf --version-info ver_def$DUMP.vd]] \ diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 8b139ec..2bb0750 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -170,6 +170,29 @@ if { [check_gc_sections_available] } { "pr21233-3"]] } +if { [check_gc_sections_available] } { + run_ld_link_tests [list \ + [list \ + "Build pr22150.so" \ + "$LFLAGS -shared --version-script pr22150.ver" \ + "" \ + "$AFLAGS_PIC" \ + {pr22150a.s} \ + {} \ + "pr22150.so" \ + ] \ + [list \ + "Build pr22150" \ + "$LFLAGS -e _start --gc-sections" \ + "tmpdir/pr22150.so" \ + "" \ + {pr22150b.s} \ + {{readelf -V pr22150.vd}} \ + "pr22150" \ + ] \ + ] +} + # Check to see if the C compiler works if { [which $CC] == 0 } { return @@ -423,6 +446,18 @@ set build_tests { {"Build libpr19073.so" "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC" {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"} + {"Build pr21964-1a.so" + "-shared" "-fPIC" + {pr21964-1a.c} {} "pr21964-1a.so"} + {"Build pr21964-1b.so" + "-shared" "-fPIC" + {pr21964-1b.c} {} "pr21964-1b.so"} + {"Build pr21964-2a.so" + "-shared" "-fPIC" + {pr21964-2a.c} {} "pr21964-2a.so"} + {"Build pr21964-2b.so" + "-shared" "-fPIC" + {pr21964-2b.c} {} "pr21964-2b.so"} } run_cc_link_tests $build_tests @@ -540,6 +575,9 @@ set run_tests [list \ [list "Run pr18458" \ "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \ {pr18458c.c} "pr18458" "pass.out" ] \ + [list "Run pr21964-1" \ + "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so" "" \ + {pr21964-1c.c} "pr21964-1" "pass.out" ] \ ] # NetBSD ELF systems do not currently support the .*_array sections. @@ -586,6 +624,9 @@ set dlopen_run_tests [list \ [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ {dl6dmain.c} "dl6d1" "dl6b.out" ] \ + [list "Run pr21964-2" \ + "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-2a.so $extralibs" "" \ + {pr21964-2c.c} "pr21964-2" "pass.out" ] \ ] # Only run them when libdl is available. diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d index 572ffbd..3eaa4e5 100644 --- a/ld/testsuite/ld-elf/sizeofa.d +++ b/ld/testsuite/ld-elf/sizeofa.d @@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +(PROTECTED|DEFAULT) +[0-9]+ +___?stop_scnfoo #... +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo #pass diff --git a/ld/testsuite/ld-elf/sizeofb.d b/ld/testsuite/ld-elf/sizeofb.d index ac4a6a4..c7d4edd 100644 --- a/ld/testsuite/ld-elf/sizeofb.d +++ b/ld/testsuite/ld-elf/sizeofb.d @@ -7,7 +7,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo -#... - +[0-9]+: 0+10 + +0 +NOTYPE +LOCAL +DEFAULT +ABS +.sizeof.scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/stab.d b/ld/testsuite/ld-elf/stab.d index 346640d..27b99cb 100644 --- a/ld/testsuite/ld-elf/stab.d +++ b/ld/testsuite/ld-elf/stab.d @@ -5,10 +5,10 @@ #notarget: "ia64-*-*" "alpha*" # Disabled on alpha because the entry point may be above 4GB but the stabs -# value on 32 bits. +# value only 32 bits. #... - \[[0-9 ][0-9]\] \.stab +PROGBITS +0+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ +[1-9]+ +0.* +.* \.stab +PROGBITS +0+ [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ +[1-9][0-9]* +0.* #... - \[[0-9 ][0-9]\] \.stabstr +STRTAB +0+ [0-9a-f]+ [0-9a-f]+ 00 +0 +0.* +.* \.stabstr +STRTAB +0+ [0-9a-f]+ [0-9a-f]+ 00 +0 +0.* #... diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d index 07d5dda..6a4460f 100644 --- a/ld/testsuite/ld-elf/startofa.d +++ b/ld/testsuite/ld-elf/startofa.d @@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.startof.scnfoo #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +(PROTECTED|DEFAULT) +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/startofb.d b/ld/testsuite/ld-elf/startofb.d index 5d659bb..b0cf563 100644 --- a/ld/testsuite/ld-elf/startofb.d +++ b/ld/testsuite/ld-elf/startofb.d @@ -7,7 +7,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +.startof.scnfoo -#... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp index da33768..83fa8ef 100644 --- a/ld/testsuite/ld-elfcomm/elfcomm.exp +++ b/ld/testsuite/ld-elfcomm/elfcomm.exp @@ -101,7 +101,7 @@ proc test_sort_common {} { test_sort_common -set test1 "size/aligment change of common symbols" +set test1 "size/alignment change of common symbols" set test1w1 "$test1 (warning 1)" set test1w2 "$test1 (warning 2)" set test1c1 "$test1 (change 1)" diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index 7552f7a..8e2b55b 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -377,7 +377,7 @@ proc visibility_run {visibility} { visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \ mainnp.o sh1np.o sh2np.o elfvsb \ - "-T $srcdir/$subdir/elf-offset.ld" + "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" } } # Now compile the code using -fpic. diff --git a/ld/testsuite/ld-elfvsb/hidden2.d b/ld/testsuite/ld-elfvsb/hidden2.d index 30f7f95..72a42d5 100644 --- a/ld/testsuite/ld-elfvsb/hidden2.d +++ b/ld/testsuite/ld-elfvsb/hidden2.d @@ -1,5 +1,5 @@ #source: hidden2.s -#ld: -shared -T hidden2.ld +#ld: -shared -T hidden2.ld --hash-style=sysv #readelf: -Ds # It is also ok to remove this symbol, but we currently make it local. diff --git a/ld/testsuite/ld-frv/fdpic-pie-1.d b/ld/testsuite/ld-frv/fdpic-pie-1.d index 5369d07..6b40e74 100644 --- a/ld/testsuite/ld-frv/fdpic-pie-1.d +++ b/ld/testsuite/ld-frv/fdpic-pie-1.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to local symbols, pie linking #source: fdpic1.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -pie +#ld: -pie --hash-style=sysv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-pie-2.d b/ld/testsuite/ld-frv/fdpic-pie-2.d index 40c1532..9e06d8f 100644 --- a/ld/testsuite/ld-frv/fdpic-pie-2.d +++ b/ld/testsuite/ld-frv/fdpic-pie-2.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to global symbols, pie linking #source: fdpic2.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -pie +#ld: -pie --hash-style=sysv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-pie-6.d b/ld/testsuite/ld-frv/fdpic-pie-6.d index 743166e..2285322 100644 --- a/ld/testsuite/ld-frv/fdpic-pie-6.d +++ b/ld/testsuite/ld-frv/fdpic-pie-6.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to weak undefined symbols, pie linking #source: fdpic6.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -pie --defsym WD1=D6 +#ld: -pie --hash-style=sysv --defsym WD1=D6 .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-pie-7.d b/ld/testsuite/ld-frv/fdpic-pie-7.d index 7eceec2..3968c0b 100644 --- a/ld/testsuite/ld-frv/fdpic-pie-7.d +++ b/ld/testsuite/ld-frv/fdpic-pie-7.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to local symbols with addends, pie linking #source: fdpic7.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -pie +#ld: -pie --hash-style=sysv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-pie-8.d b/ld/testsuite/ld-frv/fdpic-pie-8.d index 8f7c344..62f456b 100644 --- a/ld/testsuite/ld-frv/fdpic-pie-8.d +++ b/ld/testsuite/ld-frv/fdpic-pie-8.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to global symbols with addends, pie linking #source: fdpic8.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -pie +#ld: -pie --hash-style=sysv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-2.d b/ld/testsuite/ld-frv/fdpic-shared-2.d index 13e140a..85ab28d 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-2.d +++ b/ld/testsuite/ld-frv/fdpic-shared-2.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to (mostly) global symbols, shared linking #source: fdpic2.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -shared --version-script fdpic2min.ldv +#ld: -shared --hash-style=sysv --version-script fdpic2min.ldv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-5.d b/ld/testsuite/ld-frv/fdpic-shared-5.d index dbfd143..6ec516a 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-5.d +++ b/ld/testsuite/ld-frv/fdpic-shared-5.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to undefined symbols, shared linking #source: fdpic5.s #objdump: -DRz -j .text -j .data -j .got -j .plt -#ld: -shared +#ld: -shared --hash-style=sysv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-6.d b/ld/testsuite/ld-frv/fdpic-shared-6.d index 2191af8..70111fb 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-6.d +++ b/ld/testsuite/ld-frv/fdpic-shared-6.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to weak undefined symbols, shared linking #source: fdpic6.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -shared --defsym WD1=D6 --version-script fdpic6.ldv +#ld: -shared --hash-style=sysv --defsym WD1=D6 --version-script fdpic6.ldv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-8.d b/ld/testsuite/ld-frv/fdpic-shared-8.d index e50e7b9..30a9cfb 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-8.d +++ b/ld/testsuite/ld-frv/fdpic-shared-8.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to (mostly) global symbols with addends, shared linking #source: fdpic8.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -shared --version-script fdpic8min.ldv +#ld: -shared --hash-style=sysv --version-script fdpic8min.ldv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-local-2.d b/ld/testsuite/ld-frv/fdpic-shared-local-2.d index 0074172..76fd777 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-local-2.d +++ b/ld/testsuite/ld-frv/fdpic-shared-local-2.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to forced-local symbols, shared linking #source: fdpic2.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -shared --version-script fdpic2.ldv +#ld: -shared --hash-style=sysv --version-script fdpic2.ldv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/fdpic-shared-local-8.d b/ld/testsuite/ld-frv/fdpic-shared-local-8.d index 7d238e9..82130a1 100644 --- a/ld/testsuite/ld-frv/fdpic-shared-local-8.d +++ b/ld/testsuite/ld-frv/fdpic-shared-local-8.d @@ -1,7 +1,7 @@ #name: FRV uClinux PIC relocs to forced-local symbols with addends, shared linking #source: fdpic8.s #objdump: -DR -j .text -j .data -j .got -j .plt -#ld: -shared --version-script fdpic8.ldv +#ld: -shared --hash-style=sysv --version-script fdpic8.ldv .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-frv/tls-dynamic-2.d b/ld/testsuite/ld-frv/tls-dynamic-2.d index d943e86..be7e6c8 100644 --- a/ld/testsuite/ld-frv/tls-dynamic-2.d +++ b/ld/testsuite/ld-frv/tls-dynamic-2.d @@ -1,7 +1,7 @@ #name: FRV TLS relocs with addends, dynamic linking #source: tls-2.s #objdump: -DR -j .text -j .got -j .plt -#ld: tmpdir/tls-1-dep.so +#ld: --hash-style=sysv tmpdir/tls-1-dep.so .*: file format elf.*frv.* diff --git a/ld/testsuite/ld-gc/pr19161.d b/ld/testsuite/ld-gc/pr19161.d index baee8da..474cbd4 100644 --- a/ld/testsuite/ld-gc/pr19161.d +++ b/ld/testsuite/ld-gc/pr19161.d @@ -2,7 +2,7 @@ #source: dummy.s #ld: --gc-sections -e main tmpdir/pr19161-1.o tmpdir/pr19161-2.o #nm: --format=bsd -#xfail: epiphany-*-* frv-*-* hppa-*-* iq2000-*-* lm32-*-* m32c-*-* +#xfail: epiphany-*-* frv-*-* iq2000-*-* lm32-*-* m32c-*-* #xfail: mips64vr-*-* msp430-*-* powerpc*-*-eabivle rl78-*-* rx-*-* sh*-*-* #... diff --git a/ld/testsuite/ld-gc/pr20022.d b/ld/testsuite/ld-gc/pr20022.d index 906f73d..40473c2 100644 --- a/ld/testsuite/ld-gc/pr20022.d +++ b/ld/testsuite/ld-gc/pr20022.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] _foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start__foo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +__start__foo #pass diff --git a/ld/testsuite/ld-gc/start.d b/ld/testsuite/ld-gc/start.d index 9113b48..18e74c1 100644 --- a/ld/testsuite/ld-gc/start.d +++ b/ld/testsuite/ld-gc/start.d @@ -5,5 +5,5 @@ #notarget: *-*-*aout *-*-*oldld frv-*-linux* metag-*-linux* #... -[0-9a-f]+ d +__start__foo +[0-9a-f]+ D +__start__foo #... diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 6c53046..d79c4583 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -24,23 +24,24 @@ if {[istarget "i?86-*-vxworks"]} { set i386tests { - {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" + {"VxWorks shared library test 1" + "-shared -Tvxworks1.ld --hash-style=sysv" "" "" {vxworks1-lib.s} {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} "libvxworks1.so"} {"VxWorks executable test 1 (dynamic)" \ - "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" + "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks1.s} {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} "vxworks1"} {"VxWorks executable test 2 (dynamic)" \ - "-Tvxworks1.ld -q --force-dynamic" "" + "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks2.s} {{readelf --segments vxworks2.sd}} "vxworks2"} {"VxWorks executable test 2 (static)" - "-Tvxworks1.ld" "" + "-Tvxworks1.ld --hash-style=sysv" "" "" {vxworks2.s} {{readelf --segments vxworks2-static.sd}} "vxworks2"} @@ -128,20 +129,20 @@ set i386tests { "-shared -melf_i386 tmpdir/libpltlib.so" "" "--32" {plt-pic.s} {{objdump -drj.plt plt-pic.pd}} "libplt-pic.so"} {"TLS -fpic -shared transitions" - "-shared -melf_i386 --no-ld-generated-unwind-info" "" + "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlspic1.s tlspic2.s} {{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} "libtlspic.so"} {"TLS -fpic -shared transitions without PLT" - "-shared -melf_i386 --no-ld-generated-unwind-info" "" + "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" "" "-mrelax-relocations=yes --32" {tlspic3.s tlspic2.s} {{readelf -Ssrl tlspic2.rd} {objdump -drj.text tlspic2.dd} {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}} "libtlspic2.so"} {"TLS descriptor -fpic -shared transitions" - "-shared -melf_i386 --no-ld-generated-unwind-info" "" + "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlsdesc.s tlspic2.s} {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd} {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}} @@ -149,31 +150,31 @@ set i386tests { {"Helper shared library" "-shared -melf_i386" "" "--32" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlsbinpic.s tlsbin.s} {{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"TLS -fpic and -fno-pic exec transitions without PLT" - "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "-mrelax-relocations=yes --32" {tlsbinpic2.s tlsbin.s} {{readelf -Ssrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd} {objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}} "tlsbin2"} {"TLS descriptor -fpic and -fno-pic exec transitions" - "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlsbindesc.s tlsbin.s} {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} "tlsbindesc"} {"TLS -fno-pic -shared" - "-shared -melf_i386 --no-ld-generated-unwind-info" "" + "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlsnopic1.s tlsnopic2.s} {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd} {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"} {"TLS with global dynamic and descriptors" - "-shared -melf_i386 --no-ld-generated-unwind-info" "" + "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" "" "--32" {tlsgdesc.s} {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}} "libtlsgdesc.so"} @@ -307,6 +308,7 @@ run_dump_test "protected4" run_dump_test "protected5" run_dump_test "protected6a" run_dump_test "protected6b" +run_dump_test "protected7" run_dump_test "tlspie1" run_dump_test "tlspie2" run_dump_test "tlspie3a" @@ -434,6 +436,15 @@ run_dump_test "property-x86-shstk3a" run_dump_test "property-x86-shstk3b" run_dump_test "property-x86-shstk4" run_dump_test "property-x86-shstk5" +run_dump_test "pie1" +run_dump_test "pie1-nacl" +run_dump_test "pr21884" +run_dump_test "pr21884-nacl" +run_dump_test "pr22115-1a" +run_dump_test "pr22115-1b" +run_dump_test "pr22115-1c" +run_dump_test "pr22115-1d" +run_dump_test "pr22135" if { !([istarget "i?86-*-linux*"] || [istarget "i?86-*-gnu*"] @@ -462,8 +473,8 @@ proc undefined_weak {cflags ldflags} { set testname "$testname ($cflags $ldflags)" } - if { [ regexp "\-fPIE" $cflags] - && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } { + if { [string match "*-fPIE*" $cflags] + && ![string match "*-z nodynamic-undefined-weak*" $ldflags] } { set weak_symbol "Weak defined" } else { set weak_symbol "Weak undefined" @@ -1239,6 +1250,25 @@ if { [isnative] if { [isnative] && [istarget "i?86-*-*"] && [which $CC] != 0 } { + run_cc_link_tests [list \ + [list \ + "Build pr22001-1.so" \ + "-shared" \ + "" \ + { pr22001-1a.c } \ + {} \ + "pr22001-1.so" \ + ] \ + [list \ + "Build pr21997-1.so" \ + "-shared" \ + "" \ + { property-stack.S property-no-copy.S pr21997-1a.S } \ + {} \ + "pr21997-1.so" \ + ] \ + ] + run_ld_link_exec_tests [list \ [list \ "Run weakundef1 without PIE" \ @@ -1250,15 +1280,106 @@ if { [isnative] "$NOPIE_CFLAGS" \ ] \ [list \ - "Run weakundef1 with PIE" \ - "-pie" \ + "Run pr22001-1" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ "" \ - { weakundef1.c } \ - "weakundef1pie" \ + { pr22001-1b.c } \ + "pr22001-1" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run pr22001-1 (PIE 1)" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1c.S } \ + "pr22001-1-pie-1" \ + "pass.out" \ + ] \ + [list \ + "Run pr22001-1 (PIE 2)" \ + "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1c.S } \ + "pr22001-1-pie-2" \ + "pass.out" \ + ] \ + [list \ + "Run pr22001-1 (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1b.c } \ + "pr22001-1-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr22001-1 (PIC 2)" \ + "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1b.c } \ + "pr22001-1-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1b.c } \ + "pr21997-1" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run pr21997-1 (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1b.c } \ + "pr21997-1-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1 (PIC 2)" \ + "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1b.c } \ + "pr21997-1-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1 (PIE 1)" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1c.S } \ + "pr21997-1-pie-1" \ + "pass.out" \ + ] \ + [list \ + "Run pr21997-1 (PIE 2)" \ + "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1c.S } \ + "pr21997-1-pie-2" \ "pass.out" \ - "-fPIE" \ ] \ ] + + if { [at_least_gcc_version 5 0] } { + run_ld_link_exec_tests [list \ + [list \ + "Run weakundef1 with PIE" \ + "-pie" \ + "" \ + { weakundef1.c } \ + "weakundef1pie" \ + "pass.out" \ + "-fPIE" \ + ] \ + ] + } } if { !([istarget "i?86-*-linux*"] @@ -1269,7 +1390,7 @@ if { !([istarget "i?86-*-linux*"] run_ld_link_tests [list \ [list \ "basic PLT generation (non-PIC, -z now)" \ - "-z now -melf_i386 tmpdir/libpltlib.so" \ + "-z now -melf_i386 --hash-style=sysv tmpdir/libpltlib.so" \ "" \ "--32" \ {plt2.s} \ diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d index 1c90591..a131675 100644 --- a/ld/testsuite/ld-i386/ibt-plt-1.d +++ b/ld/testsuite/ld-i386/ibt-plt-1.d @@ -1,5 +1,5 @@ #as: --32 -#ld: -shared -m elf_i386 +#ld: -shared -m elf_i386 --hash-style=sysv #objdump: -dw .*: +file format .* @@ -37,7 +37,7 @@ Disassembly of section .text: 0+200 <foo>: +[a-f0-9]+: 53 push %ebx +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx> - +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx + +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt> +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt> diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d index 4881dea..13c6949 100644 --- a/ld/testsuite/ld-i386/ibt-plt-2a.d +++ b/ld/testsuite/ld-i386/ibt-plt-2a.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --32 -#ld: -shared -m elf_i386 -z ibtplt +#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -38,7 +38,7 @@ Disassembly of section .text: 0+200 <foo>: +[a-f0-9]+: 53 push %ebx +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx> - +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx + +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt> +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt> diff --git a/ld/testsuite/ld-i386/ibt-plt-2b.d b/ld/testsuite/ld-i386/ibt-plt-2b.d index 740b889..90541f1 100644 --- a/ld/testsuite/ld-i386/ibt-plt-2b.d +++ b/ld/testsuite/ld-i386/ibt-plt-2b.d @@ -1,7 +1,52 @@ #source: ibt-plt-2.s #as: --32 -#ld: -shared -m elf_i386 -z ibtplt -#readelf: -n +#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv +#readelf: -n -wf + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + Augmentation data: 1b + + DW_CFA_def_cfa: r4 \(esp\) ofs 4 + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop + +0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e + DW_CFA_advance_loc: 1 to 00000201 + DW_CFA_def_cfa_offset: 8 + DW_CFA_offset: r3 \(ebx\) at cfa-8 + DW_CFA_advance_loc: 14 to 0000020f + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 13 to 0000021c + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 0000021d + DW_CFA_restore: r3 \(ebx\) + DW_CFA_def_cfa_offset: 4 + +0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0 + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 6 to 000001b6 + DW_CFA_def_cfa_offset: 12 + DW_CFA_advance_loc: 10 to 000001c0 + DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\) + +0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-i386/ibt-plt-2c.d b/ld/testsuite/ld-i386/ibt-plt-2c.d index 2ba1d78..63f4427 100644 --- a/ld/testsuite/ld-i386/ibt-plt-2c.d +++ b/ld/testsuite/ld-i386/ibt-plt-2c.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --32 -#ld: -shared -m elf_i386 -z ibt +#ld: -shared -m elf_i386 -z ibt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -38,7 +38,7 @@ Disassembly of section .text: 0+200 <foo>: +[a-f0-9]+: 53 push %ebx +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx> - +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx + +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt> +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt> diff --git a/ld/testsuite/ld-i386/ibt-plt-2d.d b/ld/testsuite/ld-i386/ibt-plt-2d.d index 3e02a62..f57c7e8 100644 --- a/ld/testsuite/ld-i386/ibt-plt-2d.d +++ b/ld/testsuite/ld-i386/ibt-plt-2d.d @@ -1,7 +1,52 @@ #source: ibt-plt-2.s #as: --32 -#ld: -shared -m elf_i386 -z ibt -#readelf: -n +#ld: -shared -m elf_i386 -z ibt --hash-style=sysv +#readelf: -n -wf + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + Augmentation data: 1b + + DW_CFA_def_cfa: r4 \(esp\) ofs 4 + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop + +0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e + DW_CFA_advance_loc: 1 to 00000201 + DW_CFA_def_cfa_offset: 8 + DW_CFA_offset: r3 \(ebx\) at cfa-8 + DW_CFA_advance_loc: 14 to 0000020f + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 13 to 0000021c + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 0000021d + DW_CFA_restore: r3 \(ebx\) + DW_CFA_def_cfa_offset: 4 + +0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0 + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 6 to 000001b6 + DW_CFA_def_cfa_offset: 12 + DW_CFA_advance_loc: 10 to 000001c0 + DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\) + +0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d index c2ce3fd..5455c92 100644 --- a/ld/testsuite/ld-i386/ibt-plt-3a.d +++ b/ld/testsuite/ld-i386/ibt-plt-3a.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --32 -#ld: -shared -m elf_i386 -z ibtplt +#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -38,7 +38,7 @@ Disassembly of section .text: 0+1e0 <foo>: +[a-f0-9]+: 53 push %ebx +[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx> - +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx + +[a-f0-9]+: 81 c3 1a 11 00 00 add \$0x111a,%ebx +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt> +[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt> diff --git a/ld/testsuite/ld-i386/ibt-plt-3b.d b/ld/testsuite/ld-i386/ibt-plt-3b.d index d9b5be2..6e6637f 100644 --- a/ld/testsuite/ld-i386/ibt-plt-3b.d +++ b/ld/testsuite/ld-i386/ibt-plt-3b.d @@ -1,5 +1,49 @@ #source: ibt-plt-3.s #as: --32 -#ld: -shared -m elf_i386 -z ibtplt -#readelf: -n +#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + Augmentation data: 1b + + DW_CFA_def_cfa: r4 \(esp\) ofs 4 + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop + +0+18 0000001c 0000001c FDE cie=00000000 pc=000001e0..000001fe + DW_CFA_advance_loc: 1 to 000001e1 + DW_CFA_def_cfa_offset: 8 + DW_CFA_offset: r3 \(ebx\) at cfa-8 + DW_CFA_advance_loc: 14 to 000001ef + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 13 to 000001fc + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 000001fd + DW_CFA_restore: r3 \(ebx\) + DW_CFA_def_cfa_offset: 4 + +0+38 00000010 0000003c FDE cie=00000000 pc=000001fe..00000202 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 00000020 00000050 FDE cie=00000000 pc=00000190..000001c0 + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 6 to 00000196 + DW_CFA_def_cfa_offset: 12 + DW_CFA_advance_loc: 10 to 000001a0 + DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\) + +0+70 00000010 00000074 FDE cie=00000000 pc=000001c0..000001e0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d index c2ce3fd..5455c92 100644 --- a/ld/testsuite/ld-i386/ibt-plt-3c.d +++ b/ld/testsuite/ld-i386/ibt-plt-3c.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --32 -#ld: -shared -m elf_i386 -z ibtplt +#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -38,7 +38,7 @@ Disassembly of section .text: 0+1e0 <foo>: +[a-f0-9]+: 53 push %ebx +[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx> - +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx + +[a-f0-9]+: 81 c3 1a 11 00 00 add \$0x111a,%ebx +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp +[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt> +[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt> diff --git a/ld/testsuite/ld-i386/ibt-plt-3d.d b/ld/testsuite/ld-i386/ibt-plt-3d.d index 3cf159a..1ef91db 100644 --- a/ld/testsuite/ld-i386/ibt-plt-3d.d +++ b/ld/testsuite/ld-i386/ibt-plt-3d.d @@ -1,7 +1,52 @@ #source: ibt-plt-3.s #as: --32 -#ld: -shared -m elf_i386 -z ibt -#readelf: -n +#ld: -shared -m elf_i386 -z ibt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -4 + Return address column: 8 + Augmentation data: 1b + + DW_CFA_def_cfa: r4 \(esp\) ofs 4 + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop + +0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e + DW_CFA_advance_loc: 1 to 00000201 + DW_CFA_def_cfa_offset: 8 + DW_CFA_offset: r3 \(ebx\) at cfa-8 + DW_CFA_advance_loc: 14 to 0000020f + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 13 to 0000021c + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 0000021d + DW_CFA_restore: r3 \(ebx\) + DW_CFA_def_cfa_offset: 4 + +0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0 + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 6 to 000001b6 + DW_CFA_def_cfa_offset: 12 + DW_CFA_advance_loc: 10 to 000001c0 + DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\) + +0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-i386/pie1-nacl.d b/ld/testsuite/ld-i386/pie1-nacl.d new file mode 100644 index 0000000..aafd6a7 --- /dev/null +++ b/ld/testsuite/ld-i386/pie1-nacl.d @@ -0,0 +1,18 @@ +#source: pie1.s +#as: --32 +#ld: -pie -melf_i386 -z relro +#objdump: -dw --sym +#target: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + +SYMBOL TABLE: +#... +10020000 l O .got.plt 0+ _GLOBAL_OFFSET_TABLE_ +#... + +Disassembly of section .text: + +0+ <_start>: + +0: 8d 80 00 00 fe ef lea -0x10020000\(%eax\),%eax +#pass diff --git a/ld/testsuite/ld-i386/pie1.d b/ld/testsuite/ld-i386/pie1.d new file mode 100644 index 0000000..e77b8dc --- /dev/null +++ b/ld/testsuite/ld-i386/pie1.d @@ -0,0 +1,17 @@ +#as: --32 +#ld: -pie -melf_i386 -z relro +#objdump: -dw --sym +#notarget: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + +SYMBOL TABLE: +#... +0+2000 l O .got.plt 0+ _GLOBAL_OFFSET_TABLE_ +#... + +Disassembly of section .text: + +.* <_start>: +.*: 8d 80 00 e0 ff ff lea -0x2000\(%eax\),%eax +#pass diff --git a/ld/testsuite/ld-i386/pie1.s b/ld/testsuite/ld-i386/pie1.s new file mode 100644 index 0000000..b4d1d73 --- /dev/null +++ b/ld/testsuite/ld-i386/pie1.s @@ -0,0 +1,5 @@ + .text + .global _start + .weak foo +_start: + leal foo@GOTOFF(%eax), %eax diff --git a/ld/testsuite/ld-i386/plt-pic2.dd b/ld/testsuite/ld-i386/plt-pic2.dd index 4047db5..1d81c76 100644 --- a/ld/testsuite/ld-i386/plt-pic2.dd +++ b/ld/testsuite/ld-i386/plt-pic2.dd @@ -9,25 +9,25 @@ Disassembly of section .plt: -0+180 <.plt>: +.* <.plt>: +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\) +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\) +[a-f0-9]+: 00 00 add %al,\(%eax\) ... -0+190 <fn1@plt>: +.* <fn1@plt>: +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) +[a-f0-9]+: 68 00 00 00 00 push \$0x0 - +[a-f0-9]+: e9 e0 ff ff ff jmp 180 <.plt> + +[a-f0-9]+: e9 e0 ff ff ff jmp .* <.plt> -0+1a0 <fn2@plt>: +.* <fn2@plt>: +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\) +[a-f0-9]+: 68 08 00 00 00 push \$0x8 - +[a-f0-9]+: e9 d0 ff ff ff jmp 180 <.plt> + +[a-f0-9]+: e9 d0 ff ff ff jmp .* <.plt> Disassembly of section .text: -0+1b0 <foo>: - +[a-f0-9]+: e8 db ff ff ff call 190 <fn1@plt> - +[a-f0-9]+: e9 e6 ff ff ff jmp 1a0 <fn2@plt> +.* <foo>: + +[a-f0-9]+: e8 db ff ff ff call .* <fn1@plt> + +[a-f0-9]+: e9 e6 ff ff ff jmp .* <fn2@plt> #pass diff --git a/ld/testsuite/ld-i386/pr19636-1d.d b/ld/testsuite/ld-i386/pr19636-1d.d index ac86786..e667cae 100644 --- a/ld/testsuite/ld-i386/pr19636-1d.d +++ b/ld/testsuite/ld-i386/pr19636-1d.d @@ -9,7 +9,7 @@ Disassembly of section .plt: -0+c0 <.plt>: +.* <.plt>: [ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\) [ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\) [ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) @@ -20,7 +20,7 @@ Disassembly of section .plt: Disassembly of section .text: -0+e0 <_start>: +.* <_start>: [ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax [ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) -[ ]*[a-f0-9]+: e8 df ff ff ff call d0 <.*> +[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10> diff --git a/ld/testsuite/ld-i386/pr19636-2b.d b/ld/testsuite/ld-i386/pr19636-2b.d index 9a0a263..ac21025 100644 --- a/ld/testsuite/ld-i386/pr19636-2b.d +++ b/ld/testsuite/ld-i386/pr19636-2b.d @@ -10,8 +10,6 @@ Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entries: Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start -#... +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func #... diff --git a/ld/testsuite/ld-i386/pr19636-2c.d b/ld/testsuite/ld-i386/pr19636-2c.d index 08db119..3c7cd6d 100644 --- a/ld/testsuite/ld-i386/pr19636-2c.d +++ b/ld/testsuite/ld-i386/pr19636-2c.d @@ -9,20 +9,20 @@ Disassembly of section .plt: -0+130 <.plt>: +.* <.plt>: [ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\) [ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\) [ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) [ ]*[a-f0-9]+: 00 00 add %al,\(%eax\) [ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) [ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0 -[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 150 <_start> +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp .* <_start> Disassembly of section .text: -0+150 <_start>: +.* <_start>: [ ]*[a-f0-9]+: 3b 80 fc ff ff ff cmp -0x4\(%eax\),%eax [ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\) -[ ]*[a-f0-9]+: e8 df ff ff ff call 140 <.*> +[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10> [ ]*[a-f0-9]+: 3d 00 00 00 00 cmp \$0x0,%eax -[ ]*[a-f0-9]+: e8 fc ff ff ff call 167 <.*> +[ ]*[a-f0-9]+: e8 fc ff ff ff call .* <_start\+0x17> diff --git a/ld/testsuite/ld-i386/pr20830.d b/ld/testsuite/ld-i386/pr20830.d index 55fe924..26caabb 100644 --- a/ld/testsuite/ld-i386/pr20830.d +++ b/ld/testsuite/ld-i386/pr20830.d @@ -1,6 +1,6 @@ #name: PR ld/20830 (.plt.got) #as: --32 -#ld: -melf_i386 -shared -z relro --ld-generated-unwind-info +#ld: -melf_i386 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-i386/pr21884-nacl.d b/ld/testsuite/ld-i386/pr21884-nacl.d new file mode 100644 index 0000000..82daaaa --- /dev/null +++ b/ld/testsuite/ld-i386/pr21884-nacl.d @@ -0,0 +1,10 @@ +#source: dummy.s +#as: --32 +#ld: -m elf_i386 -T pr21884-nacl.t -b binary +#objdump: -b binary -s +#target: i?86-*-nacl* x86_64-*-nacl* + +.*: file format binary + +Contents of section .data: +#pass diff --git a/ld/testsuite/ld-i386/pr21884-nacl.t b/ld/testsuite/ld-i386/pr21884-nacl.t new file mode 100644 index 0000000..3ffb56c --- /dev/null +++ b/ld/testsuite/ld-i386/pr21884-nacl.t @@ -0,0 +1,11 @@ +OUTPUT_FORMAT("elf32-i386-nacl"); +OUTPUT_ARCH(i386); + +ENTRY(_start); +SECTIONS { + . = 0x10000; + _start = . ; + .data : { + *(.data) + } +} diff --git a/ld/testsuite/ld-i386/pr21884.d b/ld/testsuite/ld-i386/pr21884.d new file mode 100644 index 0000000..ea73aa2 --- /dev/null +++ b/ld/testsuite/ld-i386/pr21884.d @@ -0,0 +1,10 @@ +#source: dummy.s +#as: --32 +#ld: -m elf_i386 -T pr21884.t -b binary +#objdump: -b binary -s +#notarget: i?86-*-nacl* x86_64-*-nacl* + +.*: file format binary + +Contents of section .data: +#pass diff --git a/ld/testsuite/ld-i386/pr21884.t b/ld/testsuite/ld-i386/pr21884.t new file mode 100644 index 0000000..4cf8cdc --- /dev/null +++ b/ld/testsuite/ld-i386/pr21884.t @@ -0,0 +1,11 @@ +OUTPUT_FORMAT("elf32-i386"); +OUTPUT_ARCH(i386); + +ENTRY(_start); +SECTIONS { + . = 0x10000; + _start = . ; + .data : { + *(.data) + } +} diff --git a/ld/testsuite/ld-i386/pr21997-1a.S b/ld/testsuite/ld-i386/pr21997-1a.S new file mode 100644 index 0000000..aea17f8 --- /dev/null +++ b/ld/testsuite/ld-i386/pr21997-1a.S @@ -0,0 +1,35 @@ + .text + .p2align 4,,15 + .globl get_protected + .type get_protected, @function +get_protected: + call __x86.get_pc_thunk.ax + addl $_GLOBAL_OFFSET_TABLE_, %eax + movl protected@GOTOFF(%eax), %eax + ret + .size get_protected, .-get_protected + .p2align 4,,15 + .globl get_protected_p + .type get_protected_p, @function +get_protected_p: + call __x86.get_pc_thunk.ax + addl $_GLOBAL_OFFSET_TABLE_, %eax + leal protected@GOTOFF(%eax), %eax + ret + .size get_protected_p, .-get_protected_p + .protected protected + .globl protected + .data + .align 4 + .type protected, @object + .size protected, 4 +protected: + .long 1 + .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat + .globl __x86.get_pc_thunk.ax + .hidden __x86.get_pc_thunk.ax + .type __x86.get_pc_thunk.ax, @function +__x86.get_pc_thunk.ax: + movl (%esp), %eax + ret + .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-i386/pr21997-1b.c b/ld/testsuite/ld-i386/pr21997-1b.c new file mode 100644 index 0000000..576362e --- /dev/null +++ b/ld/testsuite/ld-i386/pr21997-1b.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +extern int protected; +extern int get_protected (void); +extern int* get_protected_p (void); + +int +main () +{ + + if (protected == get_protected () + && &protected == get_protected_p ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-i386/pr21997-1c.S b/ld/testsuite/ld-i386/pr21997-1c.S new file mode 100644 index 0000000..8534877 --- /dev/null +++ b/ld/testsuite/ld-i386/pr21997-1c.S @@ -0,0 +1,51 @@ + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "PASS" + .section .text.startup,"ax",@progbits + .p2align 4,,15 + .globl main + .type main, @function +main: + leal 4(%esp), %ecx + andl $-16, %esp + pushl -4(%ecx) + pushl %ebp + movl %esp, %ebp + pushl %esi + pushl %ebx + pushl %ecx + call __x86.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx + subl $12, %esp + call get_protected@PLT + movl protected@GOT(%ebx), %esi + cmpl (%esi), %eax + je .L7 +.L3: + leal -12(%ebp), %esp + xorl %eax, %eax + popl %ecx + popl %ebx + popl %esi + popl %ebp + leal -4(%ecx), %esp + ret +.L7: + call get_protected_p@PLT + cmpl %esi, %eax + jne .L3 + leal .LC0@GOTOFF(%ebx), %eax + subl $12, %esp + pushl %eax + call puts@PLT + addl $16, %esp + jmp .L3 + .size main, .-main + .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat + .globl __x86.get_pc_thunk.bx + .hidden __x86.get_pc_thunk.bx + .type __x86.get_pc_thunk.bx, @function +__x86.get_pc_thunk.bx: + movl (%esp), %ebx + ret + .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-i386/pr22001-1a.c b/ld/testsuite/ld-i386/pr22001-1a.c new file mode 100644 index 0000000..2b55ea8 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22001-1a.c @@ -0,0 +1,13 @@ +int copy = 1; + +int +get_copy () +{ + return copy; +} + +int * +get_copy_p () +{ + return © +} diff --git a/ld/testsuite/ld-i386/pr22001-1b.c b/ld/testsuite/ld-i386/pr22001-1b.c new file mode 100644 index 0000000..8eadd42 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22001-1b.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +extern int copy; +extern int get_copy (void); +extern int* get_copy_p (void); + +int +main () +{ + if (copy == get_copy () && © == get_copy_p ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-i386/pr22001-1c.S b/ld/testsuite/ld-i386/pr22001-1c.S new file mode 100644 index 0000000..2c1041d --- /dev/null +++ b/ld/testsuite/ld-i386/pr22001-1c.S @@ -0,0 +1,51 @@ + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "PASS" + .section .text.startup,"ax",@progbits + .p2align 4,,15 + .globl main + .type main, @function +main: + leal 4(%esp), %ecx + andl $-16, %esp + pushl -4(%ecx) + pushl %ebp + movl %esp, %ebp + pushl %esi + pushl %ebx + pushl %ecx + call __x86.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx + subl $12, %esp + call get_copy@PLT + movl copy@GOT(%ebx), %esi + cmpl (%esi), %eax + je .L7 +.L3: + leal -12(%ebp), %esp + xorl %eax, %eax + popl %ecx + popl %ebx + popl %esi + popl %ebp + leal -4(%ecx), %esp + ret +.L7: + call get_copy_p@PLT + cmpl %esi, %eax + jne .L3 + leal .LC0@GOTOFF(%ebx), %eax + subl $12, %esp + pushl %eax + call puts@PLT + addl $16, %esp + jmp .L3 + .size main, .-main + .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat + .globl __x86.get_pc_thunk.bx + .hidden __x86.get_pc_thunk.bx + .type __x86.get_pc_thunk.bx, @function +__x86.get_pc_thunk.bx: + movl (%esp), %ebx + ret + .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-i386/pr22115-1.s b/ld/testsuite/ld-i386/pr22115-1.s new file mode 100644 index 0000000..341eede --- /dev/null +++ b/ld/testsuite/ld-i386/pr22115-1.s @@ -0,0 +1,7 @@ + .text + .globl _start + .type _start, @function +_start: + movl __ehdr_start@GOT(%eax), %eax + .size _start, .-_start + .weak __ehdr_start diff --git a/ld/testsuite/ld-i386/pr22115-1a.d b/ld/testsuite/ld-i386/pr22115-1a.d new file mode 100644 index 0000000..4857952 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22115-1a.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --32 -mrelax-relocations=yes +#ld: -pie -z text -m elf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax +#pass diff --git a/ld/testsuite/ld-i386/pr22115-1b.d b/ld/testsuite/ld-i386/pr22115-1b.d new file mode 100644 index 0000000..bb05851 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22115-1b.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --32 -mrelax-relocations=yes +#ld: -pie -z text -m elf_i386 +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/pr22115-1c.d b/ld/testsuite/ld-i386/pr22115-1c.d new file mode 100644 index 0000000..ce70539 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22115-1c.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --32 -mrelax-relocations=yes +#ld: -pie -z text -m elf_i386 --no-dynamic-linker +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax +#pass diff --git a/ld/testsuite/ld-i386/pr22115-1d.d b/ld/testsuite/ld-i386/pr22115-1d.d new file mode 100644 index 0000000..3a0b8e3 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22115-1d.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --32 -mrelax-relocations=yes +#ld: -pie -z text -m elf_i386 --no-dynamic-linker +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/pr22135.d b/ld/testsuite/ld-i386/pr22135.d new file mode 100644 index 0000000..a5796ba --- /dev/null +++ b/ld/testsuite/ld-i386/pr22135.d @@ -0,0 +1,12 @@ +#as: --32 -mrelax-relocations=yes +#ld: -pie -melf_i386 --no-keep-memory +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax +#pass diff --git a/ld/testsuite/ld-i386/pr22135.s b/ld/testsuite/ld-i386/pr22135.s new file mode 100644 index 0000000..6afad88 --- /dev/null +++ b/ld/testsuite/ld-i386/pr22135.s @@ -0,0 +1,11 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl _start + .type _start, @function +_start: + movl foo@GOT(%ecx), %eax + .size _start, .-_start diff --git a/ld/testsuite/ld-i386/protected7.d b/ld/testsuite/ld-i386/protected7.d new file mode 100644 index 0000000..aafa2d8 --- /dev/null +++ b/ld/testsuite/ld-i386/protected7.d @@ -0,0 +1,13 @@ +#as: --32 +#ld: -shared -melf_i386 +#objdump: -drw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <bar>: +[ ]*[a-f0-9]+: 8b 81 [a-f0-9][a-f0-9] [a-f0-9][a-f0-9] 00 00 mov 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-i386/protected7.s b/ld/testsuite/ld-i386/protected7.s new file mode 100644 index 0000000..bc2bc91 --- /dev/null +++ b/ld/testsuite/ld-i386/protected7.s @@ -0,0 +1,31 @@ + .protected foo +.globl foo + .data + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 1 + .text +.globl bar + .type bar, @function +bar: + movl foo@GOTOFF(%ecx), %eax + ret + .size bar, .-bar + + .section ".note.gnu.property", "a" + .p2align 2 + .long 1f - 0f /* name length. */ + .long 3f - 1f /* data length. */ + /* NT_GNU_PROPERTY_TYPE_0 */ + .long 5 /* note type. */ +0: + .asciz "GNU" /* vendor name. */ +1: + .p2align 2 + /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */ + .long 2 /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align 2 +3: diff --git a/ld/testsuite/ld-ia64/ia64.exp b/ld/testsuite/ld-ia64/ia64.exp index 88c8df6..76f9e62 100644 --- a/ld/testsuite/ld-ia64/ia64.exp +++ b/ld/testsuite/ld-ia64/ia64.exp @@ -37,7 +37,7 @@ if { !([istarget "ia64-*-elf*"] # readelf: Apply readelf options on result. Compare with regex (last arg). set ia64tests { - {"TLS -fpic -shared" "-shared" "" + {"TLS -fpic -shared" "-shared --hash-style=sysv" "" "-mtune=itanium1" {tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} @@ -45,7 +45,8 @@ set ia64tests { {"Helper shared library" "-shared" "" "" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec" - "tmpdir/libtlslib.so" "" "-mtune=itanium1" {tlsbinpic.s tlsbin.s} + "tmpdir/libtlslib.so --hash-style=sysv" "" + "-mtune=itanium1" {tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} diff --git a/ld/testsuite/ld-ia64/merge1.d b/ld/testsuite/ld-ia64/merge1.d index 39882b8..0cc8bd1 100644 --- a/ld/testsuite/ld-ia64/merge1.d +++ b/ld/testsuite/ld-ia64/merge1.d @@ -1,6 +1,6 @@ #source: merge1.s #as: -x -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #... diff --git a/ld/testsuite/ld-ia64/merge2.d b/ld/testsuite/ld-ia64/merge2.d index dde3d09..4f05e37 100644 --- a/ld/testsuite/ld-ia64/merge2.d +++ b/ld/testsuite/ld-ia64/merge2.d @@ -1,6 +1,6 @@ #source: merge2.s #as: -x -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #... diff --git a/ld/testsuite/ld-ia64/merge3.d b/ld/testsuite/ld-ia64/merge3.d index d0163f3..985142dc 100644 --- a/ld/testsuite/ld-ia64/merge3.d +++ b/ld/testsuite/ld-ia64/merge3.d @@ -1,6 +1,6 @@ #source: merge3.s #as: -x -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #... diff --git a/ld/testsuite/ld-ia64/merge4.d b/ld/testsuite/ld-ia64/merge4.d index 0ed5621..ba34c8c 100644 --- a/ld/testsuite/ld-ia64/merge4.d +++ b/ld/testsuite/ld-ia64/merge4.d @@ -1,6 +1,6 @@ #source: merge4.s #as: -x -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #... diff --git a/ld/testsuite/ld-ia64/merge5.d b/ld/testsuite/ld-ia64/merge5.d index 3adfa55..d59fabc 100644 --- a/ld/testsuite/ld-ia64/merge5.d +++ b/ld/testsuite/ld-ia64/merge5.d @@ -1,6 +1,6 @@ #source: merge5.s #as: -x -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -d #... diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d index c14cd28..a6a2c20 100644 --- a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d @@ -1,4 +1,4 @@ -#ld: -shared -Map tmpdir/ifunc-1-local-x86.map +#ld: -shared -Map tmpdir/ifunc-1-local-x86.map --hash-style=sysv #objdump: -dw #target: x86_64-*-* i?86-*-* #map: ifunc-1-local-x86.map diff --git a/ld/testsuite/ld-ifunc/ifunc-1-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-x86.d index c245758..1471dfe 100644 --- a/ld/testsuite/ld-ifunc/ifunc-1-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-1-x86.d @@ -1,4 +1,4 @@ -#ld: -shared -Map tmpdir/ifunc-1-x86.map +#ld: -shared -Map tmpdir/ifunc-1-x86.map --hash-style=sysv #objdump: -dw #target: x86_64-*-* i?86-*-* #map: ifunc-1-x86.map diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d index ebe7ded..b4dfcec 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d @@ -1,5 +1,5 @@ #source: ifunc-2-i386.s -#ld: -z now -m elf_i386 -shared +#ld: -z now -m elf_i386 -shared --hash-style=sysv #as: --32 #objdump: -dw #target: x86_64-*-* i?86-*-* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d index 7cb2e54..8888e7c 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d @@ -1,5 +1,5 @@ #source: ifunc-2-local-i386.s -#ld: -z now -m elf_i386 -shared +#ld: -z now -m elf_i386 -shared --hash-style=sysv #as: --32 #objdump: -dw #target: x86_64-*-* i?86-*-* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d index 6ec199f..d93709c 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d @@ -1,6 +1,6 @@ #source: ifunc-2-local-x86-64.s #as: --64 -#ld: -z now -shared -melf_x86_64 +#ld: -z now -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d index 317d7d7..b776b33 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d @@ -1,5 +1,5 @@ #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d index 95920cc..2328679 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d @@ -1,6 +1,6 @@ #source: ifunc-2-x86-64.s #as: --64 -#ld: -z now -shared -melf_x86_64 +#ld: -z now -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d index 317d7d7..b776b33 100644 --- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d +++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d @@ -1,5 +1,5 @@ #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* diff --git a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d index 4a88e4b..3c2a959 100644 --- a/ld/testsuite/ld-ifunc/ifunc-3a-x86.d +++ b/ld/testsuite/ld-ifunc/ifunc-3a-x86.d @@ -1,5 +1,5 @@ #source: ifunc-3-x86.s -#ld: -shared +#ld: -shared --hash-style=sysv #objdump: -dw #target: x86_64-*-* i?86-*-* diff --git a/ld/testsuite/ld-ifunc/pr17154-i386-now.d b/ld/testsuite/ld-ifunc/pr17154-i386-now.d index cb70b27..b7afdd0 100644 --- a/ld/testsuite/ld-ifunc/pr17154-i386-now.d +++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d @@ -1,5 +1,5 @@ #source: pr17154-x86.s -#ld: -z now -m elf_i386 -shared +#ld: -z now -m elf_i386 -shared --hash-style=sysv #as: --32 #objdump: -dw #target: x86_64-*-* i?86-*-* diff --git a/ld/testsuite/ld-ifunc/pr17154-i386.d b/ld/testsuite/ld-ifunc/pr17154-i386.d index 16fcd4e..6b309b9 100644 --- a/ld/testsuite/ld-ifunc/pr17154-i386.d +++ b/ld/testsuite/ld-ifunc/pr17154-i386.d @@ -1,5 +1,5 @@ #source: pr17154-x86.s -#ld: -m elf_i386 -shared +#ld: -m elf_i386 -shared --hash-style=sysv #as: --32 #objdump: -dw #target: x86_64-*-* i?86-*-* diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d index f099575..60edb9e 100644 --- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d +++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d @@ -1,6 +1,6 @@ #source: pr17154-x86.s #as: --64 -#ld: -z now -shared -melf_x86_64 +#ld: -z now -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d index 1cdcf50..b3d7ed0 100644 --- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d +++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d @@ -1,6 +1,6 @@ #source: pr17154-x86.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-* diff --git a/ld/testsuite/ld-m68k/got-1.d b/ld/testsuite/ld-m68k/got-1.d index e8070e9..1eddac4 100644 --- a/ld/testsuite/ld-m68k/got-1.d +++ b/ld/testsuite/ld-m68k/got-1.d @@ -1,5 +1,5 @@ #source: got-1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-multigot-12-13-14-34-35-ok.d b/ld/testsuite/ld-m68k/got-multigot-12-13-14-34-35-ok.d index 176961b..13aeb05 100644 --- a/ld/testsuite/ld-m68k/got-multigot-12-13-14-34-35-ok.d +++ b/ld/testsuite/ld-m68k/got-multigot-12-13-14-34-35-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=multigot +#ld: -shared --got=multigot --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-multigot-14-ok.d b/ld/testsuite/ld-m68k/got-multigot-14-ok.d index 7ebc589..86fe8f7 100644 --- a/ld/testsuite/ld-m68k/got-multigot-14-ok.d +++ b/ld/testsuite/ld-m68k/got-multigot-14-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=multigot +#ld: -shared --got=multigot --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-multigot-15-er.d b/ld/testsuite/ld-m68k/got-multigot-15-er.d index 58381ae..892d0fe 100644 --- a/ld/testsuite/ld-m68k/got-multigot-15-er.d +++ b/ld/testsuite/ld-m68k/got-multigot-15-er.d @@ -1,3 +1,3 @@ #as: -mcpu=5206 -#ld: -shared --got=multigot +#ld: -shared --got=multigot --hash-style=sysv #error: .*GOT overflow.* diff --git a/ld/testsuite/ld-m68k/got-negative-12-13-14-34-ok.d b/ld/testsuite/ld-m68k/got-negative-12-13-14-34-ok.d index 451df80..8c2ea98 100644 --- a/ld/testsuite/ld-m68k/got-negative-12-13-14-34-ok.d +++ b/ld/testsuite/ld-m68k/got-negative-12-13-14-34-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=negative +#ld: -shared --got=negative --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-negative-12-13-14-35-er.d b/ld/testsuite/ld-m68k/got-negative-12-13-14-35-er.d index 4487a8c..5930ae3 100644 --- a/ld/testsuite/ld-m68k/got-negative-12-13-14-35-er.d +++ b/ld/testsuite/ld-m68k/got-negative-12-13-14-35-er.d @@ -1,3 +1,3 @@ #as: -mcpu=5206 -#ld: -shared --got=negative +#ld: -shared --got=negative --hash-style=sysv #error: .*relocation truncated to fit.* diff --git a/ld/testsuite/ld-m68k/got-negative-14-ok.d b/ld/testsuite/ld-m68k/got-negative-14-ok.d index 451df80..8c2ea98 100644 --- a/ld/testsuite/ld-m68k/got-negative-14-ok.d +++ b/ld/testsuite/ld-m68k/got-negative-14-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=negative +#ld: -shared --got=negative --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-negative-15-er.d b/ld/testsuite/ld-m68k/got-negative-15-er.d index c1b7409..64bdd1e 100644 --- a/ld/testsuite/ld-m68k/got-negative-15-er.d +++ b/ld/testsuite/ld-m68k/got-negative-15-er.d @@ -1,3 +1,3 @@ #as: -mcpu=5206 -#ld: -shared --got=negative +#ld: -shared --got=negative --hash-style=sysv #error: .*GOT overflow.* diff --git a/ld/testsuite/ld-m68k/got-single-12-ok.d b/ld/testsuite/ld-m68k/got-single-12-ok.d index a7fdeb9..924a7d7 100644 --- a/ld/testsuite/ld-m68k/got-single-12-ok.d +++ b/ld/testsuite/ld-m68k/got-single-12-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=single +#ld: -shared --got=single --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-single-13-er.d b/ld/testsuite/ld-m68k/got-single-13-er.d index bfca9f8..89e908c 100644 --- a/ld/testsuite/ld-m68k/got-single-13-er.d +++ b/ld/testsuite/ld-m68k/got-single-13-er.d @@ -1,3 +1,3 @@ #as: -mcpu=5206 -#ld: -shared --got=single +#ld: -shared --got=single --hash-style=sysv #error: .*relocation truncated to fit.* diff --git a/ld/testsuite/ld-m68k/got-xgot-12-13-14-15-34-35-ok.d b/ld/testsuite/ld-m68k/got-xgot-12-13-14-15-34-35-ok.d index dd2c21d..145be53 100644 --- a/ld/testsuite/ld-m68k/got-xgot-12-13-14-15-34-35-ok.d +++ b/ld/testsuite/ld-m68k/got-xgot-12-13-14-15-34-35-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=multigot +#ld: -shared --got=multigot --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/got-xgot-15-ok.d b/ld/testsuite/ld-m68k/got-xgot-15-ok.d index bc11849..1de632a 100644 --- a/ld/testsuite/ld-m68k/got-xgot-15-ok.d +++ b/ld/testsuite/ld-m68k/got-xgot-15-ok.d @@ -1,5 +1,5 @@ #as: -mcpu=5206 -#ld: -shared --got=multigot +#ld: -shared --got=multigot --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/m68k.exp b/ld/testsuite/ld-m68k/m68k.exp index c3a93bd..ed1321b 100644 --- a/ld/testsuite/ld-m68k/m68k.exp +++ b/ld/testsuite/ld-m68k/m68k.exp @@ -61,7 +61,8 @@ run_dump_test "merge-ok-1c" foreach { id sources } { a { plt1.s } b { plt1-empty.s plt1.s } } { foreach arch { 68020 cpu32 isab isac } { run_ld_link_tests [list \ - [list "PLT 1$id ($arch)" "-shared -T plt1.ld" "" "-m$arch" \ + [list "PLT 1$id ($arch)" \ + "-shared -T plt1.ld --hash-style=sysv" "" "-m$arch" \ $sources [list [list objdump -dr plt1-$arch.d]] \ plt1-${id}-${arch}.so]] } @@ -81,11 +82,11 @@ if { [istarget m68k-*-linux*] } then { {{nm -ngD tls-def-1.d}} "tls-def-1.so"} {"TLS direct symbol use" - "-shared tmpdir/tls-def-1.so" "" "" {tls-gd-1.s} + "-shared --hash-style=sysv tmpdir/tls-def-1.so" "" "" {tls-gd-1.s} {{nm -ngD tls-gd-1.d2} {readelf -d tls-gd-1.d3}} "tls-gd-1.so"} {"TLS indirect symbol use" - "--copy-dt-needed-entries tmpdir/tls-gd-1.so -rpath-link ./" "" "" {tls-main-1.s} + "--copy-dt-needed-entries --hash-style=sysv tmpdir/tls-gd-1.so -rpath-link ./" "" "" {tls-main-1.s} {{readelf -d tls-main-1.d}} "tls-main-1"}} diff --git a/ld/testsuite/ld-m68k/tls-gd-1.d b/ld/testsuite/ld-m68k/tls-gd-1.d index 0cad6fc..c8245f2 100644 --- a/ld/testsuite/ld-m68k/tls-gd-1.d +++ b/ld/testsuite/ld-m68k/tls-gd-1.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-gd-1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 9 entries: diff --git a/ld/testsuite/ld-m68k/tls-gd-2.d b/ld/testsuite/ld-m68k/tls-gd-2.d index 28ba4f5..e382512 100644 --- a/ld/testsuite/ld-m68k/tls-gd-2.d +++ b/ld/testsuite/ld-m68k/tls-gd-2.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-gd-2.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 10 entries: diff --git a/ld/testsuite/ld-m68k/tls-gd-ie-1.d b/ld/testsuite/ld-m68k/tls-gd-ie-1.d index 4626722..9001cce 100644 --- a/ld/testsuite/ld-m68k/tls-gd-ie-1.d +++ b/ld/testsuite/ld-m68k/tls-gd-ie-1.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-gd-ie-1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 10 entries: diff --git a/ld/testsuite/ld-m68k/tls-ie-1.d b/ld/testsuite/ld-m68k/tls-ie-1.d index 5574ad4..0f21101 100644 --- a/ld/testsuite/ld-m68k/tls-ie-1.d +++ b/ld/testsuite/ld-m68k/tls-ie-1.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-ie-1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 10 entries: diff --git a/ld/testsuite/ld-m68k/tls-ld-1.d b/ld/testsuite/ld-m68k/tls-ld-1.d index 9f374f3..b3ea123 100644 --- a/ld/testsuite/ld-m68k/tls-ld-1.d +++ b/ld/testsuite/ld-m68k/tls-ld-1.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-ld-1.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 10 entries: diff --git a/ld/testsuite/ld-m68k/tls-ld-2.d b/ld/testsuite/ld-m68k/tls-ld-2.d index ee1bac5..810160c 100644 --- a/ld/testsuite/ld-m68k/tls-ld-2.d +++ b/ld/testsuite/ld-m68k/tls-ld-2.d @@ -1,6 +1,6 @@ #as: -mcpu=5206 #source: tls-ld-2.s -#ld: -shared +#ld: -shared --hash-style=sysv #readelf: -d -r Dynamic section at offset .* contains 6 entries: diff --git a/ld/testsuite/ld-metag/metag.exp b/ld/testsuite/ld-metag/metag.exp index 6147754..3504eb8 100644 --- a/ld/testsuite/ld-metag/metag.exp +++ b/ld/testsuite/ld-metag/metag.exp @@ -31,7 +31,7 @@ set metag_tests { { {objdump -Dz pcrel.d} } "pcrel" } - {"Simple PIC shared library" "-shared" "" "" + {"Simple PIC shared library" "-shared --hash-style=sysv" "" "" {shared.s} { {objdump -fdw shared.d} {objdump -Rw shared.r} } "shared.so" @@ -41,17 +41,17 @@ set metag_tests { { {objdump -fdw stub.d} } "stub" } - {"Shared library for stub tests" "-shared" "" "" + {"Shared library for stub tests" "-shared --hash-style=sysv" "" "" {stub_shared.s} { {objdump -fdw stub_shared.d} {objdump -Rw stub_shared.r} } "stub_shared.so" } - {"Long branch stub (PIC, app)" "tmpdir/stub_shared.so" "" "" + {"Long branch stub (PIC, app)" "--hash-style=sysv tmpdir/stub_shared.so" "" "" {stub_pic_app.s} { {objdump -fdw stub_pic_app.d} {objdump -Rw stub_pic_app.r} } "stub_pic_app" } - {"Long branch stub (PIC, shared)" "-shared" "" "" + {"Long branch stub (PIC, shared)" "-shared --hash-style=sysv" "" "" {stub_pic_shared.s} { {objdump -fdw stub_pic_shared.d} } "stub_pic_shared.so" diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d new file mode 100644 index 0000000..9c7aca5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX addend calculation (n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-addend-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d new file mode 100644 index 0000000..e254c65 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX addend calculation (n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-addend-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d new file mode 100644 index 0000000..e066f5d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d @@ -0,0 +1,22 @@ +#name: microMIPS BAL/JALX addend calculation +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 4400 jalx 0*1c011000 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff8 bal 0*1c011010 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d new file mode 100644 index 0000000..16fcb0a --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL to JALX conversion for local symbol (n32) +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-local-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d new file mode 100644 index 0000000..d13a9ea --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL to JALX conversion for local symbol (n64) +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-local-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d new file mode 100644 index 0000000..e944d3b --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d @@ -0,0 +1,20 @@ +#name: microMIPS BAL to JALX conversion for local symbol +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 0400 jalx 0*1c001000 <foo> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d new file mode 100644 index 0000000..9a293c5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-pic-ignore-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d new file mode 100644 index 0000000..2b78bb9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-pic-ignore-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d new file mode 100644 index 0000000..0b48b3a --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d @@ -0,0 +1,22 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff4 bal 0*1c011000 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff8 bal 0*1c011010 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d new file mode 100644 index 0000000..3b25dc7 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d new file mode 100644 index 0000000..d39f114 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d new file mode 100644 index 0000000..7404d25 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/binary.d b/ld/testsuite/ld-mips-elf/binary.d new file mode 100644 index 0000000..eb88c1c --- /dev/null +++ b/ld/testsuite/ld-mips-elf/binary.d @@ -0,0 +1,8 @@ +#objdump: -b binary -s +#name: MIPS link ELF into binary output format +#ld: -r --oformat=binary -T binary.ld + +.*: +file format binary + +Contents of section \.data: + 0000 61626364 65666768 696a6b6c 6d6e6f70 abcdefghijklmnop diff --git a/ld/testsuite/ld-mips-elf/binary.ld b/ld/testsuite/ld-mips-elf/binary.ld new file mode 100644 index 0000000..037ae69 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/binary.ld @@ -0,0 +1,5 @@ +SECTIONS +{ + .data : { *(.data) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-mips-elf/binary.s b/ld/testsuite/ld-mips-elf/binary.s new file mode 100644 index 0000000..fbc0244 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/binary.s @@ -0,0 +1,2 @@ + .data + .ascii "abcdefghijklmnop" diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 4360b83..96f57bf 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -251,22 +251,43 @@ if { $linux_gnu } { run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]] run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-addend" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-addend-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-local" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-local-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-pic" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-pic-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-pic-ignore" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-pic-ignore-micromips" \ + [list [list ld $abi_ldflags(o32)]] if $has_newabi { run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-addend-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-local-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-local-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-pic-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-pic-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-pic-ignore-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-pic-ignore-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-addend-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-local-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-local-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-pic-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-pic-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-pic-ignore-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-pic-ignore-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] } run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]] @@ -1213,3 +1234,6 @@ run_ld_link_tests [list \ "relax-offset-umips"]] rename prune_warnings "" rename mips_old_prune_warnings prune_warnings + +# Verify that we can link ELF input into the `binary' output format. +run_dump_test "binary" diff --git a/ld/testsuite/ld-mmix/pr20125.d b/ld/testsuite/ld-mmix/pr20125.d new file mode 100644 index 0000000..7c09c04 --- /dev/null +++ b/ld/testsuite/ld-mmix/pr20125.d @@ -0,0 +1,21 @@ +#as: -no-predefined-syms -x -I$srcdir/$subdir +#ld: -m mmo --defsym __.MMIX.start..text=0x80000 +#objdump: -dr + +# PUSHJ reloc handling was wrong for weak undefined symbols, causing +# internal inconsistencies, leading to a call to abort. +# Note that we don't keep track of which symbols have pushj-stubs, so +# we get one stub each for the two calls to "foo". + +.*: file format mmo + +Disassembly of section \.text: + +0+80000 <(_start|Main)>: + 80000: fe000004 get \$0,rJ + 80004: f2010004 pushj \$1,80014 <Main\+0x14> + 80008: f2010004 pushj \$1,80018 <Main\+0x18> + 8000c: f6040000 put rJ,\$0 + 80010: f8010000 pop 1,0 + 80014: f1fdfffb jmp 0 <Main-0x80000> + 80018: f1fdfffa jmp 0 <Main-0x80000> diff --git a/ld/testsuite/ld-mmix/pr20125.s b/ld/testsuite/ld-mmix/pr20125.s new file mode 100644 index 0000000..e528d9d --- /dev/null +++ b/ld/testsuite/ld-mmix/pr20125.s @@ -0,0 +1,2 @@ + .weak bar + .include "pr12815-2.s" diff --git a/ld/testsuite/ld-msp430-elf/main-bss-lower.d b/ld/testsuite/ld-msp430-elf/main-bss-lower.d new file mode 100644 index 0000000..6007420 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-bss-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.bss: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-bss-upper.d b/ld/testsuite/ld-msp430-elf/main-bss-upper.d new file mode 100644 index 0000000..2f6376a7 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-bss-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.bss: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-const-lower.d b/ld/testsuite/ld-msp430-elf/main-const-lower.d new file mode 100644 index 0000000..8549961 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-const-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.rodata: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-const-upper.d b/ld/testsuite/ld-msp430-elf/main-const-upper.d new file mode 100644 index 0000000..c84d649 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-const-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.rodata: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-text-lower.d b/ld/testsuite/ld-msp430-elf/main-text-lower.d new file mode 100644 index 0000000..446a305 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-text-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.text: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-text-upper.d b/ld/testsuite/ld-msp430-elf/main-text-upper.d new file mode 100644 index 0000000..f7ae6af --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-text-upper.d @@ -0,0 +1,6 @@ + +.*: file format.*msp430.* + + +Disassembly of section .upper.text: +#... diff --git a/ld/testsuite/ld-msp430-elf/main-var-lower.d b/ld/testsuite/ld-msp430-elf/main-var-lower.d new file mode 100644 index 0000000..f520cf5 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-var-lower.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .lower.data: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-var-upper.d b/ld/testsuite/ld-msp430-elf/main-var-upper.d new file mode 100644 index 0000000..fc3d712 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-var-upper.d @@ -0,0 +1,3 @@ +#... +Disassembly of section .upper.data: +#pass diff --git a/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s b/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s new file mode 100644 index 0000000..7774804 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s @@ -0,0 +1,78 @@ + .file "main-with-data-bss.c" + .global glob_var_array + .section .data.glob_var_array,"aw",@progbits + .balign 2 + .type glob_var_array, @object + .size glob_var_array, 20 +glob_var_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .section .bss.glob_bss_array,"aw",@nobits + .balign 2 + .type glob_bss_array, @object + .size glob_bss_array, 20 +glob_bss_array: + .zero 20 + .section .text.main,"ax",@progbits + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L7: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_var_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_bss_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L5 +.L6: + BR #.L6 +.L5: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L7 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-data-bss.s b/ld/testsuite/ld-msp430-elf/main-with-data-bss.s new file mode 100644 index 0000000..a406b64 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-data-bss.s @@ -0,0 +1,74 @@ + .file "main-with-data-bss.c" + .global glob_var_array +.data + .balign 2 + .type glob_var_array, @object + .size glob_var_array, 20 +glob_var_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .local glob_bss_array + .comm glob_bss_array,20,2 +.text + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L7: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_var_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_bss_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L5 +.L6: + BR #.L6 +.L5: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L7 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s b/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s new file mode 100644 index 0000000..398cf74 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s @@ -0,0 +1,59 @@ + .file "main-with-text-rodata.c" + .global glob_const_array + .section .rodata.glob_const_array,"a",@progbits + .balign 2 + .type glob_const_array, @object + .size glob_const_array, 20 +glob_const_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 + .section .text.main,"ax",@progbits + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L5: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_const_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L5 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s b/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s new file mode 100644 index 0000000..225b5d4 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/main-with-text-rodata.s @@ -0,0 +1,59 @@ + .file "main-with-text-rodata.c" + .global glob_const_array + .section .rodata + .balign 2 + .type glob_const_array, @object + .size glob_const_array, 20 +glob_const_array: + .short 0 + .short 1 + .short 2 + .short 3 + .short 4 + .short 5 + .short 6 + .short 7 + .short 8 + .short 9 +.text + .balign 2 + .global main + .type main, @function +main: +; start of function +; framesize_regs: 0 +; framesize_locals: 2 +; framesize_outgoing: 0 +; framesize: 2 +; elim ap -> fp 2 +; elim fp -> sp 2 +; saved regs:(none) + ; start of prologue + SUB.W #2, R1 + ; end of prologue + MOV.W #0, @R1 + BR #.L2 +.L5: + MOV.W @R1, R12 + ADD.W R12, R12 + ADD.W #glob_const_array, R12 + MOV.W @R12, R13 + MOV.W R13, R12 + ADD.W R12, R12 + ADD.W R13, R12 + rpt #2 { rlax.w R12 + SUB.W R13, R12 + CMP.W #110, R12 { JNE .L3 +.L4: + BR #.L4 +.L3: + ADD.W #1, @R1 +.L2: + MOV.B #9, R12 + CMP.W @R1, R12 { JGE .L5 + MOV.B #0, R12 + ; start of epilogue + .refsym __crt0_call_exit + ADD.W #2, R1 + RET + .size main, .-main diff --git a/ld/testsuite/ld-msp430-elf/msp430-elf.exp b/ld/testsuite/ld-msp430-elf/msp430-elf.exp new file mode 100644 index 0000000..fa396aa --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-elf.exp @@ -0,0 +1,141 @@ +# Expect script for various MSP430 ELF tests. +# Copyright (C) 2002-2015 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if { ![istarget "msp430*elf*"] } { + return +} + +# List contains test-items with 3 items followed by 2 lists and one more item: +# 0:name 1:ld early options 2:ld late options 3:assembler options +# 4:filenames of assembler files 5: action and options. 6: name of output file + +# Actions: +# objdump: Apply objdump options on result. Compare with regex (last arg). +# nm: Apply nm options on result. Compare with regex (last arg). +# readelf: Apply readelf options on result. Compare with regex (last arg). + +set msp430regionprefixtests { + {"Move main() to .upper.text" "-T msp430.ld --code-region=upper" + "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"} + {"Move main() to .upper.text. No .lower.text in ld script" "-T msp430-no-lower.ld --code-region=upper" + "" "" {main-with-text-rodata.s} {{objdump -d main-text-upper.d}} "main-upper"} + {"Move main() to .lower.text" "-T msp430.ld --code-region=lower" + "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-lower"} + {"Move \"either\" main() to .lower.text" "-T msp430.ld --code-region=either" + "" "" {main-with-text-rodata.s} {{objdump -d main-text-lower.d}} "main-either"} + + {"Move glob_var to .upper.data" "-T msp430.ld --data-region=upper" + "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"} + {"Move glob_var to .upper.data. No .lower.data in ld script" "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-data-bss.s} {{objdump -D main-var-upper.d}} "main-var-upper"} + {"Move glob_var to .lower.data" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"} + {"Move \"either\" glob_var to .lower.data" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss.s} {{objdump -D main-var-lower.d}} "main-var-lower"} + + {"Move glob_zero to .upper.bss" "-T msp430.ld --data-region=upper" + "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"} + {"Move glob_zero to .upper.bss. No .lower.bss in ld script." "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-data-bss.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"} + {"Move glob_zero to .lower.bss" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"} + {"Move \"either\" glob_zero to .lower.bss" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"} + + {"Move glob_const to .upper.rodata" "-T msp430.ld --data-region=upper" + "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"} + {"Move glob_const to .upper.rodata. No .lower.rodata in ld script." "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-text-rodata.s} {{objdump -D main-const-upper.d}} "main-const-upper"} + {"Move glob_const to .lower.rodata" "-T msp430.ld --data-region=lower" + "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"} + {"Move \"either\" glob_const to .lower.rodata" "-T msp430.ld --data-region=lower" + "" "" {main-with-text-rodata.s} {{objdump -D main-const-lower.d}} "main-const-lower"} +} + +set msp430regionprefixuniquesectiontests { + {"Move main() to .upper.text, with -ffunction/data-sections" "-T msp430.ld --code-region=upper" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"} + {"Move main() to .upper.text. No .lower.text in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --code-region=upper" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-upper.d}} "main-upper"} + {"Move main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=lower" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-lower"} + {"Move \"either\" main() to .lower.text, with -ffunction/data-sections" "-T msp430.ld --code-region=either" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -d main-text-lower.d}} "main-either"} + + {"Move glob_var to .upper.data, with -ffunction/data-sections" "-T msp430.ld --data-region=upper" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"} + {"Move glob_var to .upper.data. No .lower.data in ld script, with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-upper.d}} "main-var-upper"} + {"Move glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"} + {"Move \"either\" glob_var to .lower.data, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-var-lower.d}} "main-var-lower"} + + {"Move glob_zero to .upper.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=upper" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"} + {"Move glob_zero to .upper.bss. No .lower.bss in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-upper.d}} "main-bss-upper"} + {"Move glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"} + {"Move \"either\" glob_zero to .lower.bss, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-data-bss-unique-sec.s} {{objdump -D main-bss-lower.d}} "main-bss-lower"} + + {"Move glob_const to .upper.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=upper" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"} + {"Move glob_const to .upper.rodata. No .lower.rodata in ld script., with -ffunction/data-sections" "-T msp430-no-lower.ld --data-region=upper" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-upper.d}} "main-const-upper"} + {"Move glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"} + {"Move \"either\" glob_const to .lower.rodata, with -ffunction/data-sections" "-T msp430.ld --data-region=lower" + "" "" {main-with-text-rodata-unique-sec.s} {{objdump -D main-const-lower.d}} "main-const-lower"} +} + +set msp430eithershuffletests { + {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text" + "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s} + {{objdump -d main-text-upper.d}} "either-to-upper-text"} + {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data" + "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s} + {{objdump -D main-var-upper.d}} "either-to-upper-data"} + {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss" + "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss.s} + {{objdump -D main-bss-upper.d}} "either-to-upper-bss"} + {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata" + "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata.s} + {{objdump -D main-const-upper.d}} "either-to-upper-const"} + + {"Move \"either\" main() to .upper.text when it doesn\'t fit in .lower.text, with -ffunction/data-sections" + "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s} + {{objdump -d main-text-upper.d}} "either-to-upper-text-unique-sec"} + {"Move \"either\" glob_var_array to .upper.data when it doesn\'t fit in .lower.data, with -ffunction/data-sections" + "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s} + {{objdump -D main-var-upper.d}} "either-to-upper-data-unique-sec"} + {"Move \"either\" glob_bss_array to .upper.bss when it doesn\'t fit in .lower.bss, with -ffunction/data-sections" + "-T msp430-tiny-ram.ld --data-region=either" "" "" {main-with-data-bss-unique-sec.s} + {{objdump -D main-bss-upper.d}} "either-to-upper-bss-unique-sec"} + {"Move \"either\" glob_const_array to .upper.rodata when it doesn\'t fit in .lower.rodata, with -ffunction/data-sections" + "-T msp430-tiny-rom.ld --code-region=either --data-region=either" "" "" {main-with-text-rodata-unique-sec.s} + {{objdump -D main-const-upper.d}} "either-to-upper-const-unique-sec"} +} + +run_ld_link_tests $msp430regionprefixtests +run_ld_link_tests $msp430regionprefixuniquesectiontests +run_ld_link_tests $msp430eithershuffletests diff --git a/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld b/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld new file mode 100644 index 0000000..f9a2847 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-no-lower.ld @@ -0,0 +1,54 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } + + .rodata : + { + *(.rodata.* .rodata) + } + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } + + .upper.rodata : + { + . = ALIGN(2); + *(.upper.rodata .upper.rodata.*) + } + + .upper.data : + { + . = ALIGN(2); + *(.upper.data .upper.data.*) + } + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss .upper.bss.*) + } +} diff --git a/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld b/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld new file mode 100644 index 0000000..e2e6f2f --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-tiny-ram.ld @@ -0,0 +1,49 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +MEMORY +{ + RAM : ORIGIN = 0x0, LENGTH = 0x2 + ROM : ORIGIN = 0x2, LENGTH = 0x1fe + HIFRAM : ORIGIN = 0x200, LENGTH = 0x1000 +} + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } > ROM + + .rodata : + { + *(.upper.rodata.* .rodata) + } > ROM + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } > RAM AT> ROM + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } > RAM + + .upper.data : + { + . = ALIGN(2); + *(.upper.data.* .upper.data) + } > HIFRAM AT> ROM + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss.* .upper.bss) + } > HIFRAM +} diff --git a/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld b/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld new file mode 100644 index 0000000..3e26379 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430-tiny-rom.ld @@ -0,0 +1,48 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +MEMORY +{ + ROM : ORIGIN = 0x0, LENGTH = 0x2 + RAM : ORIGIN = 0x2, LENGTH = 0x1fe + HIROM : ORIGIN = 0x200, LENGTH = 0x1000 +} + +SECTIONS +{ + .text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } > ROM + + .rodata : + { + *(.rodata.* .rodata) + } > ROM + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } > RAM AT> ROM + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } > RAM + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } > HIROM + + .upper.rodata : + { + *(.upper.rodata.* .upper.rodata) + } > HIROM +} diff --git a/ld/testsuite/ld-msp430-elf/msp430.ld b/ld/testsuite/ld-msp430-elf/msp430.ld new file mode 100644 index 0000000..9c30836 --- /dev/null +++ b/ld/testsuite/ld-msp430-elf/msp430.ld @@ -0,0 +1,78 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(msp430) +ENTRY(_start) + +SECTIONS +{ + .lower.data : + { + . = ALIGN(2); + *(.lower.data .lower.data.*) + } + + .lower.bss : + { + . = ALIGN(2); + *(.lower.bss .lower.bss.*) + } + + .lower.text : + { + PROVIDE (_start = .); + . = ALIGN(2); + *(.lower.text.* .lower.text) + } + + .lower.rodata : + { + . = ALIGN(2); + *(.lower.rodata .lower.rodata.*) + } + + .text : + { + . = ALIGN(2); + *(.text .stub .text.* .gnu.linkonce.t.* .text:*) + } + + .rodata : + { + *(.rodata.* .rodata) + } + + .data : + { + . = ALIGN(2); + *(.data.* .data) + } + + .bss : + { + . = ALIGN(2); + *(.bss.* .bss) + } + + .upper.text : + { + . = ALIGN(2); + *(.upper.text.* .upper.text) + } + + .upper.rodata : + { + . = ALIGN(2); + *(.upper.rodata .upper.rodata.*) + } + + .upper.data : + { + . = ALIGN(2); + *(.upper.data .upper.data.*) + } + + .upper.bss : + { + . = ALIGN(2); + *(.upper.bss .upper.bss.*) + } +} diff --git a/ld/testsuite/ld-powerpc/ambiguousv1.d b/ld/testsuite/ld-powerpc/ambiguousv1.d index a74325a..dcff2d8 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv1.d +++ b/ld/testsuite/ld-powerpc/ambiguousv1.d @@ -18,7 +18,7 @@ Symbol table '\.dynsym' contains 5 entries: 0: .* 1: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func #... -Symbol table '\.symtab' contains 19 entries: +Symbol table '\.symtab' contains .* entries: #... - 14: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func +.*: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func #pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv1b.d b/ld/testsuite/ld-powerpc/ambiguousv1b.d index 7b9753a..678b8ad 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv1b.d +++ b/ld/testsuite/ld-powerpc/ambiguousv1b.d @@ -14,11 +14,10 @@ Relocation section .* contains 1 entries: .* R_PPC64_COPY .* my_func \+ 0 Symbol table '\.dynsym' contains 5 entries: -.* - 0: .* - 1: 0+10010408 4 FUNC GLOBAL DEFAULT 12 my_func #... -Symbol table '\.symtab' contains 20 entries: +.*: 0*[1-9a-f][0-9a-f]* 4 FUNC GLOBAL DEFAULT 1[23] my_func +#... +Symbol table '\.symtab' contains .* entries: #... - 15: 0+10010408 4 FUNC GLOBAL DEFAULT 12 my_func +.*: 0*[1-9a-f][0-9a-f]* 4 FUNC GLOBAL DEFAULT 1[23] my_func #pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv2.d b/ld/testsuite/ld-powerpc/ambiguousv2.d index 99c8a39..fec3a2c 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv2.d +++ b/ld/testsuite/ld-powerpc/ambiguousv2.d @@ -24,7 +24,7 @@ Symbol table '\.dynsym' contains 5 entries: 1: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func #... -Symbol table '\.symtab' contains 21 entries: +Symbol table '\.symtab' contains .* entries: #... - 16: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func +.*: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func #pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv2b.d b/ld/testsuite/ld-powerpc/ambiguousv2b.d index 859a3ea..c93cd11 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv2b.d +++ b/ld/testsuite/ld-powerpc/ambiguousv2b.d @@ -15,11 +15,10 @@ Relocation section .* contains 1 entries: .* R_PPC64_JMP_SLOT .* my_func \+ 0 Symbol table '\.dynsym' contains 5 entries: -.* - 0: .* - 1: 0+100002b8 0 FUNC GLOBAL DEFAULT UND my_func #... -Symbol table '\.symtab' contains 21 entries: +.*: 0*[1-9a-f][0-9a-f]* 0 FUNC GLOBAL DEFAULT UND my_func +#... +Symbol table '\.symtab' contains .* entries: #... - 16: 0+100002b8 0 FUNC GLOBAL DEFAULT UND my_func +.*: 0*[1-9a-f][0-9a-f]* 0 FUNC GLOBAL DEFAULT UND my_func #pass diff --git a/ld/testsuite/ld-powerpc/elfv2so.d b/ld/testsuite/ld-powerpc/elfv2so.d index f3962ac..a577b2a 100644 --- a/ld/testsuite/ld-powerpc/elfv2so.d +++ b/ld/testsuite/ld-powerpc/elfv2so.d @@ -7,53 +7,57 @@ Disassembly of section \.text: -0+300 <.*\.plt_call\.f4>: +.* <.*\.plt_call\.f4>: .*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) .*: (e9 82 80 38|38 80 82 e9) ld r12,-32712\(r2\) .*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 .*: (4e 80 04 20|20 04 80 4e) bctr + \.\.\. -0+310 <.*\.plt_call\.f3>: +.* <.*\.plt_call\.f3>: .*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) .*: (e9 82 80 28|28 80 82 e9) ld r12,-32728\(r2\) .*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 .*: (4e 80 04 20|20 04 80 4e) bctr + \.\.\. -0+320 <.*\.plt_call\.f2>: +.* <.*\.plt_call\.f2>: .*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) .*: (e9 82 80 30|30 80 82 e9) ld r12,-32720\(r2\) .*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 .*: (4e 80 04 20|20 04 80 4e) bctr + \.\.\. -0+330 <.*\.plt_call\.f1>: +.* <.*\.plt_call\.f1>: .*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) .*: (e9 82 80 40|40 80 82 e9) ld r12,-32704\(r2\) .*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 .*: (4e 80 04 20|20 04 80 4e) bctr + \.\.\. -0+340 <f1>: +.* <f1>: .*: (3c 4c 00 02|02 00 4c 3c) addis r2,r12,2 -.*: (38 42 82 c0|c0 82 42 38) addi r2,r2,-32064 +.*: (38 42 .. ..|.. .. 42 38) addi r2,r2,.* .*: (7c 08 02 a6|a6 02 08 7c) mflr r0 .*: (f8 21 ff e1|e1 ff 21 f8) stdu r1,-32\(r1\) .*: (f8 01 00 30|30 00 01 f8) std r0,48\(r1\) -.*: (4b ff ff dd|dd ff ff 4b) bl .*\.plt_call\.f1> +.*: (4b ff ff cd|cd ff ff 4b) bl .*\.plt_call\.f1> .*: (e8 62 80 08|08 80 62 e8) ld r3,-32760\(r2\) -.*: (4b ff ff c5|c5 ff ff 4b) bl .*\.plt_call\.f2> +.*: (4b ff ff a5|a5 ff ff 4b) bl .*\.plt_call\.f2> .*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) .*: (e8 62 80 10|10 80 62 e8) ld r3,-32752\(r2\) -.*: (4b ff ff a9|a9 ff ff 4b) bl .*\.plt_call\.f3> +.*: (4b ff ff 79|79 ff ff 4b) bl .*\.plt_call\.f3> .*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) -.*: (4b ff ff 91|91 ff ff 4b) bl .*\.plt_call\.f4> +.*: (4b ff ff 51|51 ff ff 4b) bl .*\.plt_call\.f4> .*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) .*: (e8 01 00 30|30 00 01 e8) ld r0,48\(r1\) .*: (38 21 00 20|20 00 21 38) addi r1,r1,32 .*: (7c 08 03 a6|a6 03 08 7c) mtlr r0 .*: (4e 80 00 20|20 00 80 4e) blr -.*: (00 00 00 00|80 02 01 00) .* -.*: (00 01 02 80|00 00 00 00) .* +.* +.* -0+390 <__glink_PLTresolve>: +.* <__glink_PLTresolve>: .*: (7c 08 02 a6|a6 02 08 7c) mflr r0 .*: (42 9f 00 05|05 00 9f 42) bcl .* .*: (7d 68 02 a6|a6 02 68 7d) mflr r11 diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index f709b1e..ef3b718 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -29,33 +29,34 @@ if {[istarget "*-*-vxworks"]} { "-mregnames" {vxworks1-lib.s} {{readelf --segments vxworks1-lib.sd}} "libvxworks1.so"} - {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" + {"VxWorks shared library test 1" + "-shared --hash-style=sysv -Tvxworks1.ld" "" "-mregnames" {vxworks1-lib.s} {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} "libvxworks1.so"} {"VxWorks executable test 1 (dynamic)" \ - "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" + "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic --hash-style=sysv" "" "-mregnames" {vxworks1.s} {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} "vxworks1"} {"VxWorks executable test 2 (dynamic)" \ - "-Tvxworks1.ld -q --force-dynamic" "" + "-Tvxworks1.ld -q --force-dynamic --hash-style=sysv" "" "-mregnames" {vxworks2.s} {{readelf --segments vxworks2.sd}} "vxworks2"} {"VxWorks executable test 2 (static)" - "-Tvxworks1.ld" "" + "-Tvxworks1.ld --hash-style=sysv" "" "-mregnames" {vxworks2.s} {{readelf --segments vxworks2-static.sd}} "vxworks2"} {"VxWorks relax test" - "-Tvxworks1.ld --relax -q" "" + "-Tvxworks1.ld --relax -q --hash-style=sysv" "" "-mregnames" {vxworks-relax.s} {{readelf --relocs vxworks-relax.rd}} "vxworks-relax"} {"VxWorks relocatable relax test" - "-Tvxworks1.ld -r --relax -q" "" + "-Tvxworks1.ld -r --relax -q --hash-style=sysv" "" "-mregnames" {vxworks-relax-2.s} {{readelf --relocs vxworks-relax-2.rd}} "vxworks-relax-2"} @@ -109,110 +110,120 @@ set ppcelftests { {"APUinfo NULL section processing" "-melf32ppc" "" "-a32 -me500" {apuinfo-nul1.s apuinfo-nul.s} {{readelf -x2 apuinfo-nul.rd}} "apuinfo"} + {"TLS32 static exec (markers)" "-melf32ppc" "" + "-a32 --defsym TLSMARK=1" {tls32.s tlslib32.s} + {{objdump -dr tls32.d} {objdump -sj.got tls32.g} + {objdump -sj.tdata tls32.t}} + "tls32m"} {"TLS32 static exec" "-melf32ppc" "" "-a32" {tls32.s tlslib32.s} {{objdump -dr tls32.d} {objdump -sj.got tls32.g} {objdump -sj.tdata tls32.t}} "tls32"} {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" "" {} {} "libtlslib32.so"} - {"TLS32 dynamic exec" "-melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {} + {"TLS32 dynamic exec" "-melf32ppc --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {} {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d} {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}} - "tlsexe32"} - {"TLS32 shared" "-shared -melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o" "" "" {} + "tlsexe32"} + {"TLS32 shared" "-shared -melf32ppc --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {} {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d} {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}} - "tls32.so"} + "tls32.so"} {"TLS32 markers" "-melf32ppc" "" "-a32" {tlsmark32.s tlslib32.s} {{objdump -dr tlsmark32.d}} - "tlsmark32"} + "tlsmark32"} {"TLS32 opt 1" "-melf32ppc" "" "-a32" {tlsopt1_32.s tlslib32.s} {{objdump -dr tlsopt1_32.d}} - "tlsopt1_32"} + "tlsopt1_32"} {"TLS32 opt 2" "-melf32ppc" "" "-a32" {tlsopt2_32.s tlslib32.s} {{objdump -dr tlsopt2_32.d}} - "tlsopt2_32"} + "tlsopt2_32"} {"TLS32 opt 3" "-melf32ppc" "" "-a32" {tlsopt3_32.s tlslib32.s} {{objdump -dr tlsopt3_32.d}} "tlsopt3_32"} {"TLS32 opt 4" "-melf32ppc" "" "-a32" {tlsopt4_32.s tlslib32.s} {{objdump -dr tlsopt4_32.d}} - "tlsopt4_32"} - {"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" "" "-a32" {tlsdll_32.s} + "tlsopt4_32"} + {"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" "" + "-a32" {tlsdll_32.s} {} "tlsdll32.so"} - {"TLS32 opt 5" "-melf32ppc --gc-sections --secure-plt tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s} + {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s} {{objdump -dr tlsopt5_32.d}} - "tlsopt5_32"} + "tlsopt5_32"} {"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s} {} "sdalib.so"} {"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "" "-a32" {sdadyn.s} {{objdump -R sdadyn.d}} "sdadyn"} {"relaxing" "-melf32ppc --relax -Ttext=0 --defsym far=0x80001234 --defsym near=0x00004320" "" "-a32" "relax.s" {{objdump -dr relax.d}} - "relax"} + "relax"} {"relocatable relaxing" "-melf32ppc -r --relax" "" "-a32" "relax.s" {{objdump -dr relaxr.d}} - "relax"} + "rrelax"} } set ppc64elftests { - {"TLS static exec" "-melf64ppc" "" "-a64" {tls.s tlslib.s} + {"TLS static exec (markers)" "-melf64ppc --no-plt-align" "" + "-a64 --defsym TLSMARK=1" {tls.s tlslib.s} + {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}} + "tlsm"} + {"TLS static exec" "-melf64ppc --no-plt-align" "" "-a64" {tls.s tlslib.s} {{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}} - "tls"} + "tls"} {"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" "" {} {} "libtlslib.so"} {"TLS helper old shared lib" "-shared -melf64ppc" "" "-a64" {oldtlslib.s} {} "liboldlib.so"} - {"TLS dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/libtlslib.so" "" "" {} + {"TLS dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {} {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d} {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}} - "tlsexe"} - {"TLS dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/liboldlib.so" "" "" {} + "tlsexe"} + {"TLS dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {} {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d} {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}} - "tlsexeold"} - {"TLS shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o" "" "" {} + "tlsexeold"} + {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {} {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d} {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}} - "tls.so"} + "tls.so"} {"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "" "-a64" {tlstoc.s} {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g} {objdump -sj.tdata tlstoc.t}} - "tlstoc"} - {"TLSTOC dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/libtlslib.so" "" + "tlstoc"} + {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" "" "" {} {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d} {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}} - "tlsexetoc"} - {"TLSTOC dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/liboldlib.so" "" + "tlsexetoc"} + {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" "" "" {} {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d} {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}} - "tlsexetocold"} - {"TLSTOC shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o" "" "" {} + "tlsexetocold"} + {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {} {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d} {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}} - "tlstoc.so"} + "tlstoc.so"} {"TLS markers" "-melf64ppc" "" "-a64" {tlsmark.s tlslib.s} {{objdump -dr tlsmark.d}} - "tlsmark"} + "tlsmark"} {"TLS opt 1" "-melf64ppc" "" "-a64" {tlsopt1.s tlslib.s} {{objdump -dr tlsopt1.d}} - "tlsopt1"} + "tlsopt1"} {"TLS opt 2" "-melf64ppc" "" "-a64" {tlsopt2.s tlslib.s} {{objdump -dr tlsopt2.d}} - "tlsopt2"} + "tlsopt2"} {"TLS opt 3" "-melf64ppc" "" "-a64" {tlsopt3.s tlslib.s} {{objdump -dr tlsopt3.d}} - "tlsopt3"} + "tlsopt3"} {"TLS opt 4" "-melf64ppc" "" "-a64" {tlsopt4.s tlslib.s} {{objdump -dr tlsopt4.d}} - "tlsopt4"} + "tlsopt4"} {"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s} {} "tlsdll.so"} - {"TLS opt 5" "-melf64ppc --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s} - {{objdump -dr tlsopt5.d}} - "tlsopt5"} + {"TLS opt 5" "-melf64ppc --no-plt-align -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s} + {{objdump -dr tlsopt5.d} {readelf -wf tlsopt5.wf}} + "tlsopt5"} {"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s} {{objdump -dj.data symtocbase.d}} "symtocbase.so"} {"TOC opt" "-melf64ppc" "" "-a64" {tocopt.s} diff --git a/ld/testsuite/ld-powerpc/ppc476-shared.d b/ld/testsuite/ld-powerpc/ppc476-shared.d index fe438f4..72f8a3d 100644 --- a/ld/testsuite/ld-powerpc/ppc476-shared.d +++ b/ld/testsuite/ld-powerpc/ppc476-shared.d @@ -23,7 +23,7 @@ Disassembly of section \.text: \.\.\. 3fff0: (42 9f 00 05|05 00 9f 42) bcl .* 3fff4: (7d 28 02 a6|a6 02 28 7d) mflr r9 - 3fff8: (3d 29 00 00|00 00 29 3d) addis r9,r9,0 + 3fff8: (3d 29 00 01|01 00 29 3d) addis r9,r9,1 3fff[8a]: R_PPC_REL16_HA \.bss\+0x[46] 3fffc: (48 00 00 34|34 00 00 48) b 40030 .* 40000: (3c 60 00 00|00 00 60 3c) lis r3,0 @@ -41,7 +41,7 @@ Disassembly of section \.text: 40024: (4b fe ff dc|dc ff fe 4b) b 30000 .* 40028: (48 00 00 02|02 00 00 48) ba 0 .* 4002c: (48 00 00 02|02 00 00 48) ba 0 .* - 40030: (39 29 01 50|50 01 29 39) addi r9,r9,336 + 40030: (39 29 00 0c|0c 00 29 39) addi r9,r9,12 4003[02]: R_PPC_REL16_LO \.bss\+0x3[ce] 40034: (4b ff ff cc|cc ff ff 4b) b 40000 .* 40038: (48 00 00 02|02 00 00 48) ba 0 .* diff --git a/ld/testsuite/ld-powerpc/ppc476-shared.lnk b/ld/testsuite/ld-powerpc/ppc476-shared.lnk index 5339358..03e66b3 100644 --- a/ld/testsuite/ld-powerpc/ppc476-shared.lnk +++ b/ld/testsuite/ld-powerpc/ppc476-shared.lnk @@ -2,5 +2,5 @@ SECTIONS { . = 0xfffc; .text : { *(.text) } - .bss : { *(.bss) } + .bss : ALIGN (0x10000) { *(.bss) } } diff --git a/ld/testsuite/ld-powerpc/ppc476-shared2.d b/ld/testsuite/ld-powerpc/ppc476-shared2.d index 813ea2e..5bf0a03 100644 --- a/ld/testsuite/ld-powerpc/ppc476-shared2.d +++ b/ld/testsuite/ld-powerpc/ppc476-shared2.d @@ -8,9 +8,9 @@ DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE -0001000[02] R_PPC_ADDR16_LO \.text\+0x00040144 -0002000[02] R_PPC_ADDR16_LO \.text\+0x00040144 -0003000[02] R_PPC_ADDR16_LO \.text\+0x00040144 -0004000[02] R_PPC_ADDR16_HA \.text\+0x00040144 -0004001[02] R_PPC_ADDR16_HA \.text\+0x00040144 -0004002[02] R_PPC_ADDR16_HA \.text\+0x00040144 +0001000[02] R_PPC_ADDR16_LO \.text\+0x00050000 +0002000[02] R_PPC_ADDR16_LO \.text\+0x00050000 +0003000[02] R_PPC_ADDR16_LO \.text\+0x00050000 +0004000[02] R_PPC_ADDR16_HA \.text\+0x00050000 +0004001[02] R_PPC_ADDR16_HA \.text\+0x00050000 +0004002[02] R_PPC_ADDR16_HA \.text\+0x00050000 diff --git a/ld/testsuite/ld-powerpc/relbrlt.d b/ld/testsuite/ld-powerpc/relbrlt.d index a5f2437..a00b1ff 100644 --- a/ld/testsuite/ld-powerpc/relbrlt.d +++ b/ld/testsuite/ld-powerpc/relbrlt.d @@ -1,6 +1,6 @@ #source: relbrlt.s #as: -a64 -#ld: -melf64ppc --no-ld-generated-unwind-info --emit-relocs +#ld: -melf64ppc --no-plt-align --no-ld-generated-unwind-info --emit-relocs #objdump: -Dr .* diff --git a/ld/testsuite/ld-powerpc/tls.d b/ld/testsuite/ld-powerpc/tls.d index 7082028..563f6b2 100644 --- a/ld/testsuite/ld-powerpc/tls.d +++ b/ld/testsuite/ld-powerpc/tls.d @@ -10,44 +10,44 @@ Disassembly of section \.text: 0+100000e8 <\._start>: -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 78|78 90 63 38) addi r3,r3,-28552 -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (38 6d 90 78|78 90 6d 38) addi r3,r13,-28552 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 10 00|00 10 63 38) addi r3,r3,4096 -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 40|40 90 63 38) addi r3,r3,-28608 -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (38 6d 90 40|40 90 6d 38) addi r3,r13,-28608 +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 10 00|00 10 63 38) addi r3,r3,4096 .*: (39 23 80 48|48 80 23 39) addi r9,r3,-32696 .*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .*: (81 49 80 50|50 80 49 81) lwz r10,-32688\(r9\) .*: (e9 22 80 10|10 80 22 e9) ld r9,-32752\(r2\) .*: (7d 49 18 2a|2a 18 49 7d) ldx r10,r9,r3 -.*: (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.*: (a1 49 90 60|60 90 49 a1) lhz r10,-28576\(r9\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (a1 4d 90 60|60 90 4d a1) lhz r10,-28576\(r13\) .*: (89 4d 90 68|68 90 4d 89) lbz r10,-28568\(r13\) -.*: (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.*: (99 49 90 70|70 90 49 99) stb r10,-28560\(r9\) -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 00|00 90 63 38) addi r3,r3,-28672 -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (99 4d 90 70|70 90 4d 99) stb r10,-28560\(r13\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (38 6d 90 00|00 90 6d 38) addi r3,r13,-28672 +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 10 00|00 10 63 38) addi r3,r3,4096 .*: (f9 43 80 08|08 80 43 f9) std r10,-32760\(r3\) .*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .*: (91 49 80 10|10 80 49 91) stw r10,-32752\(r9\) .*: (e9 22 80 08|08 80 22 e9) ld r9,-32760\(r2\) .*: (7d 49 19 2a|2a 19 49 7d) stdx r10,r9,r3 -.*: (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.*: (b1 49 90 60|60 90 49 b1) sth r10,-28576\(r9\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (b1 4d 90 60|60 90 4d b1) sth r10,-28576\(r13\) .*: (e9 4d 90 2a|2a 90 4d e9) lwa r10,-28632\(r13\) -.*: (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.*: (a9 49 90 30|30 90 49 a9) lha r10,-28624\(r9\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (a9 4d 90 30|30 90 4d a9) lha r10,-28624\(r13\) 0+10000180 <\.__tls_get_addr>: .*: (4e 80 00 20|20 00 80 4e) blr diff --git a/ld/testsuite/ld-powerpc/tls.s b/ld/testsuite/ld-powerpc/tls.s index 49828d0..9bf69d3 100644 --- a/ld/testsuite/ld-powerpc/tls.s +++ b/ld/testsuite/ld-powerpc/tls.s @@ -29,23 +29,43 @@ _start: #extern syms #GD addi 3,2,gd@got@tlsgd #R_PPC64_GOT_TLSGD16 gd + .ifdef TLSMARK + bl __tls_get_addr(gd@tlsgd) #R_PPC64_TLSGD gd + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop #LD addi 3,2,ld@got@tlsld #R_PPC64_GOT_TLSLD16 ld + .ifdef TLSMARK + bl __tls_get_addr(ld@tlsld) #R_PPC64_TLSLD ld + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop #global syms #GD addi 3,2,gd0@got@tlsgd #R_PPC64_GOT_TLSGD16 gd0 + .ifdef TLSMARK + bl __tls_get_addr(gd0@tlsgd) #R_PPC64_TLSGD gd0 + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop #LD addi 3,2,ld0@got@tlsld #R_PPC64_GOT_TLSLD16 ld0 + .ifdef TLSMARK + bl __tls_get_addr(ld0@tlsld) #R_PPC64_TLSLD ld0 + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop addi 9,3,ld0@dtprel #R_PPC64_DTPREL16 ld0 @@ -69,12 +89,22 @@ _start: #local syms #GD addi 3,2,gd4@got@tlsgd #R_PPC64_GOT_TLSGD16 gd4 + .ifdef TLSMARK + bl __tls_get_addr(gd4@tlsgd) #R_PPC64_TLSGD gd4 + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop #LD addi 3,2,ld4@got@tlsld #R_PPC64_GOT_TLSLD16 ld4 + .ifdef TLSMARK + bl __tls_get_addr(ld4@tlsld) #R_PPC64_TLSLD ld4 + #R_PPC64_REL24 __tls_get_addr + .else bl .__tls_get_addr #R_PPC64_REL24 .__tls_get_addr + .endif nop std 10,ld4@dtprel(3) #R_PPC64_DTPREL16_DS ld4 @@ -94,4 +124,3 @@ _start: addis 9,13,le5@tprel@ha #R_PPC64_TPREL16_HA le5 lha 10,le5@tprel@l(9) #R_PPC64_TPREL16_LO le5 - diff --git a/ld/testsuite/ld-powerpc/tls32.s b/ld/testsuite/ld-powerpc/tls32.s index b9b8468..1c7a890 100644 --- a/ld/testsuite/ld-powerpc/tls32.s +++ b/ld/testsuite/ld-powerpc/tls32.s @@ -33,20 +33,40 @@ _start: #extern syms #GD addi 3,31,gd@got@tlsgd #R_PPC_GOT_TLSGD16 gd + .ifdef TLSMARK + bl __tls_get_addr(gd@tlsgd) #R_PPC_TLSGD gd + #R_PPC_REL24 __tls_get_addr + .else bl __tls_get_addr #R_PPC_REL24 __tls_get_addr + .endif #LD addi 3,31,ld@got@tlsld #R_PPC_GOT_TLSLD16 ld + .ifdef TLSMARK + bl __tls_get_addr(ld@tlsld) #R_PPC_TLSLD ld + #R_PPC_REL24 __tls_get_addr + .else bl __tls_get_addr #R_PPC_REL24 __tls_get_addr + .endif #global syms #GD addi 3,31,gd0@got@tlsgd #R_PPC_GOT_TLSGD16 gd0 - bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr + .ifdef TLSMARK + bl __tls_get_addr+0x8000(gd0@tlsgd)@plt #R_PPC_TLSGD gd0 + #R_PPC_PLTREL24 __tls_get_addr+0x8000 + .else + bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr+0x8000 + .endif #LD addi 3,31,ld0@got@tlsld #R_PPC_GOT_TLSLD16 ld0 - bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr + .ifdef TLSMARK + bl __tls_get_addr+0x8000(ld0@tlsld)@plt #R_PPC_TLSLD ld0 + #R_PPC_PLTREL24 __tls_get_addr+0x8000 + .else + bl __tls_get_addr+0x8000@plt #R_PPC_PLTREL24 __tls_get_addr+0x8000 + .endif addi 9,3,ld0@dtprel #R_PPC_DTPREL16 ld0 @@ -66,11 +86,21 @@ _start: #local syms, use a different got reg too. #GD addi 3,30,gd4@got@tlsgd #R_PPC_GOT_TLSGD16 gd4 + .ifdef TLSMARK + bl __tls_get_addr(gd4@tlsgd) #R_PPC_TLSGD gd4 + #R_PPC_REL24 __tls_get_addr + .else bl __tls_get_addr #R_PPC_REL24 __tls_get_addr + .endif #LD addi 3,30,ld4@got@tlsld #R_PPC_GOT_TLSLD16 ld4 + .ifdef TLSMARK + bl __tls_get_addr(ld4@tlsld) #R_PPC_TLSLD ld4 + #R_PPC_REL24 __tls_get_addr + .else bl __tls_get_addr #R_PPC_REL24 __tls_get_addr + .endif stw 10,ld4@dtprel(3) #R_PPC_DTPREL16 ld4 diff --git a/ld/testsuite/ld-powerpc/tlsexe.d b/ld/testsuite/ld-powerpc/tlsexe.d index b536622..542b435 100644 --- a/ld/testsuite/ld-powerpc/tlsexe.d +++ b/ld/testsuite/ld-powerpc/tlsexe.d @@ -30,43 +30,43 @@ Disassembly of section \.text: .* <._start>: .* (e8 62 80 10|10 80 62 e8) ld r3,-32752\(r2\) -.* (60 00 00 00|00 00 00 60) nop .* (7c 63 6a 14|14 6a 63 7c) add r3,r3,r13 +.* (60 00 00 00|00 00 00 60) nop .* (38 62 80 18|18 80 62 38) addi r3,r2,-32744 .* (4b ff ff a9|a9 ff ff 4b) bl .* .* (60 00 00 00|00 00 00 60) nop -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 90 38|38 90 63 38) addi r3,r3,-28616 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.* (38 6d 90 38|38 90 6d 38) addi r3,r13,-28616 +.* (60 00 00 00|00 00 00 60) nop +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 10 00|00 10 63 38) addi r3,r3,4096 .* (39 23 80 40|40 80 23 39) addi r9,r3,-32704 .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .* (81 49 80 48|48 80 49 81) lwz r10,-32696\(r9\) .* (e9 22 80 28|28 80 22 e9) ld r9,-32728\(r2\) .* (7d 49 18 2a|2a 18 49 7d) ldx r10,r9,r3 -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (a1 49 90 58|58 90 49 a1) lhz r10,-28584\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (a1 4d 90 58|58 90 4d a1) lhz r10,-28584\(r13\) .* (89 4d 90 60|60 90 4d 89) lbz r10,-28576\(r13\) -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (99 49 90 68|68 90 49 99) stb r10,-28568\(r9\) -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 90 00|00 90 63 38) addi r3,r3,-28672 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.* (99 4d 90 68|68 90 4d 99) stb r10,-28568\(r13\) +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 90 00|00 90 6d 38) addi r3,r13,-28672 +.* (60 00 00 00|00 00 00 60) nop +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 10 00|00 10 63 38) addi r3,r3,4096 .* (f9 43 80 08|08 80 43 f9) std r10,-32760\(r3\) .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .* (91 49 80 10|10 80 49 91) stw r10,-32752\(r9\) .* (e9 22 80 08|08 80 22 e9) ld r9,-32760\(r2\) .* (7d 49 19 2a|2a 19 49 7d) stdx r10,r9,r3 -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (b1 49 90 58|58 90 49 b1) sth r10,-28584\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (b1 4d 90 58|58 90 4d b1) sth r10,-28584\(r13\) .* (e9 4d 90 2a|2a 90 4d e9) lwa r10,-28632\(r13\) -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (a9 49 90 30|30 90 49 a9) lha r10,-28624\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (a9 4d 90 30|30 90 4d a9) lha r10,-28624\(r13\) .* (00 00 00 00|20 02 01 00) .* .* (00 01 02 20|00 00 00 00) .* .* <__glink_PLTresolve>: diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.d b/ld/testsuite/ld-powerpc/tlsexetoc.d index 1c70d54..d216a2a 100644 --- a/ld/testsuite/ld-powerpc/tlsexetoc.d +++ b/ld/testsuite/ld-powerpc/tlsexetoc.d @@ -35,22 +35,22 @@ Disassembly of section \.text: .* (38 62 80 18|18 80 62 38) addi r3,r2,-32744 .* (4b ff ff a9|a9 ff ff 4b) bl .* .* (60 00 00 00|00 00 00 60) nop -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 90 38|38 90 63 38) addi r3,r3,-28616 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.* (38 6d 90 38|38 90 6d 38) addi r3,r13,-28616 +.* (60 00 00 00|00 00 00 60) nop +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 10 00|00 10 63 38) addi r3,r3,4096 .* (39 23 80 40|40 80 23 39) addi r9,r3,-32704 .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .* (81 49 80 48|48 80 49 81) lwz r10,-32696\(r9\) .* (e9 22 80 48|48 80 22 e9) ld r9,-32696\(r2\) .* (7d 49 18 2a|2a 18 49 7d) ldx r10,r9,r3 -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (a1 49 90 58|58 90 49 a1) lhz r10,-28584\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (a1 4d 90 58|58 90 4d a1) lhz r10,-28584\(r13\) .* (89 4d 90 60|60 90 4d 89) lbz r10,-28576\(r13\) -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (99 49 90 68|68 90 49 99) stb r10,-28568\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (99 4d 90 68|68 90 4d 99) stb r10,-28568\(r13\) .* (00 00 00 00|68 02 01 00) .* .* (00 01 02 68|00 00 00 00) .* .* <__glink_PLTresolve>: diff --git a/ld/testsuite/ld-powerpc/tlsld.d b/ld/testsuite/ld-powerpc/tlsld.d index d66d1db..8eafc2e 100644 --- a/ld/testsuite/ld-powerpc/tlsld.d +++ b/ld/testsuite/ld-powerpc/tlsld.d @@ -10,33 +10,33 @@ Disassembly of section \.text: .*: .* nop -.* addis r29,r13,0 +.* nop .* mr r3,r29 +.* addi r3,r13,4096 .* nop -.* addi r3,r3,4096 .* addis r3,r3,0 .* ld r3,-32768\(r3\) .* nop -.* addis r29,r13,0 +.* nop .* mr r3,r29 +.* addi r3,r13,4096 .* nop -.* addi r3,r3,4096 .* ld r3,-32768\(r3\) .* nop .* nop .* nop .* nop -.* addis r29,r13,0 +.* nop .* mr r3,r29 +.* addi r3,r13,-28672 .* nop -.* addi r3,r3,-28672 .* ld r3,0\(r3\) .* nop .* nop -.* addis r29,r13,0 +.* nop .* mr r3,r29 +.* addi r3,r13,-28672 .* nop -.* addi r3,r3,-28672 .* ld r3,0\(r3\) .* nop .* nop diff --git a/ld/testsuite/ld-powerpc/tlsmark.d b/ld/testsuite/ld-powerpc/tlsmark.d index 786a811..7e10074 100644 --- a/ld/testsuite/ld-powerpc/tlsmark.d +++ b/ld/testsuite/ld-powerpc/tlsmark.d @@ -11,26 +11,26 @@ Disassembly of section \.text: 0+100000e8 <_start>: .*: (48 00 00 18|18 00 00 48) b 10000100 <_start\+0x18> +.*: (38 6d 90 00|00 90 6d 38) addi r3,r13,-28672 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 00|00 90 63 38) addi r3,r3,-28672 .*: (e8 83 00 00|00 00 83 e8) ld r4,0\(r3\) -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (48 00 00 0c|0c 00 00 48) b 10000108 <_start\+0x20> -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (4b ff ff e8|e8 ff ff 4b) b 100000ec <_start\+0x4> +.*: (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 10 00|00 10 63 38) addi r3,r3,4096 .*: (e8 83 80 00|00 80 83 e8) ld r4,-32768\(r3\) -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (48 00 00 0c|0c 00 00 48) b 10000124 <_start\+0x3c> -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (48 00 00 14|14 00 00 48) b 10000134 <_start\+0x4c> +.*: (38 6d 90 04|04 90 6d 38) addi r3,r13,-28668 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 04|04 90 63 38) addi r3,r3,-28668 .*: (e8 a3 00 00|00 00 a3 e8) ld r5,0\(r3\) .*: (4b ff ff ec|ec ff ff 4b) b 1000011c <_start\+0x34> +.*: (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 10 00|00 10 63 38) addi r3,r3,4096 .*: (e8 a3 80 04|04 80 a3 e8) ld r5,-32764\(r3\) 0+10000140 <\.__tls_get_addr>: diff --git a/ld/testsuite/ld-powerpc/tlsopt1_32.d b/ld/testsuite/ld-powerpc/tlsopt1_32.d index ec9c7ca..fd0f7eb 100644 --- a/ld/testsuite/ld-powerpc/tlsopt1_32.d +++ b/ld/testsuite/ld-powerpc/tlsopt1_32.d @@ -15,7 +15,7 @@ Disassembly of section \.text: Disassembly of section \.no_opt1: 0+1800098 <\.no_opt1>: -.*: (38 6d ff f4|f4 ff 6d 38) addi r3,r13,-12 +.*: (38 7e ff f4|f4 ff 7e 38) addi r3,r30,-12 .*: (2c 04 00 00|00 00 04 2c) cmpwi r4,0 .*: (41 82 00 0c|0c 00 82 41) beq .* .*: (4b ff ff f1|f1 ff ff 4b) bl 1800094 <__tls_get_addr> diff --git a/ld/testsuite/ld-powerpc/tlsopt1_32.s b/ld/testsuite/ld-powerpc/tlsopt1_32.s index aba2bbc..79d6662 100644 --- a/ld/testsuite/ld-powerpc/tlsopt1_32.s +++ b/ld/testsuite/ld-powerpc/tlsopt1_32.s @@ -2,7 +2,7 @@ # this section should not be optimised since we have old-style # __tls_get_addr without marker relocs, and the arg setup insn # is shared with two __tls_get_addr calls. - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd cmpwi 4,0 beq 0f bl __tls_get_addr diff --git a/ld/testsuite/ld-powerpc/tlsopt2_32.d b/ld/testsuite/ld-powerpc/tlsopt2_32.d index baffe91..7dc1bce 100644 --- a/ld/testsuite/ld-powerpc/tlsopt2_32.d +++ b/ld/testsuite/ld-powerpc/tlsopt2_32.d @@ -15,9 +15,9 @@ Disassembly of section \.text: Disassembly of section \.no_opt2: 0+1800098 <\.no_opt2>: -.*: (38 6d ff f4|f4 ff 6d 38) addi r3,r13,-12 +.*: (38 7e ff f4|f4 ff 7e 38) addi r3,r30,-12 .*: (2c 04 00 00|00 00 04 2c) cmpwi r4,0 .*: (41 82 00 08|08 00 82 41) beq .* -.*: (38 6d ff f4|f4 ff 6d 38) addi r3,r13,-12 +.*: (38 7e ff f4|f4 ff 7e 38) addi r3,r30,-12 .*: (4b ff ff ed|ed ff ff 4b) bl 1800094 <__tls_get_addr> #pass diff --git a/ld/testsuite/ld-powerpc/tlsopt2_32.s b/ld/testsuite/ld-powerpc/tlsopt2_32.s index bca1247..8c387d0 100644 --- a/ld/testsuite/ld-powerpc/tlsopt2_32.s +++ b/ld/testsuite/ld-powerpc/tlsopt2_32.s @@ -2,9 +2,9 @@ # this section should not be optimised since we have old-style # __tls_get_addr without marker relocs, and two arg setup insns # feed into one __tls_get_addr call. - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd cmpwi 4,0 beq 0f - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd 0: bl __tls_get_addr diff --git a/ld/testsuite/ld-powerpc/tlsopt3_32.d b/ld/testsuite/ld-powerpc/tlsopt3_32.d index 55827a2..2bc999f 100644 --- a/ld/testsuite/ld-powerpc/tlsopt3_32.d +++ b/ld/testsuite/ld-powerpc/tlsopt3_32.d @@ -15,9 +15,9 @@ Disassembly of section \.text: Disassembly of section \.no_opt3: 0+1800098 <\.no_opt3>: -.*: (38 6d ff ec|ec ff 6d 38) addi r3,r13,-20 +.*: (38 7e ff ec|ec ff 7e 38) addi r3,r30,-20 .*: (48 00 00 0c|0c 00 00 48) b .* -.*: (38 6d ff f4|f4 ff 6d 38) addi r3,r13,-12 +.*: (38 7e ff f4|f4 ff 7e 38) addi r3,r30,-12 .*: (48 00 00 0c|0c 00 00 48) b .* .*: (4b ff ff ed|ed ff ff 4b) bl 1800094 <__tls_get_addr> .*: (48 00 00 08|08 00 00 48) b .* diff --git a/ld/testsuite/ld-powerpc/tlsopt3_32.s b/ld/testsuite/ld-powerpc/tlsopt3_32.s index 6432c24..c2b5fcd 100644 --- a/ld/testsuite/ld-powerpc/tlsopt3_32.s +++ b/ld/testsuite/ld-powerpc/tlsopt3_32.s @@ -5,9 +5,9 @@ gd0: .space 8 .section ".no_opt3", "ax", %progbits # this section should also not be optimised - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd b 0f - addi 3,13,gd0@got@tlsgd + addi 3,30,gd0@got@tlsgd b 1f 0: bl __tls_get_addr diff --git a/ld/testsuite/ld-powerpc/tlsopt4.d b/ld/testsuite/ld-powerpc/tlsopt4.d index 944e97f..7c25655 100644 --- a/ld/testsuite/ld-powerpc/tlsopt4.d +++ b/ld/testsuite/ld-powerpc/tlsopt4.d @@ -15,34 +15,34 @@ Disassembly of section \.text: Disassembly of section \.opt1: 0+100000ec <\.opt1>: -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (2c 24 00 00|00 00 24 2c) cmpdi r4,0 .*: (41 82 00 10|10 00 82 41) beq .* +.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 10|10 90 63 38) addi r3,r3,-28656 .*: (48 00 00 0c|0c 00 00 48) b .* +.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 10|10 90 63 38) addi r3,r3,-28656 Disassembly of section \.opt2: 0+1000010c <\.opt2>: -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (2c 24 00 00|00 00 24 2c) cmpdi r4,0 .*: (41 82 00 08|08 00 82 41) beq .* -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 10|10 90 63 38) addi r3,r3,-28656 +.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656 +.*: (60 00 00 00|00 00 00 60) nop Disassembly of section \.opt3: 0+10000124 <\.opt3>: -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (48 00 00 0c|0c 00 00 48) b .* -.*: (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.*: (60 00 00 00|00 00 00 60) nop .*: (48 00 00 10|10 00 00 48) b .* +.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 10|10 90 63 38) addi r3,r3,-28656 .*: (48 00 00 0c|0c 00 00 48) b .* +.*: (38 6d 90 08|08 90 6d 38) addi r3,r13,-28664 .*: (60 00 00 00|00 00 00 60) nop -.*: (38 63 90 08|08 90 63 38) addi r3,r3,-28664 diff --git a/ld/testsuite/ld-powerpc/tlsopt4_32.s b/ld/testsuite/ld-powerpc/tlsopt4_32.s index 9643fcb..762067e 100644 --- a/ld/testsuite/ld-powerpc/tlsopt4_32.s +++ b/ld/testsuite/ld-powerpc/tlsopt4_32.s @@ -4,7 +4,7 @@ gd0: .space 8 .section ".opt1", "ax", %progbits - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd cmpwi 4,0 beq 0f bl __tls_get_addr(gd@tlsgd) @@ -14,17 +14,17 @@ gd0: .space 8 1: .section ".opt2", "ax", %progbits - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd cmpwi 4,0 beq 0f - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd 0: bl __tls_get_addr(gd@tlsgd) .section ".opt3", "ax", %progbits - addi 3,13,gd@got@tlsgd + addi 3,30,gd@got@tlsgd b 0f - addi 3,13,gd0@got@tlsgd + addi 3,30,gd0@got@tlsgd b 1f 0: bl __tls_get_addr(gd@tlsgd) diff --git a/ld/testsuite/ld-powerpc/tlsopt5.d b/ld/testsuite/ld-powerpc/tlsopt5.d index b356a2e..4521a9b 100644 --- a/ld/testsuite/ld-powerpc/tlsopt5.d +++ b/ld/testsuite/ld-powerpc/tlsopt5.d @@ -1,6 +1,6 @@ #source: tlsopt5.s #as: -a64 -#ld: --gc-sections --no-plt-localentry tlsdll.so +#ld: -shared --gc-sections --no-plt-localentry tlsdll.so #objdump: -dr #target: powerpc64*-*-* @@ -8,7 +8,7 @@ Disassembly of section \.text: -0000000010000300 <.*\.plt_call\.__tls_get_addr_opt@@GLIBC_2\.22>: +.* <.*\.plt_call\.__tls_get_addr_opt@@GLIBC_2\.22>: .*: (00 00 63 e9|e9 63 00 00) ld r11,0\(r3\) .*: (08 00 83 e9|e9 83 00 08) ld r12,8\(r3\) .*: (78 1b 60 7c|7c 60 1b 78) mr r0,r3 @@ -27,14 +27,14 @@ Disassembly of section \.text: .*: (a6 03 68 7d|7d 68 03 a6) mtlr r11 .*: (20 00 80 4e|4e 80 00 20) blr -0000000010000344 <_start>: +.* <_start>: .*: (08 80 62 38|38 62 80 08) addi r3,r2,-32760 .*: (b9 ff ff 4b|4b ff ff b9) bl .* .*: (00 00 00 60|60 00 00 00) nop -.*: (b8 02 01 00|00 00 00 00) .* -.*: (00 00 00 00|00 01 02 b8) .* +.* +.* -0000000010000358 <__glink_PLTresolve>: +.* <__glink_PLTresolve>: .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 .*: (05 00 9f 42|42 9f 00 05) bcl .* .*: (a6 02 68 7d|7d 68 02 a6) mflr r11 @@ -50,5 +50,5 @@ Disassembly of section \.text: .*: (08 00 6b e9|e9 6b 00 08) ld r11,8\(r11\) .*: (20 04 80 4e|4e 80 04 20) bctr -0000000010000390 <__tls_get_addr_opt@plt>: +.* <__tls_get_addr_opt@plt>: .*: (c8 ff ff 4b|4b ff ff c8) b .* diff --git a/ld/testsuite/ld-powerpc/tlsopt5.s b/ld/testsuite/ld-powerpc/tlsopt5.s index 598bbd9..70902ef 100644 --- a/ld/testsuite/ld-powerpc/tlsopt5.s +++ b/ld/testsuite/ld-powerpc/tlsopt5.s @@ -1,5 +1,7 @@ .globl _start _start: + .cfi_startproc addi 3,2,gd@got@tlsgd bl __tls_get_addr(gd@tlsgd) nop + .cfi_endproc diff --git a/ld/testsuite/ld-powerpc/tlsopt5.wf b/ld/testsuite/ld-powerpc/tlsopt5.wf new file mode 100644 index 0000000..af8cb76 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tlsopt5.wf @@ -0,0 +1,28 @@ +Contents of the \.eh_frame section: + +0+ 0+10 0+ CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 65 + Augmentation data: 1b + + DW_CFA_def_cfa: r1 ofs 0 + +0+14 0+14 0+18 FDE cie=0+ pc=.* + DW_CFA_advance_loc: 48 to .* + DW_CFA_offset_extended_sf: r65 at cfa\+8 + DW_CFA_advance_loc: 16 to .* + DW_CFA_restore_extended: r65 + +0+2c 0+14 0+30 FDE cie=0+ pc=.* + DW_CFA_advance_loc: 4 to .* + DW_CFA_register: r65 in r0 + DW_CFA_advance_loc: 28 to .* + DW_CFA_restore_extended: r65 + +0+44 0+10 0+48 FDE cie=0+ pc=.* + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-powerpc/tlsopt5_32.d b/ld/testsuite/ld-powerpc/tlsopt5_32.d index 9749248..4f1bf06 100644 --- a/ld/testsuite/ld-powerpc/tlsopt5_32.d +++ b/ld/testsuite/ld-powerpc/tlsopt5_32.d @@ -1,6 +1,6 @@ #source: tlsopt5_32.s #as: -a32 -#ld: --gc-sections --secure-plt tlsdll32.so +#ld: -shared --gc-sections --secure-plt tlsdll32.so #objdump: -dr #target: powerpc*-*-* @@ -8,12 +8,25 @@ Disassembly of section \.text: -01800230 <_start>: -.*: (f8 ff 6d 38|38 6d ff f8) addi r3,r13,-8 -.*: (0d 00 00 48|48 00 00 0d) bl 1800240 <__tls_get_addr_opt@plt> - \.\.\. +.* <_start>: +.*: (f0 ff 21 94|94 21 ff f0) stwu r1,-16\(r1\) +.*: (a6 02 08 7c|7c 08 02 a6) mflr r0 +.*: (05 00 9f 42|42 9f 00 05) bcl .* +.*: (08 00 c1 93|93 c1 00 08) stw r30,8\(r1\) +.*: (a6 02 c8 7f|7f c8 02 a6) mflr r30 +.*: (01 00 de 3f|3f de 00 01) addis r30,r30,1 +.*: (14 00 01 90|90 01 00 14) stw r0,20\(r1\) +.*: (.. .. de 3b|3b de .. ..) addi r30,r30,.* +.*: (f8 ff 7e 38|38 7e ff f8) addi r3,r30,-8 +.*: (1d 00 00 48|48 00 00 1d) bl .* <.*__tls_get_addr_opt.*> +.*: (14 00 01 80|80 01 00 14) lwz r0,20\(r1\) +.*: (08 00 c1 83|83 c1 00 08) lwz r30,8\(r1\) +.*: (a6 03 08 7c|7c 08 03 a6) mtlr r0 +.*: (10 00 21 38|38 21 00 10) addi r1,r1,16 +.*: (20 00 80 4e|4e 80 00 20) blr +.* -01800240 <__tls_get_addr_opt@plt>: +.* <.*__tls_get_addr_opt.*>: .*: (00 00 63 81|81 63 00 00) lwz r11,0\(r3\) .*: (04 00 83 81|81 83 00 04) lwz r12,4\(r3\) .*: (78 1b 60 7c|7c 60 1b 78) mr r0,r3 @@ -22,31 +35,31 @@ Disassembly of section \.text: .*: (20 00 82 4d|4d 82 00 20) beqlr .*: (78 03 03 7c|7c 03 03 78) mr r3,r0 .*: (00 00 00 60|60 00 00 00) nop -.*: (81 01 60 3d|3d 60 01 81) lis r11,385 -.*: (9c 03 6b 81|81 6b 03 9c) lwz r11,924\(r11\) +.*: (0c 00 7e 81|81 7e 00 0c) lwz r11,12\(r30\) .*: (a6 03 69 7d|7d 69 03 a6) mtctr r11 .*: (20 04 80 4e|4e 80 04 20) bctr +.*: (00 00 00 60|60 00 00 00) nop -01800270 <__glink>: +.* <__glink>: .*: (00 00 00 60|60 00 00 00) nop .*: (00 00 00 60|60 00 00 00) nop .*: (00 00 00 60|60 00 00 00) nop .*: (00 00 00 60|60 00 00 00) nop -01800280 <__glink_PLTresolve>: -.*: (81 01 80 3d|3d 80 01 81) lis r12,385 -.*: (80 fe 6b 3d|3d 6b fe 80) addis r11,r11,-384 -.*: (94 03 0c 80|80 0c 03 94) lwz r0,916\(r12\) -.*: (90 fd 6b 39|39 6b fd 90) addi r11,r11,-624 +.* <__glink_PLTresolve>: +.*: (00 00 6b 3d|3d 6b 00 00) addis r11,r11,0 +.*: (a6 02 08 7c|7c 08 02 a6) mflr r0 +.*: (05 00 9f 42|42 9f 00 05) bcl .* +.*: (1c 00 6b 39|39 6b 00 1c) addi r11,r11,28 +.*: (a6 02 88 7d|7d 88 02 a6) mflr r12 +.*: (a6 03 08 7c|7c 08 03 a6) mtlr r0 +.*: (50 58 6c 7d|7d 6c 58 50) subf r11,r12,r11 +.*: (01 00 8c 3d|3d 8c 00 01) addis r12,r12,1 +.*: (.. .. 0c 80|80 0c .. ..) lwz r0,.*\(r12\) +.*: (.. .. 8c 81|81 8c .. ..) lwz r12,.*\(r12\) .*: (a6 03 09 7c|7c 09 03 a6) mtctr r0 .*: (14 5a 0b 7c|7c 0b 5a 14) add r0,r11,r11 -.*: (98 03 8c 81|81 8c 03 98) lwz r12,920\(r12\) .*: (14 5a 60 7d|7d 60 5a 14) add r11,r0,r11 .*: (20 04 80 4e|4e 80 04 20) bctr .*: (00 00 00 60|60 00 00 00) nop .*: (00 00 00 60|60 00 00 00) nop -.*: (00 00 00 60|60 00 00 00) nop -.*: (00 00 00 60|60 00 00 00) nop -.*: (00 00 00 60|60 00 00 00) nop -.*: (00 00 00 60|60 00 00 00) nop -.*: (00 00 00 60|60 00 00 00) nop diff --git a/ld/testsuite/ld-powerpc/tlsopt5_32.s b/ld/testsuite/ld-powerpc/tlsopt5_32.s index 36b4858..d07b742 100644 --- a/ld/testsuite/ld-powerpc/tlsopt5_32.s +++ b/ld/testsuite/ld-powerpc/tlsopt5_32.s @@ -1,4 +1,18 @@ .globl _start _start: - addi 3,13,gd@got@tlsgd - bl __tls_get_addr(gd@tlsgd) + stwu 1,-16(1) + mflr 0 + bcl 20,31,.L2 +.L2: + stw 30,8(1) + mflr 30 + addis 30,30,_GLOBAL_OFFSET_TABLE_-.L2@ha + stw 0,20(1) + addi 30,30,_GLOBAL_OFFSET_TABLE_-.L2@l + addi 3,30,gd@got@tlsgd + bl __tls_get_addr(gd@tlsgd)@plt + lwz 0,20(1) + lwz 30,8(1) + mtlr 0 + addi 1,1,16 + blr diff --git a/ld/testsuite/ld-powerpc/tlstoc.d b/ld/testsuite/ld-powerpc/tlstoc.d index dccf82e..657c93d 100644 --- a/ld/testsuite/ld-powerpc/tlstoc.d +++ b/ld/testsuite/ld-powerpc/tlstoc.d @@ -13,25 +13,25 @@ Disassembly of section \.text: .* (4e 80 00 20|20 00 80 4e) blr .* <\._start>: -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 90 40|40 90 63 38) addi r3,r3,-28608 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.* (38 6d 90 40|40 90 6d 38) addi r3,r13,-28608 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 10 00|00 10 63 38) addi r3,r3,4096 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 90 48|48 90 63 38) addi r3,r3,-28600 -.* (3c 6d 00 00|00 00 6d 3c) addis r3,r13,0 +.* (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 +.* (60 00 00 00|00 00 00 60) nop +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 90 48|48 90 6d 38) addi r3,r13,-28600 +.* (60 00 00 00|00 00 00 60) nop +.* (60 00 00 00|00 00 00 60) nop +.* (38 6d 10 00|00 10 6d 38) addi r3,r13,4096 .* (60 00 00 00|00 00 00 60) nop -.* (38 63 10 00|00 10 63 38) addi r3,r3,4096 .* (39 23 80 50|50 80 23 39) addi r9,r3,-32688 .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 .* (81 49 80 58|58 80 49 81) lwz r10,-32680\(r9\) .* (e9 22 80 40|40 80 22 e9) ld r9,-32704\(r2\) .* (7d 49 18 2a|2a 18 49 7d) ldx r10,r9,r3 -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (a1 49 90 68|68 90 49 a1) lhz r10,-28568\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (a1 4d 90 68|68 90 4d a1) lhz r10,-28568\(r13\) .* (89 4d 90 70|70 90 4d 89) lbz r10,-28560\(r13\) -.* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 -.* (99 49 90 78|78 90 49 99) stb r10,-28552\(r9\) +.* (60 00 00 00|00 00 00 60) nop +.* (99 4d 90 78|78 90 4d 99) stb r10,-28552\(r13\) diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp index 9a375b7..e1796fa 100644 --- a/ld/testsuite/ld-s390/s390.exp +++ b/ld/testsuite/ld-s390/s390.exp @@ -36,7 +36,7 @@ if { !([istarget "s390-*-*"] || [istarget "s390x-*-*"]) } { # readelf: Apply readelf options on result. Compare with regex (last arg). set s390tests { - {"TLS -fpic -shared transitions" "-shared -melf_s390" "" + {"TLS -fpic -shared transitions" "-shared -melf_s390 --hash-style=sysv" "" "-m31" {tlspic1.s tlspic2.s} {{readelf -Ssrl tlspic.rd} {objdump -dzrj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} @@ -44,19 +44,20 @@ set s390tests { {"Helper shared library" "-shared -melf_s390" "" "-m31" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf_s390 tmpdir/libtlslib.so" "" "-m31" {tlsbinpic.s tlsbin.s} + "-melf_s390 tmpdir/libtlslib.so --hash-style=sysv" "" + "-m31" {tlsbinpic.s tlsbin.s} {{readelf -Ssrl tlsbin.rd} {objdump -dzrj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"GOT: symbol address load from got to larl" - "-shared -melf_s390 --version-script=gotreloc-1.ver" "" + "-shared -melf_s390 --hash-style=sysv --version-script=gotreloc-1.ver" "" "-m31" {gotreloc-1.s} {{objdump -dzrj.text gotreloc_31-1.dd}} "gotreloc_31-1"} } set s390xtests { - {"TLS -fpic -shared transitions" "-shared -melf64_s390" "" + {"TLS -fpic -shared transitions" "-shared -melf64_s390 --hash-style=sysv" "" "-m64 -Aesame" {tlspic1_64.s tlspic2_64.s} {{readelf -WSsrl tlspic_64.rd} {objdump -dzrj.text tlspic_64.dd} {objdump -sj.got tlspic_64.sd} {objdump -sj.tdata tlspic_64.td}} @@ -64,13 +65,13 @@ set s390xtests { {"Helper shared library" "-shared -melf64_s390" "" "-m64 -Aesame" {tlslib_64.s} {} "libtlslib_64.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf64_s390 tmpdir/libtlslib_64.so" "" "-m64 -Aesame" - {tlsbinpic_64.s tlsbin_64.s} + "-melf64_s390 tmpdir/libtlslib_64.so --hash-style=sysv" "" + "-m64 -Aesame" {tlsbinpic_64.s tlsbin_64.s} {{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd} {objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}} "tlsbin_64"} {"GOT: symbol address load from got to larl" - "-shared -melf64_s390 --version-script=gotreloc-1.ver" "" + "-shared -melf64_s390 --hash-style=sysv --version-script=gotreloc-1.ver" "" "-m64" {gotreloc-1.s} {{objdump -dzrj.text gotreloc_64-1.dd}} "gotreloc_64-1"} diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp index 297aa13..ba229af 100644 --- a/ld/testsuite/ld-scripts/align.exp +++ b/ld/testsuite/ld-scripts/align.exp @@ -19,7 +19,7 @@ # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, # MA 02110-1301, USA. -if [istarget "rs6000-*-aix*"] { +if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"]} { # Target maps .text and .data to other sections. return } @@ -47,6 +47,9 @@ if ![ld_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align. if ![is_aout_format] { run_dump_test align2a run_dump_test align2b + run_dump_test align3 + run_dump_test align4 + run_dump_test align5 } run_dump_test align2c set LDFLAGS "$saved_LDFLAGS" diff --git a/ld/testsuite/ld-scripts/align3.d b/ld/testsuite/ld-scripts/align3.d new file mode 100644 index 0000000..384d91a --- /dev/null +++ b/ld/testsuite/ld-scripts/align3.d @@ -0,0 +1,3 @@ +# source: align2a.s +# ld: -T align3.t +# error: .*:4: syntax error diff --git a/ld/testsuite/ld-scripts/align3.t b/ld/testsuite/ld-scripts/align3.t new file mode 100644 index 0000000..5c9e5bf --- /dev/null +++ b/ld/testsuite/ld-scripts/align3.t @@ -0,0 +1,10 @@ +SECTIONS +{ + .text : { + SORT_BY_ALIGNMENT (*) (.text .text.*) + } + + .data : { + SORT_BY_ALIGNMENT (*) (.data .data.*) + } +}
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align4.d b/ld/testsuite/ld-scripts/align4.d new file mode 100644 index 0000000..661738a --- /dev/null +++ b/ld/testsuite/ld-scripts/align4.d @@ -0,0 +1,3 @@ +# source: align2a.s +# ld: -T align4.t +# error: .*:4: syntax error diff --git a/ld/testsuite/ld-scripts/align4.t b/ld/testsuite/ld-scripts/align4.t new file mode 100644 index 0000000..fc80905 --- /dev/null +++ b/ld/testsuite/ld-scripts/align4.t @@ -0,0 +1,10 @@ +SECTIONS +{ + .text : { + SORT_BY_INIT_PRIORITY (*) (.text .text.*) + } + + .data : { + SORT_BY_INIT_PRIORITY (*) (.data .data.*) + } +}
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align5.d b/ld/testsuite/ld-scripts/align5.d new file mode 100644 index 0000000..880b6fb --- /dev/null +++ b/ld/testsuite/ld-scripts/align5.d @@ -0,0 +1,7 @@ +# source: align2a.s +# ld: -T align5.t +# nm: -n + +#... +.*foo +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/align5.t b/ld/testsuite/ld-scripts/align5.t new file mode 100644 index 0000000..a0b33e5 --- /dev/null +++ b/ld/testsuite/ld-scripts/align5.t @@ -0,0 +1,12 @@ +SECTIONS +{ + .text : { + SORT_NONE (*) (.text .text.*) + } + + .data : { + SORT_NONE (*) (.data .data.*) + foo = .; + } + /DISCARD/ : {*(*)} +} diff --git a/ld/testsuite/ld-scripts/assign-loc.d b/ld/testsuite/ld-scripts/assign-loc.d index bf6b9d8..bc0c5a0 100644 --- a/ld/testsuite/ld-scripts/assign-loc.d +++ b/ld/testsuite/ld-scripts/assign-loc.d @@ -1,7 +1,7 @@ #ld: -T assign-loc.t #source: data.s #nm: -n -#notarget: rs6000-*-aix* +#notarget: powerpc*-*-aix* rs6000-*-aix* #... 0+0100 A HEAP_SIZE #... diff --git a/ld/testsuite/ld-scripts/cross1.t b/ld/testsuite/ld-scripts/cross1.t index c20e473..0667f25 100644 --- a/ld/testsuite/ld-scripts/cross1.t +++ b/ld/testsuite/ld-scripts/cross1.t @@ -4,6 +4,7 @@ SECTIONS .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } .toc : { *(.toc) } .text : { tmpdir/cross1.o } .data : { tmpdir/cross2.o } diff --git a/ld/testsuite/ld-scripts/data.exp b/ld/testsuite/ld-scripts/data.exp index 1bae4c1..3d8f270 100644 --- a/ld/testsuite/ld-scripts/data.exp +++ b/ld/testsuite/ld-scripts/data.exp @@ -29,3 +29,4 @@ if {[is_aout_format]} { run_dump_test data run_dump_test fill +run_dump_test fill16 diff --git a/ld/testsuite/ld-scripts/defined2.d b/ld/testsuite/ld-scripts/defined2.d index 40728bd..6e6e068 100644 --- a/ld/testsuite/ld-scripts/defined2.d +++ b/ld/testsuite/ld-scripts/defined2.d @@ -1,7 +1,6 @@ #ld: -Tdefined2.t #nm: -B #source: phdrs.s -#xfail: "rs6000-*-aix*" # Check that arithmetic on DEFINED works. # Matching both A and T accounts for formats that can't tell a .text diff --git a/ld/testsuite/ld-scripts/defined3.d b/ld/testsuite/ld-scripts/defined3.d index 61061b6..3401e7c 100644 --- a/ld/testsuite/ld-scripts/defined3.d +++ b/ld/testsuite/ld-scripts/defined3.d @@ -2,7 +2,7 @@ #nm: -B #source: phdrs.s #source: defined.s -#xfail: "rs6000-*-aix*" +#xfail: powerpc*-*-aix* rs6000-*-aix* # Check that DEFINED matches only symbols defined before its location. # The ellipsis account for target-specific symbols. Matching both A and T diff --git a/ld/testsuite/ld-scripts/defined4.d b/ld/testsuite/ld-scripts/defined4.d index b434e40..2f034cb 100644 --- a/ld/testsuite/ld-scripts/defined4.d +++ b/ld/testsuite/ld-scripts/defined4.d @@ -1,7 +1,7 @@ #ld: -Tdefined4.t #nm: -B #source: defined4.s -#xfail: rs6000-*-aix* +#xfail: powerpc*-*-aix* rs6000-*-aix* #notarget: mips*-*-* mmix-*-* # We check that defined and defined1 have the same address. MIPS targets # use different address. MMIX puts defined and defined1 in text section. diff --git a/ld/testsuite/ld-scripts/defined5.d b/ld/testsuite/ld-scripts/defined5.d index 3977c93..8b25743 100644 --- a/ld/testsuite/ld-scripts/defined5.d +++ b/ld/testsuite/ld-scripts/defined5.d @@ -1,7 +1,7 @@ #ld: -Tdefined5.t #nm: -B #source: defined5.s -#xfail: rs6000-*-aix* +#xfail: powerpc*-*-aix* rs6000-*-aix* # Check that arithmetic on DEFINED works. #... diff --git a/ld/testsuite/ld-scripts/exclude-file-5.d b/ld/testsuite/ld-scripts/exclude-file-5.d new file mode 100644 index 0000000..dc7040b --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-5.t +#map: exclude-file-5.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-5.map b/ld/testsuite/ld-scripts/exclude-file-5.map new file mode 100644 index 0000000..9148fd6 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-5.t b/ld/testsuite/ld-scripts/exclude-file-5.t new file mode 100644 index 0000000..e20f5ae --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-5.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_NAME (EXCLUDE_FILE (*-b.o) .data)) + * (SORT_BY_NAME (SORT_BY_NAME (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} diff --git a/ld/testsuite/ld-scripts/exclude-file-6.d b/ld/testsuite/ld-scripts/exclude-file-6.d new file mode 100644 index 0000000..7bc9d65 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-6.t +#map: exclude-file-6.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-6.map b/ld/testsuite/ld-scripts/exclude-file-6.map new file mode 100644 index 0000000..42e1b38 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_ALIGNMENT\(SORT_BY_NAME\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_NAME\(SORT_BY_ALIGNMENT\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-6.t b/ld/testsuite/ld-scripts/exclude-file-6.t new file mode 100644 index 0000000..437e240 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-6.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_ALIGNMENT (SORT_BY_NAME (EXCLUDE_FILE (*-b.o) .data))) + * (SORT_BY_NAME (SORT_BY_ALIGNMENT (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} diff --git a/ld/testsuite/ld-scripts/exclude-file-7.d b/ld/testsuite/ld-scripts/exclude-file-7.d new file mode 100644 index 0000000..8970415 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.d @@ -0,0 +1,5 @@ +#source: exclude-file-a.s +#source: exclude-file-b.s +#ld: -T exclude-file-7.t +#map: exclude-file-7.map + diff --git a/ld/testsuite/ld-scripts/exclude-file-7.map b/ld/testsuite/ld-scripts/exclude-file-7.map new file mode 100644 index 0000000..eb1d0a8 --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.map @@ -0,0 +1,8 @@ +#... +\.data +0x[0-9a-f]+ +0x[0-9a-f]+ + \*\(SORT_BY_INIT_PRIORITY\(EXCLUDE_FILE\(\*-b\.o\) \.data\)\) + \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o + \*\(SORT_BY_ALIGNMENT\(EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)\) + \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o + +#...
\ No newline at end of file diff --git a/ld/testsuite/ld-scripts/exclude-file-7.t b/ld/testsuite/ld-scripts/exclude-file-7.t new file mode 100644 index 0000000..200096e --- /dev/null +++ b/ld/testsuite/ld-scripts/exclude-file-7.t @@ -0,0 +1,11 @@ +SECTIONS +{ + .data : { + * (SORT_BY_INIT_PRIORITY (EXCLUDE_FILE (*-b.o) .data)) + * (SORT_BY_ALIGNMENT (SORT_BY_ALIGNMENT (EXCLUDE_FILE (*-a.o) .data.*))) + } + + /DISCARD/ : { + * (*) + } +} diff --git a/ld/testsuite/ld-scripts/expr2.d b/ld/testsuite/ld-scripts/expr2.d index 26354f6..b05a5d2 100644 --- a/ld/testsuite/ld-scripts/expr2.d +++ b/ld/testsuite/ld-scripts/expr2.d @@ -1,6 +1,6 @@ # ld: -T expr2.t #nm: -B -#xfail: rs6000-*-aix* arm-*-*aout +#xfail: arm-*-*aout powerpc*-*-aix* rs6000-*-aix* #... .* D defined diff --git a/ld/testsuite/ld-scripts/fill.d b/ld/testsuite/ld-scripts/fill.d index 8dd789b..4e42c70 100644 --- a/ld/testsuite/ld-scripts/fill.d +++ b/ld/testsuite/ld-scripts/fill.d @@ -3,20 +3,37 @@ #source: fill_2.s #ld: -T fill.t #objdump: -s -j .text -#xfail: ia64-*-* alpha-*-*ecoff m32c-*-* mips*-*-* sh-*-pe sparc*-*-coff +#notarget: ia64-*-* +#notarget: mips*-*-irix* mips*-*-linux* mips*-*-freebsd* mips*-*-gnu* +#notarget: mips*-*-kfreebsd* mips*-*-netbsd* mips*-*-openbsd* mips*-*-sysv4* +#notarget: tilegx*-*-* +#notarget: tilepro-*-* +#notarget: x86_64-*-cygwin x86_64-*-mingw* x86_64-*-pe* +#xfail: alpha*-*-*ecoff +#xfail: arm-epoc-pe +#xfail: m32c-*-* +#xfail: sh-*-pe +#xfail: sparc*-*-coff #xfail: tic30-*-coff tic4x-*-* tic54x-*-* -#xfail: x86_64-*-pe* x86_64-*-mingw* x86_64-*-cygwin z8k-*-* -# Breaks on ia64 due to minimum alignment of code. The section alignment -# could be increased to suit ia64 but then we'd break many coff targets -# that don't support alignment other than 4 bytes. -# alpha-linuxecoff always aligns code to 16 bytes. -# m32c pads out code sections to 8 bytes. -# mips aligns to 16 bytes +#xfail: z8k-*-* +# +# See also fill16.d. We use `notarget' for configurations unsupported +# here that are covered there, and `xfail' for configurations that work +# in neither place. See below for details as to why individual +# configurations are listed above. +# +# alpha-linuxecoff pads out code to 16 bytes. +# arm-epoc-pe always pads out code to 512 bytes. +# ia64 aligns code to minimum 16 bytes. +# m32c pads out code sections with 4 NOPs (see `m32c_md_end'). +# mips aligns to minimum 16 bytes (except for bare-metal ELF and VxWorks). # sh-pe pads out code sections to 16 bytes # sparc-coff aligns to 8 bytes # tic30-coff aligns to 2 bytes # tic4x has 4 octet bytes # tic54x doesn't support .p2align +# tilegx aligns code to minimum 8 bytes. +# tilepro aligns code to minimum 8 bytes. # x86_64-pe aligns to 16 bytes # z8k-coff aligns to 2 bytes diff --git a/ld/testsuite/ld-scripts/fill16.d b/ld/testsuite/ld-scripts/fill16.d new file mode 100644 index 0000000..d1e369c --- /dev/null +++ b/ld/testsuite/ld-scripts/fill16.d @@ -0,0 +1,43 @@ +#source: fill16_0.s +#source: fill16_1.s +#source: fill16_2.s +#ld: -T fill.t +#objdump: -s -j .text +#notarget: arm-*-coff +#notarget: i[3-7]86-*-coff +#xfail: alpha*-*-*ecoff +#xfail: arm-epoc-pe +#xfail: m32c-*-* +#xfail: sh-*-pe +#xfail: sparc*-*-coff +#xfail: tic30-*-coff tic4x-*-* tic54x-*-* +#xfail: z8k-*-* +# +# See also fill.d. We use `notarget' for configurations unsupported +# here that are covered there, and `xfail' for configurations that work +# with neither place. See below for details as to why individual +# configurations are listed above. +# +# alpha-linuxecoff pads out code to 16 bytes. +# arm-epoc-pe always pads out code to 512 bytes. +# arm-coff always aligns code to 4 bytes. +# i386-coff always aligns code to 4 bytes. +# m32c pads out code sections with 4 NOPs (see `m32c_md_end'). +# sh-pe pads out code sections to 16 bytes +# sparc-coff aligns to 8 bytes +# tic30-coff aligns to 2 bytes +# tic4x has 4 octet bytes +# tic54x doesn't support .p2align +# z8k-coff aligns to 2 bytes + +.*: file format .* + +Contents of section .text: + [0-9a-f]+ cafebabe cafebabe cafebabe cafebabe .* + [0-9a-f]+ 01010101 01010101 01010101 01010101 .* + [0-9a-f]+ 02020202 02020202 02020202 02020202 .* + [0-9a-f]+ 12232323 23232323 23232323 23232323 .* + [0-9a-f]+ 03030303 03030303 03030303 03030303 .* + [0-9a-f]+ 00345600 00004567 000089ab (deadbeef|efbeadde) .* + [0-9a-f]+ 00004567 000089ab 0000cdef 00004567 .* + [0-9a-f]+ 000089ab 0000cdef 00000123 .* diff --git a/ld/testsuite/ld-scripts/fill16_0.s b/ld/testsuite/ld-scripts/fill16_0.s new file mode 100644 index 0000000..2723728 --- /dev/null +++ b/ld/testsuite/ld-scripts/fill16_0.s @@ -0,0 +1,6 @@ + .text + .p2align 4, 0 + .byte 1,1,1,1 + .byte 1,1,1,1 + .byte 1,1,1,1 + .byte 1,1,1,1 diff --git a/ld/testsuite/ld-scripts/fill16_1.s b/ld/testsuite/ld-scripts/fill16_1.s new file mode 100644 index 0000000..261ea7e --- /dev/null +++ b/ld/testsuite/ld-scripts/fill16_1.s @@ -0,0 +1,6 @@ + .text + .p2align 4, 0 + .byte 2,2,2,2 + .byte 2,2,2,2 + .byte 2,2,2,2 + .byte 2,2,2,2 diff --git a/ld/testsuite/ld-scripts/fill16_2.s b/ld/testsuite/ld-scripts/fill16_2.s new file mode 100644 index 0000000..1ddd145 --- /dev/null +++ b/ld/testsuite/ld-scripts/fill16_2.s @@ -0,0 +1,6 @@ + .text + .p2align 4, 0 + .byte 3,3,3,3 + .byte 3,3,3,3 + .byte 3,3,3,3 + .byte 3,3,3,3 diff --git a/ld/testsuite/ld-scripts/provide.exp b/ld/testsuite/ld-scripts/provide.exp index f326e73b..f42ec76 100644 --- a/ld/testsuite/ld-scripts/provide.exp +++ b/ld/testsuite/ld-scripts/provide.exp @@ -23,7 +23,7 @@ # a.out objdump displays the file header inside the text segment, # confusing run_dump_test. -if {[istarget "rs6000-*-aix*"] || [is_aout_format]} { +if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_format]} { unsupported provide-1 unsupported provide-2 unsupported provide-3 diff --git a/ld/testsuite/ld-scripts/sane1.d b/ld/testsuite/ld-scripts/sane1.d index d11a210..e39092e 100644 --- a/ld/testsuite/ld-scripts/sane1.d +++ b/ld/testsuite/ld-scripts/sane1.d @@ -1,7 +1,7 @@ # source: data.s # ld: -T sane1.t # nm: -B -n -# notarget: mmix-* pdp11-* rs6000-*-aix* tic30-*-aout +# notarget: mmix-* pdp11-* powerpc*-*-aix* rs6000-*-aix* tic30-*-aout # mmix symbol sections are wrong, pdp sign extends 16-bit addresses # rs6000-aix and tic30 don't like empty .text diff --git a/ld/testsuite/ld-scripts/size.exp b/ld/testsuite/ld-scripts/size.exp index 2d1219d..0caa9c8 100644 --- a/ld/testsuite/ld-scripts/size.exp +++ b/ld/testsuite/ld-scripts/size.exp @@ -23,7 +23,7 @@ # a.out objdump displays the file header inside the text segment, # confusing run_dump_test. -if {[istarget "rs6000-*-aix*"] || [is_aout_format]} { +if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_format]} { unsupported size-1 unsupported size-2 return diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index 8d58c16..11c8f3f 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -102,7 +102,8 @@ foreach testitem $seltests { # the functionality we try to test for cannot be expected to work. set version [remote_exec host "$CXX -dumpversion"] set version [lindex $version 1] - if [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+|\[4-9\]))\\." $version] { + if { [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+))\\." $version] \ + || [regexp "^(\[1-9\]\[0-9\]+|\[4-9\])" $version] } { set testflags "$cflags $cxxflags" setup_xfail {*-*-*} } else { diff --git a/ld/testsuite/ld-sh/sh-vxworks.exp b/ld/testsuite/ld-sh/sh-vxworks.exp index 2a6b89d..297abec 100644 --- a/ld/testsuite/ld-sh/sh-vxworks.exp +++ b/ld/testsuite/ld-sh/sh-vxworks.exp @@ -26,33 +26,35 @@ set endians { "--big" "-EB" "" "--little" "-EL" "-le" } foreach { gas_option ld_option suffix } $endians { set vxworkstests { - {"VxWorks shared library test 1" "-shared -Tvxworks1.ld $ld_option" "" + {"VxWorks shared library test 1" + "-shared -Tvxworks1.ld --hash-style=sysv $ld_option" "" "$gas_option" {vxworks1-lib.s} {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib$suffix.dd} {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} "libvxworks1.so"} {"VxWorks executable test 1 (dynamic)" \ - "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic $ld_option" "" + "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic $ld_option" "" "$gas_option" {vxworks1.s} {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1$suffix.dd}} "vxworks1"} {"VxWorks executable test 2 (dynamic)" \ - "-Tvxworks1.ld -q --force-dynamic $ld_option" "" + "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic $ld_option" "" "$gas_option" {vxworks2.s} {{readelf --segments vxworks2.sd}} "vxworks2"} {"VxWorks executable test 2 (static)" - "-Tvxworks1.ld $ld_option" "" + "-Tvxworks1.ld --hash-style=sysv $ld_option" "" "$gas_option" {vxworks2.s} {{readelf --segments vxworks2-static.sd}} "vxworks2"} - {"VxWorks shared library test 3" "-shared -Tvxworks1.ld $ld_option" "" + {"VxWorks shared library test 3" + "-shared -Tvxworks1.ld --hash-style=sysv $ld_option" "" "$gas_option" {vxworks3-lib.s} {{objdump -dr vxworks3-lib$suffix.dd}} "libvxworks3.so"} {"VxWorks executable test 3 (dynamic)" \ - "tmpdir/libvxworks3.so -Tvxworks1.ld -q --force-dynamic $ld_option" "" + "tmpdir/libvxworks3.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic $ld_option" "" "$gas_option" {vxworks3.s} {{objdump -d vxworks3$suffix.dd}} "vxworks3"} diff --git a/ld/testsuite/ld-sh/shared-2.d b/ld/testsuite/ld-sh/shared-2.d index e65fea4..26d2887 100644 --- a/ld/testsuite/ld-sh/shared-2.d +++ b/ld/testsuite/ld-sh/shared-2.d @@ -1,7 +1,7 @@ #source: textrel1.s #source: textrel2.s #as: -little -#ld: -shared -EL +#ld: -shared -EL --hash-style=sysv #readelf: -d #target: sh*-*-elf sh*-*-linux* sh*-*-netbsd* diff --git a/ld/testsuite/ld-sh/tlsbin-2.d b/ld/testsuite/ld-sh/tlsbin-2.d index 6958e45..9f18e1d 100644 --- a/ld/testsuite/ld-sh/tlsbin-2.d +++ b/ld/testsuite/ld-sh/tlsbin-2.d @@ -1,7 +1,7 @@ #source: tlsbinpic.s #source: tlsbin.s #as: -little -#ld: -EL tmpdir/tlsbin-0-dso.so +#ld: -EL --hash-style=sysv tmpdir/tlsbin-0-dso.so #readelf: -Ssrl #target: sh*-*-linux* sh*-*-netbsd* diff --git a/ld/testsuite/ld-sh/tlspic-2.d b/ld/testsuite/ld-sh/tlspic-2.d index 42baf1d..a7d83c0 100644 --- a/ld/testsuite/ld-sh/tlspic-2.d +++ b/ld/testsuite/ld-sh/tlspic-2.d @@ -1,7 +1,7 @@ #source: tlspic1.s #source: tlspic2.s #as: -little -#ld: -shared -EL +#ld: -shared -EL --hash-style=sysv #readelf: -Ssrl #target: sh*-*-linux* sh*-*-netbsd* diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index 723b51c..6d7a0d6 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -282,7 +282,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] setup_xfail "aarch64*-*-linux*" shared_test shnp "shared (non PIC, load offset)" \ mainnp.o sh1np.o sh2np.o shared \ - "-T $srcdir/$subdir/elf-offset.ld" + "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" } } # Now compile the code using -fpic. diff --git a/ld/testsuite/ld-sparc/sparc.exp b/ld/testsuite/ld-sparc/sparc.exp index 7782900..3828418 100644 --- a/ld/testsuite/ld-sparc/sparc.exp +++ b/ld/testsuite/ld-sparc/sparc.exp @@ -24,23 +24,24 @@ if {[istarget "sparc-*-vxworks"]} { set sparcvxworkstests { - {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" + {"VxWorks shared library test 1" + "-shared -Tvxworks1.ld --hash-style=sysv" "" "-KPIC" {vxworks1-lib.s} {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} "libvxworks1.so"} {"VxWorks executable test 1 (dynamic)" \ - "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" + "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks1.s} {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} "vxworks1"} {"VxWorks executable test 2 (dynamic)" \ - "-Tvxworks1.ld -q --force-dynamic" "" + "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" "" {vxworks2.s} {{readelf --segments vxworks2.sd}} "vxworks2"} {"VxWorks executable test 2 (static)" - "-Tvxworks1.ld" "" + "-Tvxworks1.ld --hash-style=sysv" "" "" {vxworks2.s} {{readelf --segments vxworks2-static.sd}} "vxworks2"} @@ -67,7 +68,8 @@ if { !([istarget "sparc*-*-elf*"] # readelf: Apply readelf options on result. Compare with regex (last arg). set sparctests { - {"32-bit: TLS -fpic -shared transitions" "-shared -melf32_sparc" "" + {"32-bit: TLS -fpic -shared transitions" + "-shared -melf32_sparc --hash-style=sysv" "" "--32 -K PIC" {tlssunpic32.s tlspic.s} {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd} {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}} @@ -77,19 +79,21 @@ set sparctests { {"32-bit: Another helper shared library" "-shared -melf32_sparc" "" "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"} {"32-bit: TLS -fpic and -fno-pic exec transitions" - "-melf32_sparc tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o" "" + "-melf32_sparc --hash-style=sysv tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o" "" "--32" {tlssunbin32.s} {{readelf -WSsrl tlssunbin32.rd} {objdump -drj.text tlssunbin32.dd} {objdump -sj.got tlssunbin32.sd} {objdump -sj.tdata tlssunbin32.td}} "tlssunbin32"} - {"32-bit: TLS -fno-pic -shared" "-shared -melf32_sparc" "" + {"32-bit: TLS -fno-pic -shared" + "-shared -melf32_sparc --hash-style=sysv" "" "--32" {tlssunnopic32.s tlsnopic.s} {{readelf -WSsrl tlssunnopic32.rd} {objdump -drj.text tlssunnopic32.dd} {objdump -sj.got tlssunnopic32.sd}} "libtlssunnopic32.so"} {"32-bit: TLS in debug sections" "-melf32_sparc" "" "--32" {tlsg32.s} {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"} - {"32-bit: GOTDATA relocations" "-shared -melf32_sparc" "" + {"32-bit: GOTDATA relocations" + "-shared -melf32_sparc --hash-style=sysv" "" "--32 -K PIC" {gotop32.s} {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd} {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}} @@ -99,7 +103,8 @@ set sparctests { {{objdump -dj.wdispcall wdispcall.dd}} "wdispcall"} } set sparc64tests { - {"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc" "" + {"64-bit: TLS -fpic -shared transitions" + "-shared -melf64_sparc --hash-style=sysv" "" "--64 -Av9 -K PIC" {tlssunpic64.s tlspic.s} {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd} {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}} @@ -109,19 +114,21 @@ set sparc64tests { {"64-bit: Another helper shared library" "-shared -melf64_sparc" "" "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"} {"64-bit: TLS -fpic and -fno-pic exec transitions" - "-melf64_sparc tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o" "" + "-melf64_sparc --hash-style=sysv tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o" "" "--64 -Av9" {tlssunbin64.s} {{readelf -WSsrl tlssunbin64.rd} {objdump -drj.text tlssunbin64.dd} {objdump -sj.got tlssunbin64.sd} {objdump -sj.tdata tlssunbin64.td}} "tlssunbin64"} - {"64-bit: TLS -fno-pic -shared" "-shared -melf64_sparc" "" + {"64-bit: TLS -fno-pic -shared" + "-shared -melf64_sparc --hash-style=sysv" "" "--64 -Av9" {tlssunnopic64.s tlsnopic.s} {{readelf -WSsrl tlssunnopic64.rd} {objdump -drj.text tlssunnopic64.dd} {objdump -sj.got tlssunnopic64.sd}} "libtlssunnopic64.so"} {"64-bit: TLS in debug sections" "-melf64_sparc" "" "--64 -Av9" {tlsg64.s} {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"} - {"64-bit: GOTDATA relocations" "-shared -melf64_sparc" "" + {"64-bit: GOTDATA relocations" + "-shared -melf64_sparc --hash-style=sysv" "" "--64 -K PIC" {gotop64.s} {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd} {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}} diff --git a/ld/testsuite/ld-tic6x/tic6x.exp b/ld/testsuite/ld-tic6x/tic6x.exp index c1b0608..943fc5a 100644 --- a/ld/testsuite/ld-tic6x/tic6x.exp +++ b/ld/testsuite/ld-tic6x/tic6x.exp @@ -31,21 +31,21 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] { set shlibtests { {"C6X shared library without --dsbt-index" - "-shared -Tdsbt.ld --dsbt-size=3" "" + "-shared -Tdsbt.ld --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s} {{readelf -WSsrld shlib-noindex.rd} {objdump "-drj.plt -j.text" shlib-noindex.dd} {objdump -sj.got shlib-noindex.sd}} "libtestn.so"} {"C6X shared library, LE, RELA" - "-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3" "" + "-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s} {{readelf -WSsrld shlib-1.rd} {objdump "-drj.plt -j.text" shlib-1.dd} {objdump -sj.got shlib-1.sd}} "libtest.so"} {"C6X nonstatic app using shared library, LE, RELA" - "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtest.so" "" + "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtest.so --hash-style=sysv" "" "-mdsbt -mpic -mpid=near" {shlib-app-1.s} {{readelf -WSsrld shlib-app-1.rd} {objdump "-drj.plt -j.text" shlib-app-1.dd} @@ -53,14 +53,14 @@ set shlibtests { {objdump -R shlib-app-1.od}} "shlib-dynapp-1"} {"C6X shared library, LE, REL" - "-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3" "" + "-shared -Tdsbt.ld --dsbt-index=2 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s} {{readelf -WSsrld shlib-1r.rd} {objdump "-drj.plt -j.text" shlib-1r.dd} {objdump -sj.got shlib-1r.sd}} "libtestr.so"} {"C6X nonstatic app using shared library, LE, REL" - "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestr.so" "" + "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv tmpdir/libtestr.so" "" "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-app-1r.s} {{readelf -WSsrld shlib-app-1r.rd} {objdump "-drj.plt -j.text" shlib-app-1r.dd} @@ -68,14 +68,14 @@ set shlibtests { {objdump -R shlib-app-1r.od}} "shlib-dynapp-1r"} {"C6X shared library, BE, RELA" - "-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3" "" + "-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s} {{readelf -WSsrld shlib-1b.rd} {objdump "-drj.plt -j.text" shlib-1b.dd} {objdump -sj.got shlib-1b.sd}} "libtestb.so"} {"C6X nonstatic app using shared library, BE, RELA" - "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestb.so" "" + "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv tmpdir/libtestb.so" "" "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-app-1.s} {{readelf -WSsrld shlib-app-1b.rd} {objdump "-drj.plt -j.text" shlib-app-1b.dd} @@ -83,14 +83,14 @@ set shlibtests { {objdump -R shlib-app-1b.od}} "shlib-dynapp-1b"} {"C6X shared library, BE, REL" - "-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3" "" + "-shared -Tdsbt-be.ld --dsbt-index=2 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-1.s shlib-2.s} {{readelf -WSsrld shlib-1rb.rd} {objdump "-drj.plt -j.text" shlib-1rb.dd} {objdump -sj.got shlib-1rb.sd}} "libtestrb.so"} {"C6X nonstatic app using shared library, BE, REL" - "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 tmpdir/libtestrb.so" "" + "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv tmpdir/libtestrb.so" "" "-mdsbt -mpic -mpid=near -mgenerate-rel -mbig-endian" {shlib-app-1r.s} {{readelf -WSsrld shlib-app-1rb.rd} {objdump "-drj.plt -j.text" shlib-app-1rb.dd} @@ -99,7 +99,7 @@ set shlibtests { "shlib-dynapp-1rb"} {"C6X static app, LE, RELA" - "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3" "" + "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near" {shlib-1.s shlib-2.s shlib-app-1.s} {{readelf -WSsrld static-app-1.rd} {objdump "-drj.plt -j.text" static-app-1.dd} @@ -107,7 +107,7 @@ set shlibtests { {objdump -R static-app-1.od}} "static-app-1"} {"C6X static app, LE, REL" - "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3" "" + "-Tdsbt.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s} {{readelf -WSsrld static-app-1r.rd} {objdump "-drj.plt -j.text" static-app-1r.dd} @@ -115,7 +115,7 @@ set shlibtests { {objdump -R static-app-1r.od}} "static-app-1r"} {"C6X static app, BE, RELA" - "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3" "" + "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mbig-endian" {shlib-1.s shlib-2.s shlib-app-1.s} {{readelf -WSsrld static-app-1b.rd} {objdump "-drj.plt -j.text" static-app-1b.dd} @@ -123,7 +123,7 @@ set shlibtests { {objdump -R static-app-1b.od}} "static-app-1b"} {"C6X static app, BE, REL" - "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3" "" + "-Tdsbt-be.ld --dsbt-index 0 --dsbt-size=3 --hash-style=sysv" "" "-mdsbt -mpic -mpid=near -mbig-endian -mgenerate-rel" {shlib-1.s shlib-2.s shlib-app-1r.s} {{readelf -WSsrld static-app-1rb.rd} {objdump "-drj.plt -j.text" static-app-1rb.dd} diff --git a/ld/testsuite/ld-undefined/fundef.s b/ld/testsuite/ld-undefined/fundef.s new file mode 100644 index 0000000..96eb668 --- /dev/null +++ b/ld/testsuite/ld-undefined/fundef.s @@ -0,0 +1,31 @@ + .text + .type undef_fun_typed %function + .ifdef BL + bl undef_fun_typed + nop + bl undef_fun_notype + nop + .endif + .ifdef BLPLT + bl undef_fun_typed@plt + nop + bl undef_fun_notype@plt + nop + .endif + .ifdef CALLPLT + call undef_fun_typed@plt + call undef_fun_notype@plt + .endif + .ifdef HPPA + bl undef_fun_typed,%r2 + nop + bl undef_fun_notype,%r2 + nop + .endif + + .data + .type undef_data %object + .dc.a undef_data + .type undef_pfun %function + .dc.a undef_pfun + .dc.a undef_notype diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp index a9ba9bb..c0c9012 100644 --- a/ld/testsuite/ld-undefined/undefined.exp +++ b/ld/testsuite/ld-undefined/undefined.exp @@ -29,119 +29,179 @@ if { ![is_remote host] && [which $CC] == 0 } { untested $testund untested $testfn untested $testline - return -} - -if ![ld_compile "$CC -g" $srcdir/$subdir/undefined.c tmpdir/undefined.o] { +} elseif { ![ld_compile "$CC -g" $srcdir/$subdir/undefined.c tmpdir/undefined.o] } { verbose "Unable to compile test file!" 1 unresolved $testund unresolved $testfn unresolved $testline - return -} +} else { + remote_file host delete "tmpdir/undefined" -remote_file host delete "tmpdir/undefined" + set flags [big_or_little_endian] -set flags [big_or_little_endian] + # Using -e start prevents the SunOS linker from trying to build a + # shared library. + send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n" + set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"] -# Using -e start prevents the SunOS linker from trying to build a -# shared library. -send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n" -set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"] + send_log "$exec_output\n" + verbose "$exec_output" -send_log "$exec_output\n" -verbose "$exec_output" + proc checkund { string testname } { + global exec_output -proc checkund { string testname } { - global exec_output - - if [string match "*$string*" $exec_output] { - pass $testname - } else { - fail $testname + if [string match "*$string*" $exec_output] { + pass $testname + } else { + fail $testname + } } -} -set mu "undefined reference to `*this_function_is_not_defined'" -checkund $mu $testund + set mu "undefined reference to `*this_function_is_not_defined'" + checkund $mu $testund -# ARM PE defaults to using stabs debugging, which we can't handle for -# a COFF file. -#setup_xfail "arm*-*-pe*" + # ARM PE defaults to using stabs debugging, which we can't handle + # for a COFF file. + #setup_xfail "arm*-*-pe*" -# For Xtensa on GNU Linux systems (or any other system where PIC code is -# always used), the address of the undefined function is in a literal pool -# outside the function, so that both the "undefined function" and "undefined -# line" tests fail. -setup_xfail xtensa*-*-linux* + # For Xtensa on GNU Linux systems (or any other system where PIC + # code is always used), the address of the undefined function is + # in a literal pool outside the function, so that both the + # "undefined function" and "undefined line" tests fail. + setup_xfail xtensa*-*-linux* -set mf "tmpdir/undefined.o* In function `function':" -checkund $mf $testfn + set mf "tmpdir/undefined.o* In function `function':" + checkund $mf $testfn -if ![is_elf_format] { - # COFF SH gets this test wrong--it reports line 10, because although - # the jump is at line 9, the function address, and the reloc, is - # stored at the end of the function. - setup_xfail "sh-*-*" + if ![is_elf_format] { + # COFF SH gets this test wrong--it reports line 10, because + # although the jump is at line 9, the function address, and + # the reloc, is stored at the end of the function. + setup_xfail "sh-*-*" - # ARM PE defaults to using stabs debugging, which we can't handle for - # a COFF file. - #setup_xfail "arm*-*-pe*" + # ARM PE defaults to using stabs debugging, which we can't + # handle for a COFF file. + #setup_xfail "arm*-*-pe*" + } + + set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'" + # With targets that use elf/dwarf2, such as the arm-elf toolchain, + # the code in bfd/elf.c:_bfd_elf_find_nearest_line() is called in + # order to locate the file name/line number where the undefined + # reference occurs. Unfortunately this tries to use the dwarf2 + # debug information held in the .debug_info section. This section + # contains a series of comp_unit structures, each of which has a + # low/high address range representing the span of memory locations + # covered by that structure. The structures also index into other + # structures held in the .debug_line section and together they can + # translate memory locations back into file/function/line number + # addresses in the source code. Since the information about the + # memory region covered by a comp_unit is only determined at link + # time, the low/high addresses in the .debug_info section and the + # line addresses in the .debug_line section are computed by + # generating relocs against known symbols in the object code. + # + # When the undefined reference is detected, the relocs in the + # dwarf2 debug sections have not yet been resolved, so the + # low/high addresses and the line number address are all set at + # zero. Thus when _bfd_elf_find_nearest_line() calls + # _bfd_dwarf2_find_nearest_line() no comp_unit can be found which + # actually covers the address where the reference occurred, and so + # _bfd_elf_find_nearest_line() fails. + # + # The upshot of all of this, is that the error message reported by + # the linker, instead of having a source file name & line number + # as in: + # + # undefined.c:9: undefined reference to `this_function_is_not_defined' + # + # has an object file & section address instead: + # + # undefined.0(.text+0xc): undefined reference to `this_function_is_not_defined' + # + # hence the xfails below. + + setup_xfail mcore-*-elf + setup_xfail mep-*-* + setup_xfail mips-sgi-irix6* + setup_xfail "sh64-*-*" + # Fails for the MSP430 because it uses SYM_DIFF relocs but it does + # not provide a special_function for handling them. If + # optimization is enabled then this test passes because + # function()'s prologue is eliminated. + setup_xfail "msp430-*-*" + + # The undefined test fails on 31 bit s/390 because the address of + # the function `this_function_is_not_defined' is stored in the + # literal pool of the function. Therefore the line number in the + # error message is 8 instead of 9. On 64 bit s/390 this works + # because of the new brasl instruction that doesn't need a literal + # pool entry. + setup_xfail s390-*-* + + # See comments above for Xtensa. + setup_xfail xtensa*-*-linux* + setup_xfail hppa*64*-*-* + + checkund $ml $testline } -set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'" -# With targets that use elf/dwarf2, such as the arm-elf -# toolchain, the code in bfd/elf.c:_bfd_elf_find_nearest_line() is called -# in order to locate the file name/line number where the undefined -# reference occurs. Unfortunately this tries to use the dwarf2 debug -# information held in the .debug_info section. This section contains a series -# of comp_unit structures, each of which has a low/high address range -# representing the span of memory locations covered by that structure. The -# structures also index into other structures held in the .debug_line section -# and together they can translate memory locations back into file/function/line -# number addresses in the source code. Since the information about the memory -# region covered by a comp_unit is only determined at link time, the low/high -# addresses in the .debug_info section and the line addresses in the .debug_line -# section are computed by generating relocs against known symbols in the object -# code. -# -# When the undefined reference is detected, the relocs in the dwarf2 -# debug sections have not yet been resolved, so the low/high addresses and the -# line number address are all set at zero. Thus when _bfd_elf_find_nearest_line() -# calls _bfd_dwarf2_find_nearest_line() no comp_unit can be found which -# actually covers the address where the reference occurred, and so -# _bfd_elf_find_nearest_line() fails. -# -# The upshot of all of this, is that the error message reported by the -# linker, instead of having a source file name & line number as in: -# -# undefined.c:9: undefined reference to `this_function_is_not_defined' -# -# has an object file & section address instead: -# -# undefined.0(.text+0xc): undefined reference to `this_function_is_not_defined' -# -# hence the xfails below. - -setup_xfail mcore-*-elf -setup_xfail mep-*-* -setup_xfail mips-sgi-irix6* -setup_xfail "sh64-*-*" -# Fails for the MSP430 because it uses SYM_DIFF relocs but it does -# not provide a special_function for handling them. If optimization -# is enabled then this test passes because function()'s prologue is -# eliminated. -setup_xfail "msp430-*-*" - -# The undefined test fails on 31 bit s/390 because the address of the -# function `this_function_is_not_defined' is stored in the literal pool of -# the function. Therefore the line number in the error message is 8 instead -# of 9. On 64 bit s/390 this works because of the new brasl instruction that -# doesn't need a literal pool entry. -setup_xfail s390-*-* - -# See comments above for Xtensa. -setup_xfail xtensa*-*-linux* -setup_xfail hppa*64*-*-* - -checkund $ml $testline +# Undefined symbols should become dynamic when linking a shared lib. +set testname "undefined symbols in shared lib" + +set asflags "" +switch -glob $target_triplet { + aarch64* - + arm* - + powerpc64* { set asflags "--defsym BL=1" } + powerpc* { set asflags "--defsym BLPLT=1" } + hppa* { set asflags "--defsym HPPA=1" } + i\[3-7\]86* - + x86_64* { set asflags "--defsym CALLPLT=1" } +} + +if { ![is_elf_format] || ![check_shared_lib_support]} then { + unsupported $testname +} elseif {![ld_assemble $as "$asflags $srcdir/$subdir/fundef.s" \ + tmpdir/fundef.o]} then { + fail $testname +} elseif {![ld_link $ld tmpdir/fundef.so \ + "-shared --allow-shlib-undefined tmpdir/fundef.o"]} then { + setup_xfail tic6x-*-* + fail $testname +} else { + if {![is_remote host] && [which $nm] == 0} then { + unresolved "$testname (dyn sym)" + } else { + set exec_output [run_host_cmd "$nm" "-D tmpdir/fundef.so"] + set exec_output [prune_warnings $exec_output] + + if { ($asflags == "" + || ([regexp ".* undef_fun_typed.*" $exec_output] + && [regexp ".* undef_fun_notype.*" $exec_output])) + && [regexp ".* undef_data.*" $exec_output] + && [regexp ".* undef_pfun.*" $exec_output] + && [regexp ".* undef_notype.*" $exec_output]} then { + pass "$testname (dyn sym)" + } else { + fail "$testname (dyn sym)" + } + } + + global READELF + if {![is_remote host] && [which $READELF] == 0} then { + unresolved "$testname (dyn reloc)" + } else { + set exec_output [run_host_cmd "$READELF" "-r tmpdir/fundef.so"] + set exec_output [prune_warnings $exec_output] + + # we ought to get two .rel{a}.plt and three .rel{a}.dyn relocs + if { ($asflags == "" || [regexp ".* contains 2 .*" $exec_output]) + && [regexp ".* contains 3 .*" $exec_output] + && ![regexp "_NONE" $exec_output]} then { + pass "$testname (dyn reloc)" + } else { + fail "$testname (dyn reloc)" + } + } +} diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d index 1bcd4fe..ffc1a72 100644 --- a/ld/testsuite/ld-unique/pr21529.d +++ b/ld/testsuite/ld-unique/pr21529.d @@ -1,5 +1,6 @@ -#ld: --oformat binary -e main +#ld: --oformat binary -T pr21529.ld -e main #objdump: -s -b binary -#xfail: aarch64*-*-* arm*-*-* hppa-*-* ia64-*-* nds32*-*-* score-*-* +#notarget: aarch64*-*-* arm*-*-* avr-*-* ia64-*-* m68hc1*-*-* nds32*-*-* score-*-* +# Skip targets which can't change output format to binary. #pass diff --git a/ld/testsuite/ld-unique/pr21529.ld b/ld/testsuite/ld-unique/pr21529.ld new file mode 100644 index 0000000..113e70b --- /dev/null +++ b/ld/testsuite/ld-unique/pr21529.ld @@ -0,0 +1,5 @@ +SECTIONS +{ + .text : { *(.text) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-vax-elf/vax-elf.exp b/ld/testsuite/ld-vax-elf/vax-elf.exp index f70c712..0f58af8 100644 --- a/ld/testsuite/ld-vax-elf/vax-elf.exp +++ b/ld/testsuite/ld-vax-elf/vax-elf.exp @@ -25,7 +25,7 @@ if { ![istarget vax-*-*] || ![is_elf_format] } { run_ld_link_tests [list \ [list "PLT test (shared library)" \ - "-shared -T plt-local-lib.ld" "" \ + "-shared -T plt-local-lib.ld --hash-style=sysv" "" \ "-k" \ { plt-local-lib.s } \ { { objdump -d plt-local-lib.dd } } \ @@ -43,7 +43,7 @@ run_ld_link_tests [list \ {} \ "plt-local-rehidden-pic-r.o"] \ [list "PLT test (executable)" \ - "-T plt-local.ld tmpdir/plt-local-hidden-pic-r.o tmpdir/plt-local-rehidden-pic-r.o tmpdir/plt-local-lib.so" "" \ + "-T plt-local.ld --hash-style=sysv tmpdir/plt-local-hidden-pic-r.o tmpdir/plt-local-rehidden-pic-r.o tmpdir/plt-local-lib.so" "" \ "" \ { plt-local.s } \ { { objdump -d plt-local.dd } } \ @@ -87,7 +87,7 @@ run_ld_link_tests [list \ run_ld_link_tests [list \ [list \ "VAX export class call relocation test" \ - "-shared -Ttext 0x12340000 -T export-class.ld" "" \ + "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \ "-k" \ [list export-class-call.s export-class-def.s] \ [list \ @@ -97,7 +97,7 @@ run_ld_link_tests [list \ "export-class-call.so"] \ [list \ "VAX export class data relocation test" \ - "-shared -Ttext 0x12340000 -T export-class.ld" "" \ + "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \ "-k" \ [list export-class-data.s export-class-def.s] \ [list \ diff --git a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d index 50ddf74..6b35219 100644 --- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d +++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d @@ -1,6 +1,6 @@ #source: bnd-branch-1.s #as: --64 -#ld: -z now -shared -melf_x86_64 +#ld: -z now -shared -melf_x86_64 --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d index 73ddc31..f29a40a 100644 --- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d +++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d @@ -1,6 +1,6 @@ #source: bnd-ifunc-1.s #as: --64 -madd-bnd-prefix -#ld: -z now -shared -melf_x86_64 -z bndplt +#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-1.d b/ld/testsuite/ld-x86-64/bnd-ifunc-1.d index 273e334..13e86bb 100644 --- a/ld/testsuite/ld-x86-64/bnd-ifunc-1.d +++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1.d @@ -1,5 +1,5 @@ #as: --64 -madd-bnd-prefix -#ld: -shared -melf_x86_64 -z bndplt +#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw #... diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d index 1fbcd17..bb9a26e 100644 --- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d +++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d @@ -1,6 +1,6 @@ #source: bnd-ifunc-2.s #as: --64 -madd-bnd-prefix -#ld: -z now -shared -melf_x86_64 -z bndplt +#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d index fc03c17..caba178 100644 --- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d +++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d @@ -1,5 +1,5 @@ #as: --64 -madd-bnd-prefix -#ld: -shared -melf_x86_64 -z bndplt +#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw #... diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d index 2989f82..9a14a28 100644 --- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d +++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d @@ -1,6 +1,6 @@ #source: bnd-branch-1.s #as: --64 -#ld: -z now -shared -melf_x86_64 -z bndplt +#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1.d b/ld/testsuite/ld-x86-64/bnd-plt-1.d index 66efb1a..3f7c88d 100644 --- a/ld/testsuite/ld-x86-64/bnd-plt-1.d +++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d @@ -1,6 +1,6 @@ #source: bnd-branch-1.s #as: --64 -#ld: -shared -melf_x86_64 -z bndplt +#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d index 6147ab4..665eaa5 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d @@ -1,6 +1,6 @@ #source: ibt-plt-1.s #as: --x32 -#ld: -shared -m elf32_x86_64 +#ld: -shared -m elf32_x86_64 --hash-style=sysv #objdump: -dw .*: +file format .* @@ -9,8 +9,8 @@ Disassembly of section .plt: 0+1c0 <.plt>: - +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 62 01 20 00 pushq 0x200162\(%rip\) # 200328 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 64 01 20 00 jmpq \*0x200164\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +[a-f0-9]+: f3 0f 1e fa endbr64 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 @@ -25,12 +25,12 @@ Disassembly of section .plt.sec: 0+1f0 <bar1@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1> + +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200338 <bar1> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+200 <bar2@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2> + +[a-f0-9]+: ff 25 36 01 20 00 jmpq \*0x200136\(%rip\) # 200340 <bar2> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.d b/ld/testsuite/ld-x86-64/ibt-plt-1.d index dbec3ed..8c36cfb 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-1.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d @@ -1,6 +1,6 @@ #source: ibt-plt-1.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 +#ld: -shared -m elf_x86_64 --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d index df9dc8e..3d934b5 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibtplt +#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -9,8 +9,8 @@ Disassembly of section .plt: 0+1c0 <.plt>: - +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 62 01 20 00 pushq 0x200162\(%rip\) # 200328 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 64 01 20 00 jmpq \*0x200164\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +[a-f0-9]+: f3 0f 1e fa endbr64 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 @@ -25,12 +25,12 @@ Disassembly of section .plt.sec: 0+1f0 <bar1@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1> + +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200338 <bar1> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+200 <bar2@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2> + +[a-f0-9]+: ff 25 36 01 20 00 jmpq \*0x200136\(%rip\) # 200340 <bar2> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d index 0e4f424..4bdf8bd 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibtplt +#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d index e9e5638..54a708d 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d @@ -1,7 +1,42 @@ #source: ibt-plt-2.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibtplt -#readelf: -n +#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv +#readelf: -n -wf + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 00000014 0000001c FDE cie=00000000 pc=00000210..00000222 + DW_CFA_advance_loc: 4 to 00000214 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 0000021d + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 00000020 00000034 FDE cie=00000000 pc=000001c0..000001f0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 000001c6 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 000001d0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + +0+54 00000010 00000058 FDE cie=00000000 pc=000001f0..00000210 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2b.d b/ld/testsuite/ld-x86-64/ibt-plt-2b.d index 604db82..9cd1462 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2b.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2b.d @@ -1,7 +1,46 @@ #source: ibt-plt-2.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibtplt -#readelf: -n +#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 0000000000000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000002e0..00000000000002f2 + DW_CFA_advance_loc: 4 to 00000000000002e4 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 00000000000002ed + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000290..00000000000002c0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 0000000000000296 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 00000000000002a0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+58 0000000000000010 0000005c FDE cie=00000000 pc=00000000000002c0..00000000000002e0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d index e908804..88d6da8 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibt +#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -9,8 +9,8 @@ Disassembly of section .plt: 0+1c0 <.plt>: - +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 62 01 20 00 pushq 0x200162\(%rip\) # 200328 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 64 01 20 00 jmpq \*0x200164\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +[a-f0-9]+: f3 0f 1e fa endbr64 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 @@ -25,12 +25,12 @@ Disassembly of section .plt.sec: 0+1f0 <bar1@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1> + +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200338 <bar1> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+200 <bar2@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2> + +[a-f0-9]+: ff 25 36 01 20 00 jmpq \*0x200136\(%rip\) # 200340 <bar2> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c.d b/ld/testsuite/ld-x86-64/ibt-plt-2c.d index 0ef1131..7502d83 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d @@ -1,6 +1,6 @@ #source: ibt-plt-2.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibt +#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d index b3be904..f22154a 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d @@ -1,7 +1,42 @@ #source: ibt-plt-2.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibt -#readelf: -n +#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv +#readelf: -n -wf + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 00000014 0000001c FDE cie=00000000 pc=00000210..00000222 + DW_CFA_advance_loc: 4 to 00000214 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 0000021d + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 00000020 00000034 FDE cie=00000000 pc=000001c0..000001f0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 000001c6 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 000001d0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + +0+54 00000010 00000058 FDE cie=00000000 pc=000001f0..00000210 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2d.d b/ld/testsuite/ld-x86-64/ibt-plt-2d.d index 7226b69..779f754 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2d.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2d.d @@ -1,7 +1,46 @@ #source: ibt-plt-2.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibt -#readelf: -n +#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 0000000000000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000002e0..00000000000002f2 + DW_CFA_advance_loc: 4 to 00000000000002e4 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 00000000000002ed + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000290..00000000000002c0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 0000000000000296 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 00000000000002a0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+58 0000000000000010 0000005c FDE cie=00000000 pc=00000000000002c0..00000000000002e0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d index 0f7835d..4213689 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibtplt +#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -9,8 +9,8 @@ Disassembly of section .plt: 0+1a0 <.plt>: - +[a-f0-9]+: ff 35 52 01 20 00 pushq 0x200152\(%rip\) # 2002f8 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 54 01 20 00 jmpq \*0x200154\(%rip\) # 200300 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 4a 01 20 00 pushq 0x20014a\(%rip\) # 2002f0 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 4c 01 20 00 jmpq \*0x20014c\(%rip\) # 2002f8 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +[a-f0-9]+: f3 0f 1e fa endbr64 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 @@ -25,12 +25,12 @@ Disassembly of section .plt.sec: 0+1d0 <bar1@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 2e 01 20 00 jmpq \*0x20012e\(%rip\) # 200308 <bar1> + +[a-f0-9]+: ff 25 26 01 20 00 jmpq \*0x200126\(%rip\) # 200300 <bar1> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+1e0 <bar2@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 26 01 20 00 jmpq \*0x200126\(%rip\) # 200310 <bar2> + +[a-f0-9]+: ff 25 1e 01 20 00 jmpq \*0x20011e\(%rip\) # 200308 <bar2> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d index b8f2ebc..7ee2f17 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibtplt +#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d index fb0a834..e55406f 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d @@ -1,5 +1,39 @@ #source: ibt-plt-3.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibtplt -#readelf: -n +#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 00000014 0000001c FDE cie=00000000 pc=000001f0..00000202 + DW_CFA_advance_loc: 4 to 000001f4 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 000001fd + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 00000020 00000034 FDE cie=00000000 pc=000001a0..000001d0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 000001a6 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 000001b0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + +0+54 00000010 00000058 FDE cie=00000000 pc=000001d0..000001f0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3b.d b/ld/testsuite/ld-x86-64/ibt-plt-3b.d index 5a3843b..220371d 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3b.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3b.d @@ -1,5 +1,43 @@ #source: ibt-plt-3.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibtplt -#readelf: -n +#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 0000000000000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000002a0..00000000000002b2 + DW_CFA_advance_loc: 4 to 00000000000002a4 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 00000000000002ad + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000250..0000000000000280 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 0000000000000256 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 0000000000000260 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+58 0000000000000010 0000005c FDE cie=00000000 pc=0000000000000280..00000000000002a0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d index 234944d..2f70d04 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibt +#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv #objdump: -dw .*: +file format .* @@ -9,8 +9,8 @@ Disassembly of section .plt: 0+1c0 <.plt>: - +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 62 01 20 00 pushq 0x200162\(%rip\) # 200328 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 64 01 20 00 jmpq \*0x200164\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) +[a-f0-9]+: f3 0f 1e fa endbr64 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 @@ -25,12 +25,12 @@ Disassembly of section .plt.sec: 0+1f0 <bar1@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1> + +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200338 <bar1> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+200 <bar2@plt>: +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2> + +[a-f0-9]+: ff 25 36 01 20 00 jmpq \*0x200136\(%rip\) # 200340 <bar2> +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c.d b/ld/testsuite/ld-x86-64/ibt-plt-3c.d index b299f22..d0665ae 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d @@ -1,6 +1,6 @@ #source: ibt-plt-3.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibt +#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv #objdump: -dw .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d index 447e811..ceaf75a 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d @@ -1,7 +1,42 @@ #source: ibt-plt-3.s #as: --x32 -#ld: -shared -m elf32_x86_64 -z ibt -#readelf: -n +#ld: -shared -m elf32_x86_64 -z ibt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 00000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 00000014 0000001c FDE cie=00000000 pc=00000210..00000222 + DW_CFA_advance_loc: 4 to 00000214 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 0000021d + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 00000020 00000034 FDE cie=00000000 pc=000001c0..000001f0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 000001c6 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 000001d0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + +0+54 00000010 00000058 FDE cie=00000000 pc=000001f0..00000210 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3d.d b/ld/testsuite/ld-x86-64/ibt-plt-3d.d index 342626a..d5cade0 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3d.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3d.d @@ -1,7 +1,46 @@ #source: ibt-plt-3.s #as: --64 -defsym __64_bit__=1 -#ld: -shared -m elf_x86_64 -z ibt -#readelf: -n +#ld: -shared -m elf_x86_64 -z ibt --hash-style=sysv +#readelf: -wf -n + +Contents of the .eh_frame section: + +0+ 0000000000000014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000002e0..00000000000002f2 + DW_CFA_advance_loc: 4 to 00000000000002e4 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 9 to 00000000000002ed + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000290..00000000000002c0 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 6 to 0000000000000296 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 10 to 00000000000002a0 + DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\) + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0+58 0000000000000010 0000005c FDE cie=00000000 pc=00000000000002c0..00000000000002e0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Displaying notes found in: .note.gnu.property Owner Data size Description diff --git a/ld/testsuite/ld-x86-64/ilp32-11.d b/ld/testsuite/ld-x86-64/ilp32-11.d index f6fc86c..bc6c8a8 100644 --- a/ld/testsuite/ld-x86-64/ilp32-11.d +++ b/ld/testsuite/ld-x86-64/ilp32-11.d @@ -1,3 +1,3 @@ #as: --x32 #ld: -shared -melf32_x86_64 -#error: .*addend 0x7fffffff in relocation R_X86_64_64 against symbol `func' at 0x0 in section `.data.rel.local' is out of range +#error: .*addend 0x7fffffff in relocation R_X86_64_64 against symbol `func' at 0 in section `.data.rel.local' is out of range diff --git a/ld/testsuite/ld-x86-64/ilp32-4-nacl.d b/ld/testsuite/ld-x86-64/ilp32-4-nacl.d index f560ae3..92c1f9c 100644 --- a/ld/testsuite/ld-x86-64/ilp32-4-nacl.d +++ b/ld/testsuite/ld-x86-64/ilp32-4-nacl.d @@ -1,6 +1,6 @@ #source: ilp32-4.s #as: --x32 -#ld: -m elf32_x86_64_nacl -shared --no-ld-generated-unwind-info +#ld: -m elf32_x86_64_nacl -shared --no-ld-generated-unwind-info --hash-style=sysv #readelf: -d -S --wide #target: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/ilp32-4.d b/ld/testsuite/ld-x86-64/ilp32-4.d index 658ad49..00d54c4 100644 --- a/ld/testsuite/ld-x86-64/ilp32-4.d +++ b/ld/testsuite/ld-x86-64/ilp32-4.d @@ -1,5 +1,5 @@ #as: --x32 -#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info +#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv #readelf: -d -S --wide #target: x86_64-*-linux* diff --git a/ld/testsuite/ld-x86-64/load1c-nacl.d b/ld/testsuite/ld-x86-64/load1c-nacl.d index 57bc2c2..1ce80b4 100644 --- a/ld/testsuite/ld-x86-64/load1c-nacl.d +++ b/ld/testsuite/ld-x86-64/load1c-nacl.d @@ -1,6 +1,6 @@ #source: load1.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/load1c.d b/ld/testsuite/ld-x86-64/load1c.d index a4f7d8a..65f7eed 100644 --- a/ld/testsuite/ld-x86-64/load1c.d +++ b/ld/testsuite/ld-x86-64/load1c.d @@ -1,6 +1,6 @@ #source: load1.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/load1d-nacl.d b/ld/testsuite/ld-x86-64/load1d-nacl.d index b741917..19fea1a 100644 --- a/ld/testsuite/ld-x86-64/load1d-nacl.d +++ b/ld/testsuite/ld-x86-64/load1d-nacl.d @@ -1,6 +1,6 @@ #source: load1.s #as: --x32 -#ld: -shared -melf32_x86_64 +#ld: -shared -melf32_x86_64 --hash-style=sysv #objdump: -dw #target: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/load1d.d b/ld/testsuite/ld-x86-64/load1d.d index ee1e3f0..2620c02 100644 --- a/ld/testsuite/ld-x86-64/load1d.d +++ b/ld/testsuite/ld-x86-64/load1d.d @@ -1,6 +1,6 @@ #source: load1.s #as: --x32 -#ld: -shared -melf32_x86_64 +#ld: -shared -melf32_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/mpx.exp b/ld/testsuite/ld-x86-64/mpx.exp index 1ba08e0..e3c0b5e 100644 --- a/ld/testsuite/ld-x86-64/mpx.exp +++ b/ld/testsuite/ld-x86-64/mpx.exp @@ -107,23 +107,23 @@ set run_tests { run_ld_link_tests { {"Build libcall.so" - "-m elf_x86_64 -shared -z bndplt" "" "--64" - {mpx3b.s} {} "libcall.so"} + "-m elf_x86_64 -shared -z bndplt" "" + "--64" {mpx3b.s} {} "libcall.so"} {"Build mpx3" - "-m elf_x86_64 -z bndplt tmpdir/libcall.so" "" "--64" - {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"} + "-m elf_x86_64 -z bndplt tmpdir/libcall.so" "" + "--64" {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"} {"Build libcall1.so" - "-m elf_x86_64 -shared -z bndplt" "" "--64" - {mpx4b.s} {} "libcall1.so"} + "-m elf_x86_64 -shared -z bndplt" "" + "--64" {mpx4b.s} {} "libcall1.so"} {"Build mpx4" - "-m elf_x86_64 -z bndplt tmpdir/libcall1.so" "" "--64" - {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"} + "-m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so" "" + "--64" {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"} {"Build mpx3 (-z now)" - "-z now -m elf_x86_64 -z bndplt tmpdir/libcall.so" "" "--64" - {mpx3a.s} {{objdump -dw mpx3n.dd}} "mpx3n"} + "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall.so" "" + "--64" {mpx3a.s} {{objdump -dw mpx3n.dd}} "mpx3n"} {"Build mpx4 (-z now)" - "-z now -m elf_x86_64 -z bndplt tmpdir/libcall1.so" "" "--64" - {mpx4a.s} {{objdump -dw mpx4n.dd}} "mpx4n"} + "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so" "" + "--64" {mpx4a.s} {{objdump -dw mpx4n.dd}} "mpx4n"} } run_ld_link_exec_tests $run_tests diff --git a/ld/testsuite/ld-x86-64/pie2.d b/ld/testsuite/ld-x86-64/pie2.d index ef9f58a..9532141 100644 --- a/ld/testsuite/ld-x86-64/pie2.d +++ b/ld/testsuite/ld-x86-64/pie2.d @@ -1,3 +1,3 @@ #as: --64 #ld: -pie -melf_x86_64 -#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a shared object; recompile with -fPIC +#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIC diff --git a/ld/testsuite/ld-x86-64/pie3-nacl.d b/ld/testsuite/ld-x86-64/pie3-nacl.d new file mode 100644 index 0000000..efb74ed --- /dev/null +++ b/ld/testsuite/ld-x86-64/pie3-nacl.d @@ -0,0 +1,14 @@ +#source: pie3.s +#as: --64 +#ld: -pie -melf_x86_64 --hash-style=sysv +#objdump: -dw +#target: x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: + +0: 48 8d 05 f9 ff ff ff lea -0x7\(%rip\),%rax # 0 <_start> +#pass diff --git a/ld/testsuite/ld-x86-64/pie3.d b/ld/testsuite/ld-x86-64/pie3.d new file mode 100644 index 0000000..7bc1ccb --- /dev/null +++ b/ld/testsuite/ld-x86-64/pie3.d @@ -0,0 +1,13 @@ +#as: --64 +#ld: -pie -melf_x86_64 --hash-style=sysv +#objdump: -dw +#notarget: x86_64-*-nacl* + +.*: +file format .* + + +Disassembly of section .text: + +0+191 <_start>: + +191: 48 8d 05 68 fe ff ff lea -0x198\(%rip\),%rax # 0 <_start-0x191> +#pass diff --git a/ld/testsuite/ld-x86-64/pie3.s b/ld/testsuite/ld-x86-64/pie3.s new file mode 100644 index 0000000..72914d9 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pie3.s @@ -0,0 +1,5 @@ + .text + .global _start + .weak foo +_start: + leaq foo(%rip), %rax diff --git a/ld/testsuite/ld-x86-64/plt-main-bnd.dd b/ld/testsuite/ld-x86-64/plt-main-bnd.dd index 9e03dfd..c5ef1b3 100644 --- a/ld/testsuite/ld-x86-64/plt-main-bnd.dd +++ b/ld/testsuite/ld-x86-64/plt-main-bnd.dd @@ -1,7 +1,7 @@ #... Disassembly of section .plt.got: -[a-f0-9]+ <[a-z]+@plt>: +[a-f0-9]+ <[a-z_]+@plt>: [ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*> [ ]*[a-f0-9]+: 90 nop #pass diff --git a/ld/testsuite/ld-x86-64/pr14207.d b/ld/testsuite/ld-x86-64/pr14207.d index f6558e7..b71d705 100644 --- a/ld/testsuite/ld-x86-64/pr14207.d +++ b/ld/testsuite/ld-x86-64/pr14207.d @@ -1,6 +1,6 @@ #name: PR ld/14207 #as: --64 -#ld: -melf_x86_64 -shared -z relro -z now +#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv #readelf: -l --wide #target: x86_64-*-linux* diff --git a/ld/testsuite/ld-x86-64/pr17618.d b/ld/testsuite/ld-x86-64/pr17618.d index b090aa0..e640b40 100644 --- a/ld/testsuite/ld-x86-64/pr17618.d +++ b/ld/testsuite/ld-x86-64/pr17618.d @@ -1,5 +1,4 @@ #name: PLT PC-relative offset overflow check #as: --64 #ld: -shared -melf_x86_64 -#notarget: x86_64-*-linux*-gnux32 #error: .*PC-relative offset overflow in PLT entry for `bar' diff --git a/ld/testsuite/ld-x86-64/pr19162.d b/ld/testsuite/ld-x86-64/pr19162.d index 42cd6c3..6916a51 100644 --- a/ld/testsuite/ld-x86-64/pr19162.d +++ b/ld/testsuite/ld-x86-64/pr19162.d @@ -1,7 +1,7 @@ #source: pr19162a.s #source: pr19162b.s #as: --64 -#ld: -melf_x86_64 -shared -z max-page-size=0x200000 -z common-page-size=0x1000 +#ld: -melf_x86_64 -shared -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv #readelf: -l --wide #target: x86_64-*-linux* diff --git a/ld/testsuite/ld-x86-64/pr19609-2a.d b/ld/testsuite/ld-x86-64/pr19609-2a.d index e2c6c89..2bed641 100644 --- a/ld/testsuite/ld-x86-64/pr19609-2a.d +++ b/ld/testsuite/ld-x86-64/pr19609-2a.d @@ -1,4 +1,4 @@ #source: pr19609-2.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 -#error: .*relocation truncated to fit: R_X86_64_32S .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-2b.d b/ld/testsuite/ld-x86-64/pr19609-2b.d index ead4987..3741ebb 100644 --- a/ld/testsuite/ld-x86-64/pr19609-2b.d +++ b/ld/testsuite/ld-x86-64/pr19609-2b.d @@ -1,4 +1,4 @@ #source: pr19609-2.s #as: --x32 -mrelax-relocations=yes #ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 -#error: .*relocation truncated to fit: R_X86_64_32S .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-4a.d b/ld/testsuite/ld-x86-64/pr19609-4a.d index ce952ed..f08843c 100644 --- a/ld/testsuite/ld-x86-64/pr19609-4a.d +++ b/ld/testsuite/ld-x86-64/pr19609-4a.d @@ -1,5 +1,4 @@ #source: pr19609-4.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 -#error: .*relocation truncated to fit: R_X86_64_32S .* -#error: .*relocation truncated to fit: R_X86_64_32S .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-4c.d b/ld/testsuite/ld-x86-64/pr19609-4c.d index ce952ed..f08843c 100644 --- a/ld/testsuite/ld-x86-64/pr19609-4c.d +++ b/ld/testsuite/ld-x86-64/pr19609-4c.d @@ -1,5 +1,4 @@ #source: pr19609-4.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 -#error: .*relocation truncated to fit: R_X86_64_32S .* -#error: .*relocation truncated to fit: R_X86_64_32S .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-4e.d b/ld/testsuite/ld-x86-64/pr19609-4e.d index 527fe5d..f263494 100644 --- a/ld/testsuite/ld-x86-64/pr19609-4e.d +++ b/ld/testsuite/ld-x86-64/pr19609-4e.d @@ -9,5 +9,5 @@ Disassembly of section .text: 0+70000000 <_start>: -[ ]*[a-f0-9]+: 48 8d 05 f9 ff ff 2f lea 0x2ffffff9\(%rip\),%rax # a0000000 <foo> -[ ]*[a-f0-9]+: 4c 8d 1d f2 ff ff 2f lea 0x2ffffff2\(%rip\),%r11 # a0000000 <foo> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <.got> +[ ]*[a-f0-9]+: 4c 8b 1d ([0-9a-f]{2} ){4} * mov [-]?0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.got> diff --git a/ld/testsuite/ld-x86-64/pr19609-5d.d b/ld/testsuite/ld-x86-64/pr19609-5d.d index 959c63e..608c97b 100644 --- a/ld/testsuite/ld-x86-64/pr19609-5d.d +++ b/ld/testsuite/ld-x86-64/pr19609-5d.d @@ -1,4 +1,4 @@ #source: pr19609-5.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 -Ttext=0x80000000 -#error: .*relocation truncated to fit: R_X86_64_PC32 .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-6a.d b/ld/testsuite/ld-x86-64/pr19609-6a.d index 4802ffe..3c011d9 100644 --- a/ld/testsuite/ld-x86-64/pr19609-6a.d +++ b/ld/testsuite/ld-x86-64/pr19609-6a.d @@ -1,4 +1,4 @@ #source: pr19609-6.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 --defsym foobar=0x80000000 -#error: .*relocation truncated to fit: R_X86_64_32S .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-7a.d b/ld/testsuite/ld-x86-64/pr19609-7a.d index d960572..015a6ff 100644 --- a/ld/testsuite/ld-x86-64/pr19609-7a.d +++ b/ld/testsuite/ld-x86-64/pr19609-7a.d @@ -1,4 +1,4 @@ #source: pr19609-7.s #as: --64 -mrelax-relocations=yes #ld: -melf_x86_64 -Ttext=0x80000000 -#error: .*relocation truncated to fit: R_X86_64_PC32 .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19609-7c.d b/ld/testsuite/ld-x86-64/pr19609-7c.d index 8bd919a..ff60049 100644 --- a/ld/testsuite/ld-x86-64/pr19609-7c.d +++ b/ld/testsuite/ld-x86-64/pr19609-7c.d @@ -1,4 +1,4 @@ #source: pr19609-7.s #as: --x32 -mrelax-relocations=yes #ld: -melf32_x86_64 -Ttext=0x80000000 -#error: .*relocation truncated to fit: R_X86_64_PC32 .* +#error: failed to convert GOTPCREL relocation; relink with --no-relax diff --git a/ld/testsuite/ld-x86-64/pr19636-2d-nacl.d b/ld/testsuite/ld-x86-64/pr19636-2d-nacl.d index 1bdbd8c..f584bda 100644 --- a/ld/testsuite/ld-x86-64/pr19636-2d-nacl.d +++ b/ld/testsuite/ld-x86-64/pr19636-2d-nacl.d @@ -1,6 +1,6 @@ #source: pr19636-2.s #as: --64 -mrelax-relocations=no -#ld: -pie -m elf_x86_64 --no-dynamic-linker +#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv #objdump: -dw #target: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr19636-2d.d b/ld/testsuite/ld-x86-64/pr19636-2d.d index 4f5c1f0..6f589ab 100644 --- a/ld/testsuite/ld-x86-64/pr19636-2d.d +++ b/ld/testsuite/ld-x86-64/pr19636-2d.d @@ -1,6 +1,6 @@ #source: pr19636-2.s #as: --64 -mrelax-relocations=no -#ld: -pie -m elf_x86_64 --no-dynamic-linker +#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr19719.d b/ld/testsuite/ld-x86-64/pr19719.d index b2daf0e..03cfc15 100644 --- a/ld/testsuite/ld-x86-64/pr19719.d +++ b/ld/testsuite/ld-x86-64/pr19719.d @@ -1,3 +1,3 @@ #as: --64 #ld: -pie -melf_x86_64 -#error: .*relocation R_X86_64_32 against undefined symbol `foo' can not be used when making a shared object; recompile with -fPIC +#error: .*relocation R_X86_64_32 against undefined symbol `foo' can not be used when making a PIE object; recompile with -fPIC diff --git a/ld/testsuite/ld-x86-64/pr19807-2a.d b/ld/testsuite/ld-x86-64/pr19807-2a.d index 1357d72..c99852a 100644 --- a/ld/testsuite/ld-x86-64/pr19807-2a.d +++ b/ld/testsuite/ld-x86-64/pr19807-2a.d @@ -1,4 +1,4 @@ #source: pr19807-2.s #as: --64 #ld: -pie -melf_x86_64 -#error: .*relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC +#error: .*relocation R_X86_64_32 against `.data' can not be used when making a PIE object; recompile with -fPIC diff --git a/ld/testsuite/ld-x86-64/pr19969.d b/ld/testsuite/ld-x86-64/pr19969.d index c56af2f..1aea67c 100644 --- a/ld/testsuite/ld-x86-64/pr19969.d +++ b/ld/testsuite/ld-x86-64/pr19969.d @@ -1,4 +1,4 @@ #source: pr19969b.S #as: --64 #ld: -melf_x86_64 tmpdir/pr19969.so -#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a shared object; recompile with -fPIC +#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PDE object; recompile with -fPIC diff --git a/ld/testsuite/ld-x86-64/pr20253-1d.d b/ld/testsuite/ld-x86-64/pr20253-1d.d index 6953c79..158178d 100644 --- a/ld/testsuite/ld-x86-64/pr20253-1d.d +++ b/ld/testsuite/ld-x86-64/pr20253-1d.d @@ -1,6 +1,6 @@ #source: pr20253-1.s #as: --64 -#ld: -pie -melf_x86_64 +#ld: -pie -melf_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr20253-1f.d b/ld/testsuite/ld-x86-64/pr20253-1f.d index 9319350..f1ffbab 100644 --- a/ld/testsuite/ld-x86-64/pr20253-1f.d +++ b/ld/testsuite/ld-x86-64/pr20253-1f.d @@ -1,6 +1,6 @@ #source: pr20253-1.s #as: --64 -#ld: -shared -melf_x86_64 +#ld: -shared -melf_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr20253-1j.d b/ld/testsuite/ld-x86-64/pr20253-1j.d index 5662e0c..b22d26a 100644 --- a/ld/testsuite/ld-x86-64/pr20253-1j.d +++ b/ld/testsuite/ld-x86-64/pr20253-1j.d @@ -1,6 +1,6 @@ #source: pr20253-1.s #as: --x32 -#ld: -pie -melf32_x86_64 +#ld: -pie -melf32_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr20253-1l.d b/ld/testsuite/ld-x86-64/pr20253-1l.d index 83a61db..cef309e 100644 --- a/ld/testsuite/ld-x86-64/pr20253-1l.d +++ b/ld/testsuite/ld-x86-64/pr20253-1l.d @@ -1,6 +1,6 @@ #source: pr20253-1.s #as: --x32 -#ld: -shared -melf32_x86_64 +#ld: -shared -melf32_x86_64 --hash-style=sysv #objdump: -dw #notarget: x86_64-*-nacl* diff --git a/ld/testsuite/ld-x86-64/pr20830a-now.d b/ld/testsuite/ld-x86-64/pr20830a-now.d index fda0d50..d2e99ab 100644 --- a/ld/testsuite/ld-x86-64/pr20830a-now.d +++ b/ld/testsuite/ld-x86-64/pr20830a-now.d @@ -1,7 +1,7 @@ #name: PR ld/20830 (.plt.got, -z now) #source: pr20830.s #as: --64 -#ld: -z now -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z now -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr20830a.d b/ld/testsuite/ld-x86-64/pr20830a.d index 3122ba7..8ae6b71 100644 --- a/ld/testsuite/ld-x86-64/pr20830a.d +++ b/ld/testsuite/ld-x86-64/pr20830a.d @@ -1,7 +1,7 @@ #name: PR ld/20830 (.plt.got) #source: pr20830.s #as: --64 -#ld: -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr20830b-now.d b/ld/testsuite/ld-x86-64/pr20830b-now.d index 69120e1..bd9abc4 100644 --- a/ld/testsuite/ld-x86-64/pr20830b-now.d +++ b/ld/testsuite/ld-x86-64/pr20830b-now.d @@ -1,7 +1,7 @@ #name: PR ld/20830 (.plt.got, -z now) #source: pr20830.s #as: --x32 -#ld: -z now -melf32_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z now -melf32_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr20830b.d b/ld/testsuite/ld-x86-64/pr20830b.d index 0bb79a3..83067e0 100644 --- a/ld/testsuite/ld-x86-64/pr20830b.d +++ b/ld/testsuite/ld-x86-64/pr20830b.d @@ -1,7 +1,7 @@ #name: PR ld/20830 (.plt.got) #source: pr20830.s #as: --x32 -#ld: -melf32_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -melf32_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr21038a-now.d b/ld/testsuite/ld-x86-64/pr21038a-now.d index ebc5128..1d5bec1 100644 --- a/ld/testsuite/ld-x86-64/pr21038a-now.d +++ b/ld/testsuite/ld-x86-64/pr21038a-now.d @@ -1,7 +1,7 @@ #name: PR ld/21038 (.plt.got, -z now) #source: pr21038a.s #as: --64 -#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* @@ -41,11 +41,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+58 0000000000000014 0000005c FDE cie=00000000 pc=0000000000000230..0000000000000238 - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop +0+58 0000000000000010 0000005c FDE cie=00000000 pc=0000000000000230..0000000000000238 DW_CFA_nop DW_CFA_nop DW_CFA_nop diff --git a/ld/testsuite/ld-x86-64/pr21038a.d b/ld/testsuite/ld-x86-64/pr21038a.d index 81b26cb..01770ec 100644 --- a/ld/testsuite/ld-x86-64/pr21038a.d +++ b/ld/testsuite/ld-x86-64/pr21038a.d @@ -1,6 +1,6 @@ #name: PR ld/21038 (.plt.got) #as: --64 -#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* @@ -40,11 +40,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+58 0000000000000014 0000005c FDE cie=00000000 pc=0000000000000230..0000000000000238 - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop +0+58 0000000000000010 0000005c FDE cie=00000000 pc=0000000000000230..0000000000000238 DW_CFA_nop DW_CFA_nop DW_CFA_nop diff --git a/ld/testsuite/ld-x86-64/pr21038b-now.d b/ld/testsuite/ld-x86-64/pr21038b-now.d index b9a8c4d..914b123 100644 --- a/ld/testsuite/ld-x86-64/pr21038b-now.d +++ b/ld/testsuite/ld-x86-64/pr21038b-now.d @@ -1,7 +1,7 @@ #name: PR ld/21038 (.plt.sec, -z now) #source: pr21038b.s #as: --64 -#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr21038b.d b/ld/testsuite/ld-x86-64/pr21038b.d index 3457d4d..faeaf45 100644 --- a/ld/testsuite/ld-x86-64/pr21038b.d +++ b/ld/testsuite/ld-x86-64/pr21038b.d @@ -1,6 +1,6 @@ #name: PR ld/21038 (.plt.sec) #as: --64 -#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr21038c-now.d b/ld/testsuite/ld-x86-64/pr21038c-now.d index 4b6db6f..640e821 100644 --- a/ld/testsuite/ld-x86-64/pr21038c-now.d +++ b/ld/testsuite/ld-x86-64/pr21038c-now.d @@ -1,7 +1,7 @@ #name: PR ld/21038 (.plt.got and .plt.sec, -z now) #source: pr21038c.s #as: --64 -#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z now -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr21038c.d b/ld/testsuite/ld-x86-64/pr21038c.d index eb6f207..4b0bd89 100644 --- a/ld/testsuite/ld-x86-64/pr21038c.d +++ b/ld/testsuite/ld-x86-64/pr21038c.d @@ -1,6 +1,6 @@ #name: PR ld/21038 (.plt.got and .plt.sec) #as: --64 -#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info +#ld: -z bndplt -melf_x86_64 -shared -z relro --ld-generated-unwind-info --hash-style=sysv #objdump: -dw -Wf .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/pr21884-nacl.d b/ld/testsuite/ld-x86-64/pr21884-nacl.d new file mode 100644 index 0000000..8883505 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21884-nacl.d @@ -0,0 +1,10 @@ +#source: dummy.s +#as: --64 +#ld: -m elf_x86_64 -T pr21884-nacl.t -b binary +#objdump: -b binary -s +#target: x86_64-*-nacl* + +.*: file format binary + +Contents of section .data: +#pass diff --git a/ld/testsuite/ld-x86-64/pr21884-nacl.t b/ld/testsuite/ld-x86-64/pr21884-nacl.t new file mode 100644 index 0000000..722312e --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21884-nacl.t @@ -0,0 +1,11 @@ +OUTPUT_FORMAT("elf64-x86-64-nacl"); +OUTPUT_ARCH(i386:x86-64); + +ENTRY(_start); +SECTIONS { + . = 0x10000; + _start = . ; + .data : { + *(.data) + } +} diff --git a/ld/testsuite/ld-x86-64/pr21884.d b/ld/testsuite/ld-x86-64/pr21884.d new file mode 100644 index 0000000..7a2a3f3 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21884.d @@ -0,0 +1,10 @@ +#source: dummy.s +#as: --64 +#ld: -m elf_x86_64 -T pr21884.t -b binary +#objdump: -b binary -s +#notarget: x86_64-*-nacl* + +.*: file format binary + +Contents of section .data: +#pass diff --git a/ld/testsuite/ld-x86-64/pr21884.t b/ld/testsuite/ld-x86-64/pr21884.t new file mode 100644 index 0000000..edd2070 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21884.t @@ -0,0 +1,11 @@ +OUTPUT_FORMAT("elf64-x86-64"); +OUTPUT_ARCH(i386:x86-64); + +ENTRY(_start); +SECTIONS { + . = 0x10000; + _start = . ; + .data : { + *(.data) + } +} diff --git a/ld/testsuite/ld-x86-64/pr21997-1a.S b/ld/testsuite/ld-x86-64/pr21997-1a.S new file mode 100644 index 0000000..cab99a9 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21997-1a.S @@ -0,0 +1,24 @@ + .text + .p2align 4,,15 + .globl get_protected + .type get_protected, @function +get_protected: + movl protected(%rip), %eax + ret + .size get_protected, .-get_protected + .p2align 4,,15 + .globl get_protected_p + .type get_protected_p, @function +get_protected_p: + leaq protected(%rip), %rax + ret + .size get_protected_p, .-get_protected_p + .protected protected + .globl protected + .data + .align 4 + .type protected, @object + .size protected, 4 +protected: + .long 1 + .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-x86-64/pr21997-1a.err b/ld/testsuite/ld-x86-64/pr21997-1a.err new file mode 100644 index 0000000..5d663a3 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21997-1a.err @@ -0,0 +1,2 @@ +.*relocation R_X86_64_PC32 against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC +#... diff --git a/ld/testsuite/ld-x86-64/pr21997-1b.c b/ld/testsuite/ld-x86-64/pr21997-1b.c new file mode 100644 index 0000000..ffed117 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21997-1b.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +extern int protected; +extern int get_protected (void); + +int +main () +{ + if (protected == get_protected ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-x86-64/pr21997-1b.err b/ld/testsuite/ld-x86-64/pr21997-1b.err new file mode 100644 index 0000000..365de67 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21997-1b.err @@ -0,0 +1,2 @@ +.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC +#... diff --git a/ld/testsuite/ld-x86-64/pr21997-1c.c b/ld/testsuite/ld-x86-64/pr21997-1c.c new file mode 100644 index 0000000..6d7b9dc --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr21997-1c.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +extern int protected; +extern int* get_protected_p (void); + +int +main () +{ + if (&protected == get_protected_p ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-x86-64/pr22001-1a.c b/ld/testsuite/ld-x86-64/pr22001-1a.c new file mode 100644 index 0000000..2b55ea8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22001-1a.c @@ -0,0 +1,13 @@ +int copy = 1; + +int +get_copy () +{ + return copy; +} + +int * +get_copy_p () +{ + return © +} diff --git a/ld/testsuite/ld-x86-64/pr22001-1a.err b/ld/testsuite/ld-x86-64/pr22001-1a.err new file mode 100644 index 0000000..640aa07 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22001-1a.err @@ -0,0 +1,2 @@ +.*relocation R_X86_64_PC32 against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC +#... diff --git a/ld/testsuite/ld-x86-64/pr22001-1b.c b/ld/testsuite/ld-x86-64/pr22001-1b.c new file mode 100644 index 0000000..a172236 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22001-1b.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +extern int copy; +extern int get_copy (void); + +int +main () +{ + if (copy == get_copy ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-x86-64/pr22001-1b.err b/ld/testsuite/ld-x86-64/pr22001-1b.err new file mode 100644 index 0000000..9617e73 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22001-1b.err @@ -0,0 +1,2 @@ +.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC +#... diff --git a/ld/testsuite/ld-x86-64/pr22001-1c.c b/ld/testsuite/ld-x86-64/pr22001-1c.c new file mode 100644 index 0000000..8fd925c --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22001-1c.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +extern int copy; +extern int* get_copy_p (void); + +int main() +{ + if (© == get_copy_p ()) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-x86-64/pr22048.d b/ld/testsuite/ld-x86-64/pr22048.d new file mode 100644 index 0000000..063d305 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22048.d @@ -0,0 +1,25 @@ +#source: pr22048a.s +#source: pr22048b.s +#as: --64 +#ld: -melf_x86_64 -Ttext 0x400078 +#readelf: -wf + +Contents of the .eh_frame section: + +0+0000 0+014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0010 0+001c FDE cie=0+0000 pc=0+400078\.\.0+40007a + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop diff --git a/ld/testsuite/ld-x86-64/pr22048a.s b/ld/testsuite/ld-x86-64/pr22048a.s new file mode 100644 index 0000000..060bd01 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22048a.s @@ -0,0 +1,4 @@ + .section .eh_frame,"a",@progbits + .align 4 + .zero 4 + .ident "GCC" diff --git a/ld/testsuite/ld-x86-64/pr22048b.s b/ld/testsuite/ld-x86-64/pr22048b.s new file mode 100644 index 0000000..eae6752 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22048b.s @@ -0,0 +1,8 @@ + .text + .globl _start + .type _start, @function +_start: + .cfi_startproc + rep ret + .cfi_endproc + .size _start, .-_start diff --git a/ld/testsuite/ld-x86-64/pr22064a.S b/ld/testsuite/ld-x86-64/pr22064a.S new file mode 100644 index 0000000..8065a11 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22064a.S @@ -0,0 +1,33 @@ + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "PASS" + .text + .globl main + .type main, @function +main: + movq foo@GOTPCREL(%rip), %rax + cmpl $0, (%rax) + jne .L4 + subq $8, %rsp + call foo_p@PLT + cmpq foo@GOTPCREL(%rip), %rax + jne .L2 + movq bar@GOTPCREL(%rip), %rax + cmpl $-1, (%rax) + jne .L2 + call bar_p@PLT + cmpq bar@GOTPCREL(%rip), %rax + jne .L2 + leaq .LC0(%rip), %rdi + call puts@PLT +.L2: + movl $0, %eax + addq $8, %rsp + ret +.L4: + movl $0, %eax + ret + .size main, .-main + .comm bar,8,4 + .comm foo,4,4 + .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-x86-64/pr22064b.c b/ld/testsuite/ld-x86-64/pr22064b.c new file mode 100644 index 0000000..d906545 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22064b.c @@ -0,0 +1,14 @@ +int foo[2]; +int bar[2] = { -1, -1 }; + +int * +foo_p (void) +{ + return foo; +} + +int * +bar_p (void) +{ + return bar; +} diff --git a/ld/testsuite/ld-x86-64/pr22071.d b/ld/testsuite/ld-x86-64/pr22071.d new file mode 100644 index 0000000..741a722 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22071.d @@ -0,0 +1,8 @@ +#as: --64 +#ld: -melf_x86_64 -shared +#readelf: -d --wide + +#... +.*\(TLSDESC_PLT\).* +.*\(TLSDESC_GOT\).* +#pass diff --git a/ld/testsuite/ld-x86-64/pr22071.s b/ld/testsuite/ld-x86-64/pr22071.s new file mode 100644 index 0000000..0e0b4e0 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22071.s @@ -0,0 +1,78 @@ + .text + .p2align 4,,15 + .globl get_ld + .type get_ld, @function +get_ld: + subq $8, %rsp + leaq _TLS_MODULE_BASE_@TLSDESC(%rip), %rax + call *_TLS_MODULE_BASE_@TLSCALL(%rax) + addq $8, %rsp + addq $ld@dtpoff, %rax + addq %fs:0, %rax + ret + .size get_ld, .-get_ld + .p2align 4,,15 + .globl set_ld + .type set_ld, @function +set_ld: + subq $8, %rsp + leaq _TLS_MODULE_BASE_@TLSDESC(%rip), %rax + call *_TLS_MODULE_BASE_@TLSCALL(%rax) + movl %edi, %fs:ld@dtpoff(%rax) + addq $8, %rsp + ret + .size set_ld, .-set_ld + .p2align 4,,15 + .globl test_ld + .type test_ld, @function +test_ld: + subq $8, %rsp + leaq _TLS_MODULE_BASE_@TLSDESC(%rip), %rax + call *_TLS_MODULE_BASE_@TLSCALL(%rax) + cmpl %edi, %fs:ld@dtpoff(%rax) + sete %al + addq $8, %rsp + movzbl %al, %eax + ret + .size test_ld, .-test_ld + .p2align 4,,15 + .globl get_gd + .type get_gd, @function +get_gd: + subq $8, %rsp + leaq gd@TLSDESC(%rip), %rax + call *gd@TLSCALL(%rax) + addq $8, %rsp + addq %fs:0, %rax + ret + .size get_gd, .-get_gd + .p2align 4,,15 + .globl set_gd + .type set_gd, @function +set_gd: + subq $8, %rsp + leaq gd@TLSDESC(%rip), %rax + call *gd@TLSCALL(%rax) + movl %edi, %fs:(%rax) + addq $8, %rsp + ret + .size set_gd, .-set_gd + .p2align 4,,15 + .globl test_gd + .type test_gd, @function +test_gd: + subq $8, %rsp + leaq gd@TLSDESC(%rip), %rax + call *gd@TLSCALL(%rax) + cmpl %edi, %fs:(%rax) + sete %al + addq $8, %rsp + movzbl %al, %eax + ret + .size test_gd, .-test_gd + .section .tbss,"awT",@nobits + .align 4 + .type ld, @object + .size ld, 4 +ld: + .zero 4 diff --git a/ld/testsuite/ld-x86-64/pr22115-1.s b/ld/testsuite/ld-x86-64/pr22115-1.s new file mode 100644 index 0000000..8c01e50 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1.s @@ -0,0 +1,7 @@ + .text + .globl _start + .type _start, @function +_start: + movq __ehdr_start@GOTPCREL(%rip), %rax + .size _start, .-_start + .weak __ehdr_start diff --git a/ld/testsuite/ld-x86-64/pr22115-1a-x32.d b/ld/testsuite/ld-x86-64/pr22115-1a-x32.d new file mode 100644 index 0000000..8232589 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1a-x32.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --x32 -mrelax-relocations=yes +#ld: -pie -z text -m elf32_x86_64 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start> +#pass diff --git a/ld/testsuite/ld-x86-64/pr22115-1a.d b/ld/testsuite/ld-x86-64/pr22115-1a.d new file mode 100644 index 0000000..43dc787 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1a.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --64 -mrelax-relocations=yes +#ld: -pie -z text -m elf_x86_64 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start> +#pass diff --git a/ld/testsuite/ld-x86-64/pr22115-1b-x32.d b/ld/testsuite/ld-x86-64/pr22115-1b-x32.d new file mode 100644 index 0000000..949dc5f --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1b-x32.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --x32 -mrelax-relocations=yes +#ld: -pie -z text -m elf32_x86_64 +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-x86-64/pr22115-1b.d b/ld/testsuite/ld-x86-64/pr22115-1b.d new file mode 100644 index 0000000..f1aaf72 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1b.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --64 -mrelax-relocations=yes +#ld: -pie -z text -m elf_x86_64 +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-x86-64/pr22115-1c-x32.d b/ld/testsuite/ld-x86-64/pr22115-1c-x32.d new file mode 100644 index 0000000..384f8f4 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1c-x32.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --x32 -mrelax-relocations=yes +#ld: -pie -z text -m elf32_x86_64 --no-dynamic-linker +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start> +#pass diff --git a/ld/testsuite/ld-x86-64/pr22115-1c.d b/ld/testsuite/ld-x86-64/pr22115-1c.d new file mode 100644 index 0000000..ac147f8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1c.d @@ -0,0 +1,13 @@ +#source: pr22115-1.s +#as: --64 -mrelax-relocations=yes +#ld: -pie -z text -m elf_x86_64 --no-dynamic-linker +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +[a-f0-9]+ <_start>: + +[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start> +#pass diff --git a/ld/testsuite/ld-x86-64/pr22115-1d-x32.d b/ld/testsuite/ld-x86-64/pr22115-1d-x32.d new file mode 100644 index 0000000..755c827 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1d-x32.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --x32 -mrelax-relocations=yes +#ld: -pie -z text -m elf32_x86_64 --no-dynamic-linker +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-x86-64/pr22115-1d.d b/ld/testsuite/ld-x86-64/pr22115-1d.d new file mode 100644 index 0000000..2cb1c65 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22115-1d.d @@ -0,0 +1,6 @@ +#source: pr22115-1.s +#as: --64 -mrelax-relocations=yes +#ld: -pie -z text -m elf_x86_64 --no-dynamic-linker +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-x86-64/pr22135.d b/ld/testsuite/ld-x86-64/pr22135.d new file mode 100644 index 0000000..2cd6861 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22135.d @@ -0,0 +1,12 @@ +#as: --64 +#ld: -pie -melf_x86_64 --no-keep-memory +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <foo> +#pass diff --git a/ld/testsuite/ld-x86-64/pr22135.s b/ld/testsuite/ld-x86-64/pr22135.s new file mode 100644 index 0000000..f4dff5c --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22135.s @@ -0,0 +1,11 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl _start + .type _start, @function +_start: + movl foo@GOTPCREL(%rip), %eax + .size _start, .-_start diff --git a/ld/testsuite/ld-x86-64/protected8.d b/ld/testsuite/ld-x86-64/protected8.d new file mode 100644 index 0000000..22a36ac --- /dev/null +++ b/ld/testsuite/ld-x86-64/protected8.d @@ -0,0 +1,13 @@ +#as: --64 +#ld: -shared -melf_x86_64 +#objdump: -drw + +.*: +file format .* + + +Disassembly of section .text: + +0+[a-f0-9]+ <bar>: +[ ]*[a-f0-9]+: 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: c3 retq * +#pass diff --git a/ld/testsuite/ld-x86-64/protected8.s b/ld/testsuite/ld-x86-64/protected8.s new file mode 100644 index 0000000..314433d --- /dev/null +++ b/ld/testsuite/ld-x86-64/protected8.s @@ -0,0 +1,31 @@ + .protected foo +.globl foo + .data + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 1 + .text +.globl bar + .type bar, @function +bar: + movl foo(%rip), %eax + ret + .size bar, .-bar + + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length. */ + .long 3f - 2f /* data length. */ + /* NT_GNU_PROPERTY_TYPE_0 */ + .long 5 /* note type. */ +0: .asciz "GNU" /* vendor name. */ +1: + .p2align 3 +2: + /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */ + .long 2 /* pr_type. */ + .long 0 /* pr_datasz. */ + .p2align 3 +3: diff --git a/ld/testsuite/ld-x86-64/tls.exp b/ld/testsuite/ld-x86-64/tls.exp index 4263d95..7896451 100644 --- a/ld/testsuite/ld-x86-64/tls.exp +++ b/ld/testsuite/ld-x86-64/tls.exp @@ -206,17 +206,31 @@ if { ![check_gnu2_tls_available] } { return } +if { [at_least_gcc_version 5 0] } { + run_ld_link_exec_tests [list \ + [list \ + "Run tlsdesc1" \ + "-Wl,--no-as-needed tmpdir/libtlsdesc1.so" \ + "" \ + { tlsdesc1a.c } \ + "tlsdesc1a" \ + "pass.out" \ + "$GNU2_CFLAGS" \ + ] \ + [list \ + "Run tlsdesc1 with PIE" \ + "-pie -Wl,--no-as-needed tmpdir/libtlsdesc1.so" \ + "" \ + { tlsdesc1a.c } \ + "tlsdesc1c" \ + "pass.out" \ + "-fPIE $GNU2_CFLAGS" \ + ] \ + ] +} + run_ld_link_exec_tests [list \ [list \ - "Run tlsdesc1" \ - "-Wl,--no-as-needed tmpdir/libtlsdesc1.so" \ - "" \ - { tlsdesc1a.c } \ - "tlsdesc1a" \ - "pass.out" \ - "$GNU2_CFLAGS" \ - ] \ - [list \ "Run tlsdesc1 (-z now)" \ "-Wl,-z,now -Wl,--no-as-needed tmpdir/libtlsdesc1n.so" \ "" \ @@ -226,15 +240,6 @@ run_ld_link_exec_tests [list \ "$GNU2_CFLAGS" \ ] \ [list \ - "Run tlsdesc1 with PIE" \ - "-pie -Wl,--no-as-needed tmpdir/libtlsdesc1.so" \ - "" \ - { tlsdesc1a.c } \ - "tlsdesc1c" \ - "pass.out" \ - "-fPIE $GNU2_CFLAGS" \ - ] \ - [list \ "Run tlsdesc1 with PIE (-z now)" \ "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/libtlsdesc1n.so" \ "" \ diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 9b83e1c..676d44a 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -50,20 +50,20 @@ set x86_64tests { "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s} {{objdump -drj.plt plt.pd}} "plt"} {"TLS -fpic -shared transitions" - "-shared -melf_x86_64 --no-ld-generated-unwind-info" "" + "-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" "" "--64" {tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} "libtlspic.so"} {"TLS -fpic -shared transitions with r15 as GOT base" - "-shared -melf_x86_64 --no-ld-generated-unwind-info" "" + "-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" "" "--64 -mrelax-relocations=yes" {tlspic3.s tlspic2.s} {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd} {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}} "libtlspic2.so"} {"TLS descriptor -fpic -shared transitions" - "-shared -melf_x86_64 --no-ld-generated-unwind-info" "" + "-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" "" "--64" {tlsdesc.s tlspic2.s} {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd} {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td} @@ -71,25 +71,25 @@ set x86_64tests { {"Helper shared library" "-shared -melf_x86_64" "" "--64" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec transitions" - "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "--64" {tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} {"TLS -fpic and -fno-pic exec transitions without PLT" - "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "-mrelax-relocations=yes --64" {tlsbinpic2.s tlsbin.s} {{readelf -WSsrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd} {objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}} "tlsbin2"} {"TLS descriptor -fpic and -fno-pic exec transitions" - "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info" "" + "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" "" "--64" {tlsbindesc.s tlsbin.s} {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} "tlsbindesc"} {"TLS with global dynamic and descriptors" - "-shared -melf_x86_64 --no-ld-generated-unwind-info" "" + "-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" "" "--64" {tlsgdesc.s} {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text\ -Mintel64 tlsgdesc.dd}} "libtlsgdesc.so"} @@ -291,6 +291,7 @@ run_dump_test "protected6a" run_dump_test "protected6b" run_dump_test "protected7a" run_dump_test "protected7b" +run_dump_test "protected8" run_dump_test "tlsle1" run_dump_test "tlspie1" run_dump_test "tlspie2a" @@ -310,6 +311,8 @@ run_dump_test "pr14207" run_dump_test "gotplt1" run_dump_test "pie1" run_dump_test "pie2" +run_dump_test "pie3" +run_dump_test "pie3-nacl" run_dump_test "pic1" run_dump_test "largecomm-1a" run_dump_test "largecomm-1b" @@ -363,6 +366,18 @@ run_dump_test "property-x86-shstk4" run_dump_test "property-x86-shstk4-x32" run_dump_test "property-x86-shstk5" run_dump_test "property-x86-shstk5-x32" +run_dump_test "pr21884" +run_dump_test "pr21884-nacl" +run_dump_test "pr22071" +run_dump_test "pr22115-1a" +run_dump_test "pr22115-1a-x32" +run_dump_test "pr22115-1b" +run_dump_test "pr22115-1b-x32" +run_dump_test "pr22115-1c" +run_dump_test "pr22115-1c-x32" +run_dump_test "pr22115-1d" +run_dump_test "pr22115-1d-x32" +run_dump_test "pr22135" if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} { return @@ -565,6 +580,7 @@ run_dump_test "pr20253-4f" run_dump_test "pr20253-5a" run_dump_test "pr20253-5b" run_dump_test "tlsdesc2" +run_dump_test "pr22048" proc undefined_weak {cflags ldflags} { set testname "Undefined weak symbol" @@ -572,8 +588,8 @@ proc undefined_weak {cflags ldflags} { set testname "$testname ($cflags $ldflags)" } - if { [ regexp "\-fPIE" $cflags] - && ![ regexp "nodynamic-undefined-weak" $ldflags] } { + if { [string match "*-fPIE*" $cflags] + && ![string match "*nodynamic-undefined-weak*" $ldflags] } { set weak_symbol "Weak defined" } else { set weak_symbol "Weak undefined" @@ -1035,8 +1051,96 @@ if { [isnative] && [which $CC] != 0 } { {{readelf {-n} property-7.r}} \ "property-7b.o" \ ] \ + [list \ + "Build pr22001-1.so" \ + "-shared" \ + "-fPIC" \ + { pr22001-1a.c } \ + {} \ + "pr22001-1.so" \ + ] \ + [list \ + "Build pr22001-1a" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "$NOPIE_CFLAGS" \ + { pr22001-1b.c } \ + {{error_output "pr22001-1a.err"}} \ + "pr22001-1a" \ + ] \ + [list \ + "Build pr21997-1.so" \ + "-shared" \ + "" \ + { property-stack.S property-no-copy.S pr21997-1a.S } \ + {} \ + "pr21997-1.so" \ + ] \ + [list \ + "Build pr21997-1a" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "$NOPIE_CFLAGS" \ + { pr21997-1b.c } \ + {{error_output "pr21997-1a.err"}} \ + "pr21997-1a" \ + ] \ + [list \ + "Build pr22064a.o" \ + "" \ + "" \ + { pr22064a.S } \ + ] \ + [list \ + "Build pr22064.so" \ + "-shared" \ + "-fPIC" \ + { pr22064b.c } \ + {} \ + "pr22064.so" \ + ] \ ] + if {[istarget "x86_64-*-linux*-gnux32"]} { + run_ld_link_exec_tests [list \ + [list \ + "Run pr22001-1b" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1c.c } \ + "pr22001-1b" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run pr21997-1b" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1c.c } \ + "pr21997-1b" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + ] + } else { + run_cc_link_tests [list \ + [list \ + "Build pr22001-1b" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "$NOPIE_CFLAGS" \ + { pr22001-1c.c } \ + {{error_output "pr22001-1b.err"}} \ + "pr22001-1b" \ + ] \ + [list \ + "Build pr21997-1b" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "$NOPIE_CFLAGS" \ + { pr21997-1c.c } \ + {{error_output "pr21997-1b.err"}} \ + "pr21997-1b" \ + ] \ + ] + } + run_ld_link_exec_tests [list \ [list \ "Run plt-main" \ @@ -1211,6 +1315,87 @@ if { [isnative] && [which $CC] != 0 } { {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ "property-5-static" "pass.out" \ ] \ + [list \ + "Run pr22001-1a (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1b.c } \ + "pr22001-1a-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr22001-1a (PIC 2)" \ + "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1b.c } \ + "pr22001-1a-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr22001-1b (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1c.c } \ + "pr22001-1b-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr22001-1b (PIC 2)" \ + "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ + "" \ + { pr22001-1c.c } \ + "pr22001-1b-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1a (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1b.c } \ + "pr21997-1a-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1a (PIC 2)" \ + "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1b.c } \ + "pr21997-1a-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1b (PIC 1)" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1c.c } \ + "pr21997-1b-pic-1" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr21997-1b (PIC 2)" \ + "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ + "" \ + { pr21997-1c.c } \ + "pr21997-1b-pic-2" \ + "pass.out" \ + "-fPIC" \ + ] \ + [list \ + "Run pr22064" \ + "-pie -Wl,--no-as-needed tmpdir/pr22064a.o tmpdir/pr22064.so" \ + "" \ + { dummy.s } \ + "pr22064-pie" \ + "pass.out" \ + "-fPIE" \ + ] \ ] # Run-time tests which require working ifunc attribute support. @@ -1542,7 +1727,7 @@ if { ![istarget "x86_64-*-linux*"]} { run_ld_link_tests [list \ [list \ "basic PLT generation (-z now)" \ - "-z now -melf_x86_64 tmpdir/libpltlib.so" \ + "-z now -melf_x86_64 --hash-style=sysv tmpdir/libpltlib.so" \ "" \ "--64" \ {plt2.s} \ @@ -1570,7 +1755,11 @@ run_ld_link_tests [list \ ] # Linux only tests -run_dump_test "pr17618" +global LD_CLASS +if { "$LD_CLASS" == "64bit" } then { + # This test needs 64-bit linker. + run_dump_test "pr17618" +} run_dump_test "pltgot-1" run_dump_test "pltgot-2" run_dump_test "pr20830a" diff --git a/ld/testsuite/ld-xtensa/xtensa.exp b/ld/testsuite/ld-xtensa/xtensa.exp index 750979b..487abbc 100644 --- a/ld/testsuite/ld-xtensa/xtensa.exp +++ b/ld/testsuite/ld-xtensa/xtensa.exp @@ -34,7 +34,8 @@ if { !([istarget "xtensa*-*-linux*"]) } { set xtensatests { {"TLS -shared transitions" - "-shared -melf32xtensa" "" "" {tlspic1.s tlspic2.s} + "-shared -melf32xtensa --hash-style=sysv" "" + "" {tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump "-drj.text --start-address=0x350" tlspic.dd} {objdump "-sj.text --stop-address=0x350" tlspic.sd} @@ -43,7 +44,8 @@ set xtensatests { {"Helper shared library" "-shared -melf32xtensa" "" "" {tlslib.s} {} "libtlslib.so"} {"TLS exec transitions" - "-melf32xtensa tmpdir/libtlslib.so" "" "" {tlsbin.s} + "-melf32xtensa tmpdir/libtlslib.so --hash-style=sysv" "" + "" {tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump "-drj.text --start-address=0x400238" tlsbin.dd} {objdump "-sj.text --stop-address=0x400238" tlsbin.sd} diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index cddcaf8..c240410 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -976,7 +976,7 @@ proc run_dump_test { name {extra_options {}} } { && (($cmdret == 0) == ($check_ld(terminal) == 0)) \ && ((($check_ld(source) == "regex") \ && ($check_ld(regex) == "") == ($comp_output == "") \ - && [regexp $check_ld(regex) $comp_output]) \ + && [regexp -- $check_ld(regex) $comp_output]) \ || (($check_ld(source) == "file") \ && (![regexp_diff "tmpdir/ld.messages" "$srcdir/$subdir/$check_ld(file)"]))) } { # We have the expected output from ld. |