aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/ifunc.d14
-rw-r--r--ld/testsuite/ld-i386/ifunc.s128
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-1-n32.d70
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-1-n64.d70
6 files changed, 222 insertions, 70 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7157245..6fd87db 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-03 Nick Clifton <nickc@redhat.com>
+
+ * ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc
+ descriptions.
+ * ld-mips-elf/reloc-1-n64.d: Likewise.
+ * ld-i386/ifunc.d: New test.
+ * ld-i386/ifunc.s: Source file for the new test.
+ * ld-i386/i386.exp: Run the new test.
+
2008-11-25 Joseph Myers <joseph@codesourcery.com>
* ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6f75f3a..0446f18 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -138,3 +138,4 @@ run_dump_test "hidden3"
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
+run_dump_test "ifunc"
diff --git a/ld/testsuite/ld-i386/ifunc.d b/ld/testsuite/ld-i386/ifunc.d
new file mode 100644
index 0000000..4edf95d
--- /dev/null
+++ b/ld/testsuite/ld-i386/ifunc.d
@@ -0,0 +1,14 @@
+#name: Generatiion of dynamic relocs for STT_IFUNC symbols
+#source: ifunc.s
+#as: --32
+#ld: -melf_i386 -lc --defsym _start=0 -L/usr/lib
+#readelf: --relocs --syms
+
+Relocation section '.rel.ifunc.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ 00000202 R_386_PC32 func\(\) func
+[0-9a-f]+ 00000102 R_386_PC32 long_fun\(\) long_func_name
+#...
+ ..: 080482e0 29 IFUNC GLOBAL DEFAULT 10 long_func_name
+ ..: 08048300 29 IFUNC GLOBAL DEFAULT 10 func
+#pass
diff --git a/ld/testsuite/ld-i386/ifunc.s b/ld/testsuite/ld-i386/ifunc.s
new file mode 100644
index 0000000..3f34cfb
--- /dev/null
+++ b/ld/testsuite/ld-i386/ifunc.s
@@ -0,0 +1,128 @@
+ .file "ifunc.c"
+#APP
+ .type func, %indirect_function
+ .type long_func_name, %indirect_function
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "arg is %d\n"
+#NO_APP
+ .text
+ .p2align 4,,15
+.globl bar
+ .type bar, @function
+bar:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ movl 8(%ebp), %eax
+ movl $.LC0, (%esp)
+ movl %eax, 4(%esp)
+ call printf
+ leave
+ ret
+ .size bar, .-bar
+ .section .rodata.str1.1
+.LC1:
+ .string "main: calling func"
+ .section .rodata.str1.4,"aMS",@progbits,1
+ .align 4
+.LC2:
+ .string "main: func finished, calling long_func_name"
+ .section .rodata.str1.1
+.LC3:
+ .string "main: long_func_name finished"
+ .text
+ .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 %ecx
+ subl $4, %esp
+ movl $.LC1, (%esp)
+ call puts
+ call func
+ movl $.LC2, (%esp)
+ call puts
+ call long_func_name
+ movl $.LC3, (%esp)
+ call puts
+ addl $4, %esp
+ xorl %eax, %eax
+ popl %ecx
+ popl %ebp
+ leal -4(%ecx), %esp
+ ret
+ .size main, .-main
+ .p2align 4,,15
+.globl long_func_name
+ .type long_func_name, @function
+long_func_name:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ call rand
+ movl $func0, %edx
+ testl %eax, %eax
+ jne .L7
+ movl $func1, %edx
+.L7:
+ movl %edx, %eax
+ leave
+ ret
+ .size long_func_name, .-long_func_name
+ .p2align 4,,15
+.globl func
+ .type func, @function
+func:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ call rand
+ movl $func0, %edx
+ testl %eax, %eax
+ jne .L12
+ movl $func1, %edx
+.L12:
+ movl %edx, %eax
+ leave
+ ret
+ .size func, .-func
+ .section .rodata.str1.1
+.LC4:
+ .string "func1\n"
+ .text
+ .p2align 4,,15
+.globl func1
+ .type func1, @function
+func1:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ movl $.LC4, (%esp)
+ call puts
+ leave
+ ret
+ .size func1, .-func1
+ .section .rodata.str1.1
+.LC5:
+ .string "func0\n"
+ .text
+ .p2align 4,,15
+.globl func0
+ .type func0, @function
+func0:
+ pushl %ebp
+ movl %esp, %ebp
+ subl $8, %esp
+ movl $.LC5, (%esp)
+ call puts
+ leave
+ ret
+ .size func0, .-func0
+ .ident "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-mips-elf/reloc-1-n32.d b/ld/testsuite/ld-mips-elf/reloc-1-n32.d
index dd41822..87a55f9 100644
--- a/ld/testsuite/ld-mips-elf/reloc-1-n32.d
+++ b/ld/testsuite/ld-mips-elf/reloc-1-n32.d
@@ -8,10 +8,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against tstarta
#
-.* R_MIPS_HI16 .* \.text \+ ffff7ff0
-.* R_MIPS_LO16 .* \.text \+ ffff7ff0
-.* R_MIPS_HI16 .* \.text \+ ffff8000
-.* R_MIPS_LO16 .* \.text \+ ffff8000
+.* R_MIPS_HI16 .* \.text \- 8010
+.* R_MIPS_LO16 .* \.text \- 8010
+.* R_MIPS_HI16 .* \.text \- 8000
+.* R_MIPS_LO16 .* \.text \- 8000
.* R_MIPS_HI16 .* \.text \+ 0
.* R_MIPS_LO16 .* \.text \+ 0
.* R_MIPS_HI16 .* \.text \+ 7ff0
@@ -21,10 +21,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against t32a
#
-.* R_MIPS_HI16 .* \.text \+ ffff8010
-.* R_MIPS_LO16 .* \.text \+ ffff8010
-.* R_MIPS_HI16 .* \.text \+ ffff8020
-.* R_MIPS_LO16 .* \.text \+ ffff8020
+.* R_MIPS_HI16 .* \.text \- 7ff0
+.* R_MIPS_LO16 .* \.text \- 7ff0
+.* R_MIPS_HI16 .* \.text \- 7fe0
+.* R_MIPS_LO16 .* \.text \- 7fe0
.* R_MIPS_HI16 .* \.text \+ 20
.* R_MIPS_LO16 .* \.text \+ 20
.* R_MIPS_HI16 .* \.text \+ 8010
@@ -34,10 +34,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_HI16 .* _start \+ ffff7ff0
-.* R_MIPS_LO16 .* _start \+ ffff7ff0
-.* R_MIPS_HI16 .* _start \+ ffff8000
-.* R_MIPS_LO16 .* _start \+ ffff8000
+.* R_MIPS_HI16 .* _start \- 8010
+.* R_MIPS_LO16 .* _start \- 8010
+.* R_MIPS_HI16 .* _start \- 8000
+.* R_MIPS_LO16 .* _start \- 8000
.* R_MIPS_HI16 .* _start \+ 0
.* R_MIPS_LO16 .* _start \+ 0
.* R_MIPS_HI16 .* _start \+ 7ff0
@@ -47,10 +47,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against tstarta
#
-.* R_MIPS_GOT16 .* \.text \+ ffff7ff0
-.* R_MIPS_LO16 .* \.text \+ ffff7ff0
-.* R_MIPS_GOT16 .* \.text \+ ffff8000
-.* R_MIPS_LO16 .* \.text \+ ffff8000
+.* R_MIPS_GOT16 .* \.text \- 8010
+.* R_MIPS_LO16 .* \.text \- 8010
+.* R_MIPS_GOT16 .* \.text \- 8000
+.* R_MIPS_LO16 .* \.text \- 8000
.* R_MIPS_GOT16 .* \.text \+ 0
.* R_MIPS_LO16 .* \.text \+ 0
.* R_MIPS_GOT16 .* \.text \+ 7ff0
@@ -60,10 +60,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against t32a
#
-.* R_MIPS_GOT16 .* \.text \+ ffff8010
-.* R_MIPS_LO16 .* \.text \+ ffff8010
-.* R_MIPS_GOT16 .* \.text \+ ffff8020
-.* R_MIPS_LO16 .* \.text \+ ffff8020
+.* R_MIPS_GOT16 .* \.text \- 7ff0
+.* R_MIPS_LO16 .* \.text \- 7ff0
+.* R_MIPS_GOT16 .* \.text \- 7fe0
+.* R_MIPS_LO16 .* \.text \- 7fe0
.* R_MIPS_GOT16 .* \.text \+ 20
.* R_MIPS_LO16 .* \.text \+ 20
.* R_MIPS_GOT16 .* \.text \+ 8010
@@ -73,20 +73,20 @@ Relocation section '\.rela\.text' .*
#
# Relocations against sdg
#
-.* R_MIPS_GPREL16 .* sdg \+ fffffffc
+.* R_MIPS_GPREL16 .* sdg \- 4
.* R_MIPS_GPREL16 .* sdg \+ 0
.* R_MIPS_GPREL16 .* sdg \+ 4
#
# Relocations against sdla. .sdata should be the first piece of gp-relative
# data, which the linker script should put _gp - 0x7ff0.
#
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff801c
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff8020
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff8024
+.* R_MIPS_GPREL16 .* \.sdata \- 7fe4
+.* R_MIPS_GPREL16 .* \.sdata \- 7fe0
+.* R_MIPS_GPREL16 .* \.sdata \- 7fdc
#
# Relocations against tstarta
#
-.* R_MIPS_26 .* \.text \+ fffffffc
+.* R_MIPS_26 .* \.text \- 4
.* R_MIPS_26 .* \.text \+ 0
.* R_MIPS_26 .* \.text \+ 4
#
@@ -98,7 +98,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_26 .* _start \+ fffffffc
+.* R_MIPS_26 .* _start \- 4
.* R_MIPS_26 .* _start \+ 0
.* R_MIPS_26 .* _start \+ 4
#
@@ -130,10 +130,10 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_HI16 .* _start \+ ffff7ff0
-.* R_MIPS_LO16 .* _start \+ ffff7ff0
-.* R_MIPS_HI16 .* _start \+ ffff8000
-.* R_MIPS_LO16 .* _start \+ ffff8000
+.* R_MIPS_HI16 .* _start \- 8010
+.* R_MIPS_LO16 .* _start \- 8010
+.* R_MIPS_HI16 .* _start \- 8000
+.* R_MIPS_LO16 .* _start \- 8000
.* R_MIPS_HI16 .* _start \+ 0
.* R_MIPS_LO16 .* _start \+ 0
.* R_MIPS_HI16 .* _start \+ 7ff0
@@ -169,15 +169,15 @@ Relocation section '\.rela\.text' .*
#
# Relocations against sdg
#
-.* R_MIPS_GPREL16 .* sdg \+ fffffffc
+.* R_MIPS_GPREL16 .* sdg \- 4
.* R_MIPS_GPREL16 .* sdg \+ 0
.* R_MIPS_GPREL16 .* sdg \+ 4
#
# Relocations against sdlb
#
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff803c
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff8040
-.* R_MIPS_GPREL16 .* \.sdata \+ ffff8044
+.* R_MIPS_GPREL16 .* \.sdata \- 7fc4
+.* R_MIPS_GPREL16 .* \.sdata \- 7fc0
+.* R_MIPS_GPREL16 .* \.sdata \- 7fbc
#
# Relocations against tstartb
#
@@ -193,7 +193,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_26 .* _start \+ fffffffc
+.* R_MIPS_26 .* _start \- 4
.* R_MIPS_26 .* _start \+ 0
.* R_MIPS_26 .* _start \+ 4
#pass
diff --git a/ld/testsuite/ld-mips-elf/reloc-1-n64.d b/ld/testsuite/ld-mips-elf/reloc-1-n64.d
index 42d74ea..2cfbe9a 100644
--- a/ld/testsuite/ld-mips-elf/reloc-1-n64.d
+++ b/ld/testsuite/ld-mips-elf/reloc-1-n64.d
@@ -8,16 +8,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against tstarta
#
-.* R_MIPS_HI16 .* \.text \+ f+7ff0
+.* R_MIPS_HI16 .* \.text \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+7ff0
+.* R_MIPS_LO16 .* \.text \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_HI16 .* \.text \+ f+8000
+.* R_MIPS_HI16 .* \.text \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8000
+.* R_MIPS_LO16 .* \.text \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_HI16 .* \.text \+ 0
@@ -41,16 +41,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against t32a
#
-.* R_MIPS_HI16 .* \.text \+ f+8010
+.* R_MIPS_HI16 .* \.text \- 7ff0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8010
+.* R_MIPS_LO16 .* \.text \- 7ff0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_HI16 .* \.text \+ f+8020
+.* R_MIPS_HI16 .* \.text \- 7fe0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8020
+.* R_MIPS_LO16 .* \.text \- 7fe0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_HI16 .* \.text \+ 20
@@ -74,16 +74,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_HI16 .* _start \+ f+7ff0
+.* R_MIPS_HI16 .* _start \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* _start \+ f+7ff0
+.* R_MIPS_LO16 .* _start \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_HI16 .* _start \+ f+8000
+.* R_MIPS_HI16 .* _start \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* _start \+ f+8000
+.* R_MIPS_LO16 .* _start \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_HI16 .* _start \+ 0
@@ -107,16 +107,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against tstarta
#
-.* R_MIPS_GOT16 .* \.text \+ f+7ff0
+.* R_MIPS_GOT16 .* \.text \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+7ff0
+.* R_MIPS_LO16 .* \.text \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GOT16 .* \.text \+ f+8000
+.* R_MIPS_GOT16 .* \.text \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8000
+.* R_MIPS_LO16 .* \.text \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_GOT16 .* \.text \+ 0
@@ -140,16 +140,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against t32a
#
-.* R_MIPS_GOT16 .* \.text \+ f+8010
+.* R_MIPS_GOT16 .* \.text \- 7ff0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8010
+.* R_MIPS_LO16 .* \.text \- 7ff0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GOT16 .* \.text \+ f+8020
+.* R_MIPS_GOT16 .* \.text \- 7fe0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* \.text \+ f+8020
+.* R_MIPS_LO16 .* \.text \- 7fe0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_GOT16 .* \.text \+ 20
@@ -173,7 +173,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against sdg
#
-.* R_MIPS_GPREL16 .* sdg \+ f+fffc
+.* R_MIPS_GPREL16 .* sdg \- 4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_GPREL16 .* sdg \+ 0
@@ -186,19 +186,19 @@ Relocation section '\.rela\.text' .*
# Relocations against sdla. .sdata should be the first piece of gp-relative
# data, which the linker script should put _gp - 0x7ff0.
#
-.* R_MIPS_GPREL16 .* \.sdata \+ f+801c
+.* R_MIPS_GPREL16 .* \.sdata \- 7fe4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GPREL16 .* \.sdata \+ f+8020
+.* R_MIPS_GPREL16 .* \.sdata \- 7fe0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GPREL16 .* \.sdata \+ f+8024
+.* R_MIPS_GPREL16 .* \.sdata \- 7fdc
.* R_MIPS_NONE *
.* R_MIPS_NONE *
#
# Relocations against tstarta
#
-.* R_MIPS_26 .* \.text \+ f+fffc
+.* R_MIPS_26 .* \.text \- 4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_26 .* \.text \+ 0
@@ -222,7 +222,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_26 .* _start \+ f+fffc
+.* R_MIPS_26 .* _start \- 4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_26 .* _start \+ 0
@@ -300,16 +300,16 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_HI16 .* _start \+ f+7ff0
+.* R_MIPS_HI16 .* _start \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* _start \+ f+7ff0
+.* R_MIPS_LO16 .* _start \- 8010
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_HI16 .* _start \+ f+8000
+.* R_MIPS_HI16 .* _start \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_LO16 .* _start \+ f+8000
+.* R_MIPS_LO16 .* _start \- 8000
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_HI16 .* _start \+ 0
@@ -399,7 +399,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against sdg
#
-.* R_MIPS_GPREL16 .* sdg \+ f+fffc
+.* R_MIPS_GPREL16 .* sdg \- 4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_GPREL16 .* sdg \+ 0
@@ -411,13 +411,13 @@ Relocation section '\.rela\.text' .*
#
# Relocations against sdlb
#
-.* R_MIPS_GPREL16 .* \.sdata \+ f+803c
+.* R_MIPS_GPREL16 .* \.sdata \- 7fc4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GPREL16 .* \.sdata \+ f+8040
+.* R_MIPS_GPREL16 .* \.sdata \- 7fc0
.* R_MIPS_NONE *
.* R_MIPS_NONE *
-.* R_MIPS_GPREL16 .* \.sdata \+ f+8044
+.* R_MIPS_GPREL16 .* \.sdata \- 7fbc
.* R_MIPS_NONE *
.* R_MIPS_NONE *
#
@@ -447,7 +447,7 @@ Relocation section '\.rela\.text' .*
#
# Relocations against _start
#
-.* R_MIPS_26 .* _start \+ f+fffc
+.* R_MIPS_26 .* _start \- 4
.* R_MIPS_NONE *
.* R_MIPS_NONE *
.* R_MIPS_26 .* _start \+ 0