diff options
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-i386/got1.dd | 19 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/got1.out | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/got1a.S | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/got1b.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/got1c.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/got1d.S | 54 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 30 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea1c.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea2.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea2a.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea2b.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea3.s | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea3a.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea3b.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea4.s | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea4a.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea4b.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt-main1.rd | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt-main3.rd | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/plt-main4.rd | 2 |
20 files changed, 250 insertions, 4 deletions
diff --git a/ld/testsuite/ld-i386/got1.dd b/ld/testsuite/ld-i386/got1.dd new file mode 100644 index 0000000..de078b9 --- /dev/null +++ b/ld/testsuite/ld-i386/got1.dd @@ -0,0 +1,19 @@ +#... +[a-f0-9]+ <main>: +[ ]*[a-f0-9]+: 83 ec 0c sub \$0xc,%esp +[ ]*[a-f0-9]+: [ a-f0-9]+ addr16 call [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: [ a-f0-9]+ call \*0x[a-f0-9]+ +[ ]*[a-f0-9]+: [ a-f0-9]+ call \*0x[a-f0-9]+ +[ ]*[a-f0-9]+: [ a-f0-9]+ lea *0x[a-f0-9]+,%eax +[ ]*[a-f0-9]+: ff d0 call \*%eax +[ ]*[a-f0-9]+: [ a-f0-9]+ mov *0x[a-f0-9]+,%eax +[ ]*[a-f0-9]+: ff d0 call \*%eax +[ ]*[a-f0-9]+: [ a-f0-9]+ mov *0x[a-f0-9]+,%eax +[ ]*[a-f0-9]+: ff d0 call \*%eax +[ ]*[a-f0-9]+: [ a-f0-9]+ lea *0x[a-f0-9]+,%ecx +[ ]*[a-f0-9]+: ff d1 call \*%ecx +[ ]*[a-f0-9]+: 83 ec 0c sub \$0xc,%esp +[ ]*[a-f0-9]+: 6a 00 push \$0x0 +[ ]*[a-f0-9]+: [ a-f0-9]+ jmp [a-f0-9]+ <myexit> +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/got1.out b/ld/testsuite/ld-i386/got1.out new file mode 100644 index 0000000..99d4f7f --- /dev/null +++ b/ld/testsuite/ld-i386/got1.out @@ -0,0 +1,7 @@ +foo +bar +plt +foo +bar +plt +foo diff --git a/ld/testsuite/ld-i386/got1a.S b/ld/testsuite/ld-i386/got1a.S new file mode 100644 index 0000000..453025b --- /dev/null +++ b/ld/testsuite/ld-i386/got1a.S @@ -0,0 +1,20 @@ + .text + .globl main + .type main, @function +main: + subl $12, %esp + call *foo@GOT + call *bar@GOT + call *plt@GOT + movl foo@GOT, %eax + call *%eax + movl bar@GOT, %eax + call *%eax + movl plt@GOT, %eax + call *%eax + movl foo@GOT(%ebx), %ecx + call *%ecx + subl $12, %esp + pushl $0 + jmp *myexit@GOT + .size main, .-main diff --git a/ld/testsuite/ld-i386/got1b.c b/ld/testsuite/ld-i386/got1b.c new file mode 100644 index 0000000..cf0c78e --- /dev/null +++ b/ld/testsuite/ld-i386/got1b.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +foo (void) +{ + printf ("%s\n", __FUNCTION__); +} diff --git a/ld/testsuite/ld-i386/got1c.c b/ld/testsuite/ld-i386/got1c.c new file mode 100644 index 0000000..05f5fc2 --- /dev/null +++ b/ld/testsuite/ld-i386/got1c.c @@ -0,0 +1,7 @@ +#include <stdlib.h> + +void +myexit (int status) +{ + exit (status); +} diff --git a/ld/testsuite/ld-i386/got1d.S b/ld/testsuite/ld-i386/got1d.S new file mode 100644 index 0000000..a6d51c6 --- /dev/null +++ b/ld/testsuite/ld-i386/got1d.S @@ -0,0 +1,54 @@ + .globl bar + .type bar, @function +bar: + pushl %ebx + call __x86.get_pc_thunk.cx + addl $_GLOBAL_OFFSET_TABLE_, %ecx + subl $24, %esp + leal __FUNCTION__.1862@GOTOFF(%ecx), %eax + movl %eax, (%esp) + call *puts@GOT(%ecx) + addl $24, %esp + popl %ebx + ret + .size bar, .-bar + + .globl plt + .type plt, @function +plt: + pushl %esi + pushl %ebx + call __x86.get_pc_thunk.bx +1: + addl $_GLOBAL_OFFSET_TABLE_, %ebx + subl $20, %esp + leal __FUNCTION__.1866@GOTOFF(%ebx), %esi + movl %esi, (%esp) + call *puts@GOT(%ebx) + addl $20, %esp + popl %ebx + popl %esi + ret + .section .rodata + .type __FUNCTION__.1866, @object + .size __FUNCTION__.1866, 4 +__FUNCTION__.1866: + .string "plt" + .type __FUNCTION__.1862, @object + .size __FUNCTION__.1862, 4 +__FUNCTION__.1862: + .string "bar" + .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 .text.__x86.get_pc_thunk.cx,"axG",@progbits,__x86.get_pc_thunk.cx,comdat + .globl __x86.get_pc_thunk.cx + .hidden __x86.get_pc_thunk.cx + .type __x86.get_pc_thunk.cx, @function +__x86.get_pc_thunk.cx: + movl (%esp), %ecx + ret diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 6213dbe..eca48dc 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -291,6 +291,12 @@ run_dump_test "lea1c" run_dump_test "lea1d" run_dump_test "lea1e" run_dump_test "lea1f" +run_dump_test "lea2a" +run_dump_test "lea2b" +run_dump_test "lea3a" +run_dump_test "lea3b" +run_dump_test "lea4a" +run_dump_test "lea4b" run_dump_test "mov1a" run_dump_test "mov1b" @@ -490,6 +496,22 @@ if { [isnative] {{readelf {-Wrd} pr18900b.rd}} \ "pr18900b" \ ] \ + [list \ + "Build got1d.so" \ + "-shared" \ + "" \ + { got1d.S } \ + "" \ + "got1d.so" \ + ] \ + [list \ + "Build gotpc1" \ + "tmpdir/got1d.so" \ + "" \ + { got1a.S got1b.c got1c.c } \ + {{objdump {-dw} got1.dd}} \ + "got1" \ + ] \ ] run_ld_link_exec_tests [] [list \ @@ -552,6 +574,14 @@ if { [isnative] "pr18900" \ "pr18900.out" \ ] \ + [list \ + "Run got1" \ + "tmpdir/got1d.so" \ + "" \ + { got1a.S got1b.c got1c.c } \ + "got1" \ + "got1.out" \ + ] \ ] } diff --git a/ld/testsuite/ld-i386/lea1c.d b/ld/testsuite/ld-i386/lea1c.d index 5ba8275..f47dd1a 100644 --- a/ld/testsuite/ld-i386/lea1c.d +++ b/ld/testsuite/ld-i386/lea1c.d @@ -9,5 +9,5 @@ Disassembly of section .text: #... -[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax #pass diff --git a/ld/testsuite/ld-i386/lea2.s b/ld/testsuite/ld-i386/lea2.s new file mode 100644 index 0000000..fe2c4cd --- /dev/null +++ b/ld/testsuite/ld-i386/lea2.s @@ -0,0 +1,9 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .globl _start + .type _start, @function +_start: + movl foo@GOT, %eax diff --git a/ld/testsuite/ld-i386/lea2a.d b/ld/testsuite/ld-i386/lea2a.d new file mode 100644 index 0000000..b00853b --- /dev/null +++ b/ld/testsuite/ld-i386/lea2a.d @@ -0,0 +1,4 @@ +#source: lea2.s +#as: --32 +#ld: -Bsymbolic -shared -melf_i386 +#error: direct GOT relocation R_386_LOAD_GOT32 against `foo' without base register can not be used when making a shared object diff --git a/ld/testsuite/ld-i386/lea2b.d b/ld/testsuite/ld-i386/lea2b.d new file mode 100644 index 0000000..b9077a7 --- /dev/null +++ b/ld/testsuite/ld-i386/lea2b.d @@ -0,0 +1,13 @@ +#source: lea2.s +#as: --32 +#ld: -melf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax +#pass diff --git a/ld/testsuite/ld-i386/lea3.s b/ld/testsuite/ld-i386/lea3.s new file mode 100644 index 0000000..0cd02a1 --- /dev/null +++ b/ld/testsuite/ld-i386/lea3.s @@ -0,0 +1,15 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .type bar, @function +bar: + ret + .globl _start + .type _start, @function +_start: + call *foo@GOT + call *bar@GOT + jmp *foo@GOT + jmp *bar@GOT diff --git a/ld/testsuite/ld-i386/lea3a.d b/ld/testsuite/ld-i386/lea3a.d new file mode 100644 index 0000000..a7e9724 --- /dev/null +++ b/ld/testsuite/ld-i386/lea3a.d @@ -0,0 +1,18 @@ +#source: lea3.s +#as: --32 +#ld: -Bsymbolic -shared -melf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]*addr16 call [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]*addr16 call [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: [ a-f0-9]+ jmp [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: [ a-f0-9]+ jmp [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/lea3b.d b/ld/testsuite/ld-i386/lea3b.d new file mode 100644 index 0000000..bb16fc0 --- /dev/null +++ b/ld/testsuite/ld-i386/lea3b.d @@ -0,0 +1,18 @@ +#source: lea3.s +#as: --32 +#ld: -melf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]*addr16 call [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]*addr16 call [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: [ a-f0-9]+ jmp [a-f0-9]+ <foo> +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: [ a-f0-9]+ jmp [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/lea4.s b/ld/testsuite/ld-i386/lea4.s new file mode 100644 index 0000000..1ecd50c --- /dev/null +++ b/ld/testsuite/ld-i386/lea4.s @@ -0,0 +1,8 @@ + .text + .type foo, @function +foo: + ret + .globl _start + .type _start, @function +_start: + movl foo@GOT, %eax diff --git a/ld/testsuite/ld-i386/lea4a.d b/ld/testsuite/ld-i386/lea4a.d new file mode 100644 index 0000000..5e43615 --- /dev/null +++ b/ld/testsuite/ld-i386/lea4a.d @@ -0,0 +1,4 @@ +#source: lea4.s +#as: --32 +#ld: -Bsymbolic -shared -melf_i386 +#error: direct GOT relocation R_386_LOAD_GOT32 against `foo' without base register can not be used when making a shared object diff --git a/ld/testsuite/ld-i386/lea4b.d b/ld/testsuite/ld-i386/lea4b.d new file mode 100644 index 0000000..745ea4f --- /dev/null +++ b/ld/testsuite/ld-i386/lea4b.d @@ -0,0 +1,13 @@ +#source: lea4.s +#as: --32 +#ld: -melf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax +#pass diff --git a/ld/testsuite/ld-i386/plt-main1.rd b/ld/testsuite/ld-i386/plt-main1.rd index d27589e..8eab423 100644 --- a/ld/testsuite/ld-i386/plt-main1.rd +++ b/ld/testsuite/ld-i386/plt-main1.rd @@ -1,3 +1,3 @@ #... -[0-9a-f ]+R_386_GOT32 +0+ +bar +[0-9a-f ]+R_386_LOAD_GOT32 +0+ +bar #pass diff --git a/ld/testsuite/ld-i386/plt-main3.rd b/ld/testsuite/ld-i386/plt-main3.rd index 7b78818..0364fb1 100644 --- a/ld/testsuite/ld-i386/plt-main3.rd +++ b/ld/testsuite/ld-i386/plt-main3.rd @@ -1,5 +1,5 @@ #... -[0-9a-f ]+R_386_GOT32 +0+ +bar +[0-9a-f ]+R_386_(LOAD_|)GOT32 +0+ +bar #... [0-9a-f ]+R_386_PLT32 +0+ +bar #pass diff --git a/ld/testsuite/ld-i386/plt-main4.rd b/ld/testsuite/ld-i386/plt-main4.rd index 882a3ad..bde39e9 100644 --- a/ld/testsuite/ld-i386/plt-main4.rd +++ b/ld/testsuite/ld-i386/plt-main4.rd @@ -1,5 +1,5 @@ #... -[0-9a-f ]+R_386_GOT32 +0+ +foo +[0-9a-f ]+R_386_LOAD_GOT32 +0+ +foo #... [0-9a-f ]+R_386_PLT32 +0+ +foo #pass |