aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-12-04 11:00:18 +0000
committerNick Clifton <nickc@redhat.com>2008-12-04 11:00:18 +0000
commit137627db10bc0dedd3e2f58b9e4e054c816dd41c (patch)
tree080bf5bfc5e1e8f6eac407708e05800862e3a68f
parent2f3bb96af7966880e7378a1633f6ffe1ea7a6587 (diff)
downloadgdb-137627db10bc0dedd3e2f58b9e4e054c816dd41c.zip
gdb-137627db10bc0dedd3e2f58b9e4e054c816dd41c.tar.gz
gdb-137627db10bc0dedd3e2f58b9e4e054c816dd41c.tar.bz2
* ld-x86-64/ifunc.d: New test (of STT_IFUNC for x86_64).
* ld-x86-64/ifunc.s: Source file for new test. * ld-x86-64/x86-64.exp: Run the new test. * ld-i386/ifunc.d: Tidy up regexps for expected output.
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-i386/ifunc.d12
-rw-r--r--ld/testsuite/ld-x86-64/ifunc.d14
-rw-r--r--ld/testsuite/ld-x86-64/ifunc.s198
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp3
5 files changed, 227 insertions, 7 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 6fd87db..d27544e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-04 Nick Clifton <nickc@redhat.com>
+
+ * ld-x86-64/ifunc.d: New test (of STT_IFUNC for x86_64).
+ * ld-x86-64/ifunc.s: Source file for new test.
+ * ld-x86-64/x86-64.exp: Run the new test.
+ * ld-i386/ifunc.d: Tidy up regexps for expected output.
+
2008-12-03 Nick Clifton <nickc@redhat.com>
* ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc
diff --git a/ld/testsuite/ld-i386/ifunc.d b/ld/testsuite/ld-i386/ifunc.d
index 4edf95d..f5a7584 100644
--- a/ld/testsuite/ld-i386/ifunc.d
+++ b/ld/testsuite/ld-i386/ifunc.d
@@ -1,14 +1,14 @@
-#name: Generatiion of dynamic relocs for STT_IFUNC symbols
+#name: Generation 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
+ +Offset +Info +Type +Sym.Value +Sym. Name
+[0-9a-f]+ 0+0202 R_386_PC32 func\(\) func
+[0-9a-f]+ 0+0102 R_386_PC32 long_fun\(\) long_func_name
#...
- ..: 080482e0 29 IFUNC GLOBAL DEFAULT 10 long_func_name
- ..: 08048300 29 IFUNC GLOBAL DEFAULT 10 func
+ ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. long_func_name
+ ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. func
#pass
diff --git a/ld/testsuite/ld-x86-64/ifunc.d b/ld/testsuite/ld-x86-64/ifunc.d
new file mode 100644
index 0000000..1f147e3
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ifunc.d
@@ -0,0 +1,14 @@
+#name: Generation of dynamic relocs for STT_IFUNC symbols
+#source: ifunc.s
+#ld: --defsym _start=0 --defsym puts=0 --defsym rand=0 --defsym printf=0
+#readelf: --relocs --syms
+
+Relocation section '.rela.ifunc.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym. Value +Sym. Name \+ Addend
+[0-9a-f]+ 0+20+2 R_X86_64_PC32 .*
+[0-9a-f]+ 0+10+2 R_X86_64_PC32 .*
+#...
+ ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. long_func_name
+#...
+ ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. func
+#pass
diff --git a/ld/testsuite/ld-x86-64/ifunc.s b/ld/testsuite/ld-x86-64/ifunc.s
new file mode 100644
index 0000000..4a6a62e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ifunc.s
@@ -0,0 +1,198 @@
+ .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:
+.LFB25:
+ movl %edi, %esi
+ xorl %eax, %eax
+ movl $.LC0, %edi
+ jmp printf
+.LFE25:
+ .size bar, .-bar
+ .section .rodata.str1.1
+.LC1:
+ .string "main: calling func"
+ .section .rodata.str1.8,"aMS",@progbits,1
+ .align 8
+.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:
+.LFB24:
+ subq $8, %rsp
+.LCFI0:
+ movl $.LC1, %edi
+ call puts
+ call func
+ movl $.LC2, %edi
+ call puts
+ call long_func_name
+ movl $.LC3, %edi
+ call puts
+ xorl %eax, %eax
+ addq $8, %rsp
+ ret
+.LFE24:
+ .size main, .-main
+ .p2align 4,,15
+.globl long_func_name
+ .type long_func_name, @function
+long_func_name:
+.LFB23:
+ subq $8, %rsp
+.LCFI1:
+ call rand
+ movl %eax, %edx
+ movl $func1, %eax
+ testl %edx, %edx
+ movl $func0, %edx
+ cmovne %rdx, %rax
+ addq $8, %rsp
+ ret
+.LFE23:
+ .size long_func_name, .-long_func_name
+ .p2align 4,,15
+.globl func
+ .type func, @function
+func:
+.LFB22:
+ subq $8, %rsp
+.LCFI2:
+ call rand
+ movl %eax, %edx
+ movl $func1, %eax
+ testl %edx, %edx
+ movl $func0, %edx
+ cmovne %rdx, %rax
+ addq $8, %rsp
+ ret
+.LFE22:
+ .size func, .-func
+ .section .rodata.str1.1
+.LC4:
+ .string "func1\n"
+ .text
+ .p2align 4,,15
+.globl func1
+ .type func1, @function
+func1:
+.LFB21:
+ movl $.LC4, %edi
+ jmp puts
+.LFE21:
+ .size func1, .-func1
+ .section .rodata.str1.1
+.LC5:
+ .string "func0\n"
+ .text
+ .p2align 4,,15
+.globl func0
+ .type func0, @function
+func0:
+.LFB20:
+ movl $.LC5, %edi
+ jmp puts
+.LFE20:
+ .size func0, .-func0
+ .section .eh_frame,"a",@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string "zR"
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .uleb128 0x1
+ .byte 0x3
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .long .LFB25
+ .long .LFE25-.LFB25
+ .uleb128 0x0
+ .align 8
+.LEFDE1:
+.LSFDE3:
+ .long .LEFDE3-.LASFDE3
+.LASFDE3:
+ .long .LASFDE3-.Lframe1
+ .long .LFB24
+ .long .LFE24-.LFB24
+ .uleb128 0x0
+ .byte 0x4
+ .long .LCFI0-.LFB24
+ .byte 0xe
+ .uleb128 0x10
+ .align 8
+.LEFDE3:
+.LSFDE5:
+ .long .LEFDE5-.LASFDE5
+.LASFDE5:
+ .long .LASFDE5-.Lframe1
+ .long .LFB23
+ .long .LFE23-.LFB23
+ .uleb128 0x0
+ .byte 0x4
+ .long .LCFI1-.LFB23
+ .byte 0xe
+ .uleb128 0x10
+ .align 8
+.LEFDE5:
+.LSFDE7:
+ .long .LEFDE7-.LASFDE7
+.LASFDE7:
+ .long .LASFDE7-.Lframe1
+ .long .LFB22
+ .long .LFE22-.LFB22
+ .uleb128 0x0
+ .byte 0x4
+ .long .LCFI2-.LFB22
+ .byte 0xe
+ .uleb128 0x10
+ .align 8
+.LEFDE7:
+.LSFDE9:
+ .long .LEFDE9-.LASFDE9
+.LASFDE9:
+ .long .LASFDE9-.Lframe1
+ .long .LFB21
+ .long .LFE21-.LFB21
+ .uleb128 0x0
+ .align 8
+.LEFDE9:
+.LSFDE11:
+ .long .LEFDE11-.LASFDE11
+.LASFDE11:
+ .long .LASFDE11-.Lframe1
+ .long .LFB20
+ .long .LFE20-.LFB20
+ .uleb128 0x0
+ .align 8
+.LEFDE11:
+ .ident "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index eeeea43..d3608f6 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -1,5 +1,5 @@
# Expect script for ld-x86_64 tests
-# Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation
+# Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software Foundation
#
# This file is part of the GNU Binutils.
#
@@ -92,3 +92,4 @@ run_dump_test "hidden3"
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
+run_dump_test "ifunc"