From d7309e48b657e5f6460549e6e425fe14d602432c Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 5 Jan 2012 15:17:18 +0000 Subject: [PATCH] * ld-x86-64/x86-64.exp: Add test of linking mixed 32-bit and 64-bit objects when the 32-bit object (loaded first) contains 32+ local symbols, all referenced by relocs and the 64-bit object contains a reloc that uses a symbol in the 32-bit object. * 32bit.s: New source file. * 64bit.s: New source file. * incompatible.l: New expected linker output file. --- ld/testsuite/ChangeLog | 9 ++++ ld/testsuite/ld-x86-64/32bit.s | 78 +++++++++++++++++++++++++++ ld/testsuite/ld-x86-64/64bit.s | 4 ++ ld/testsuite/ld-x86-64/incompatible.l | 1 + ld/testsuite/ld-x86-64/x86-64.exp | 4 ++ 5 files changed, 96 insertions(+) create mode 100644 ld/testsuite/ld-x86-64/32bit.s create mode 100644 ld/testsuite/ld-x86-64/64bit.s create mode 100644 ld/testsuite/ld-x86-64/incompatible.l diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 555390bcb02..655919ac4ce 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-01-05 Nick Clifton + + * ld-x86-64/x86-64.exp: Add test of linking mixed 32-bit and + 64-bit objects when the 32-bit object (loaded first) contains 32+ + local symbols, all referenced by relocs and the 64-bit object + contains a reloc that uses a symbol in the 32-bit object. + * 32bit.s: New source file. + * 64bit.s: New source file. + * incompatible.l: New expected linker output file. For older changes see ChangeLog-2011 diff --git a/ld/testsuite/ld-x86-64/32bit.s b/ld/testsuite/ld-x86-64/32bit.s new file mode 100644 index 00000000000..2547a8b88f9 --- /dev/null +++ b/ld/testsuite/ld-x86-64/32bit.s @@ -0,0 +1,78 @@ + + .section .rodata.str1.1,"aMS",@progbits,1 + +.LC0: .word 1 +.LC1: .word 2 +.LC2: .word 3 +.LC3: .word 4 +.LC4: .word 5 +.LC5: .word 6 +.LC6: .word 7 +.LC7: .word 8 +.LC8: .word 9 +.LC9: .word 10 +.LC10: .word 11 +.LC11: .word 12 +.LC12: .word 13 +.LC13: .word 14 +.LC14: .word 15 +.LC15: .word 16 +.LC16: .word 17 +.LC17: .word 18 +.LC18: .word 19 +.LC19: .word 20 +.LC20: .word 21 +.LC21: .word 22 +.LC22: .word 23 +.LC23: .word 24 +.LC24: .word 25 +.LC25: .word 26 +.LC26: .word 27 +.LC27: .word 28 +.LC28: .word 29 +.LC29: .word 30 +.LC30: .word 31 +.LC31: .word 32 +.LC32: .word 33 +.LC33: .word 34 + + .text + .p2align 4,,15 + .globl foo + .type foo, @function +foo: + + leal .LC0@GOTOFF(%ecx), %eax + leal .LC1@GOTOFF(%ecx), %eax + leal .LC2@GOTOFF(%ecx), %eax + leal .LC3@GOTOFF(%ecx), %eax + leal .LC4@GOTOFF(%ecx), %eax + leal .LC5@GOTOFF(%ecx), %eax + leal .LC6@GOTOFF(%ecx), %eax + leal .LC7@GOTOFF(%ecx), %eax + leal .LC8@GOTOFF(%ecx), %eax + leal .LC9@GOTOFF(%ecx), %eax + leal .LC10@GOTOFF(%ecx), %eax + leal .LC11@GOTOFF(%ecx), %eax + leal .LC12@GOTOFF(%ecx), %eax + leal .LC13@GOTOFF(%ecx), %eax + leal .LC14@GOTOFF(%ecx), %eax + leal .LC15@GOTOFF(%ecx), %eax + leal .LC16@GOTOFF(%ecx), %eax + leal .LC17@GOTOFF(%ecx), %eax + leal .LC18@GOTOFF(%ecx), %eax + leal .LC19@GOTOFF(%ecx), %eax + leal .LC20@GOTOFF(%ecx), %eax + leal .LC21@GOTOFF(%ecx), %eax + leal .LC22@GOTOFF(%ecx), %eax + leal .LC23@GOTOFF(%ecx), %eax + leal .LC24@GOTOFF(%ecx), %eax + leal .LC25@GOTOFF(%ecx), %eax + leal .LC26@GOTOFF(%ecx), %eax + leal .LC27@GOTOFF(%ecx), %eax + leal .LC28@GOTOFF(%ecx), %eax + leal .LC29@GOTOFF(%ecx), %eax + leal .LC30@GOTOFF(%ecx), %eax + leal .LC31@GOTOFF(%ecx), %eax + leal .LC32@GOTOFF(%ecx), %eax + leal .LC33@GOTOFF(%ecx), %eax diff --git a/ld/testsuite/ld-x86-64/64bit.s b/ld/testsuite/ld-x86-64/64bit.s new file mode 100644 index 00000000000..3e741f71b0d --- /dev/null +++ b/ld/testsuite/ld-x86-64/64bit.s @@ -0,0 +1,4 @@ + .text +bar: + call foo + diff --git a/ld/testsuite/ld-x86-64/incompatible.l b/ld/testsuite/ld-x86-64/incompatible.l new file mode 100644 index 00000000000..2f55de1b815 --- /dev/null +++ b/ld/testsuite/ld-x86-64/incompatible.l @@ -0,0 +1 @@ +.*incompatible.* diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 77b081ba46b..e493278694d 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -111,6 +111,10 @@ set x86_64tests { {"TLS X32 LD->LE transition" "-melf32_x86_64" "--x32" {tlsld2.s} {{objdump -dwr tlsld2.dd}} "tlsld2"} + + {"build 32-bit object with 33 locals" "-e 0" "--32" {32bit.s} {{ ld incompatible.l }} "dummy" } + {"build 64-bit object" "-e 0 --defsym foo=1" "--64" {64bit.s} {} "dummy" } + {"link mixed objects" "-e 0 tmpdir/32bit.o tmpdir/64bit.o" "" {} { { ld incompatible.l } } "mixed"} } run_ld_link_tests $x86_64tests