aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authornobody <>2002-10-21 14:59:31 +0000
committernobody <>2002-10-21 14:59:31 +0000
commite5c164ac745f6dec6bbed10b61bd41fbc68ce587 (patch)
tree3c873ae5b050b77d2c1867e7f3e40ba43f45818f /ld
parente473d261914231ce7c4ea96f7ff4914b98e0385d (diff)
downloadgdb-e5c164ac745f6dec6bbed10b61bd41fbc68ce587.zip
gdb-e5c164ac745f6dec6bbed10b61bd41fbc68ce587.tar.gz
gdb-e5c164ac745f6dec6bbed10b61bd41fbc68ce587.tar.bz2
This commit was manufactured by cvs2svn to create branch 'binutils-
2_13-branch'. Cherrypick from master 2002-10-21 14:59:30 UTC Richard Sandiford <rdsandiford@googlemail.com> ' * config/tc-mips.c (mips_need_elf_addend_fixup): Return true': gas/testsuite/gas/mips/elf-rel7.d gas/testsuite/gas/mips/elf-rel7.s ld/testsuite/ld-i386/combreloc.d ld/testsuite/ld-i386/combreloc.s ld/testsuite/ld-i386/reloc.d ld/testsuite/ld-i386/reloc.s ld/testsuite/ld-i386/tlsindntpoff.dd ld/testsuite/ld-i386/tlsindntpoff.s ld/testsuite/ld-powerpc/powerpc.exp ld/testsuite/ld-powerpc/reloc.d ld/testsuite/ld-powerpc/reloc.s ld/testsuite/ld-sh/sh64/gotplt.d ld/testsuite/ld-sh/sh64/gotplt.map ld/testsuite/ld-sh/sh64/gotplt.s
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-i386/combreloc.d18
-rw-r--r--ld/testsuite/ld-i386/combreloc.s22
-rw-r--r--ld/testsuite/ld-i386/reloc.d18
-rw-r--r--ld/testsuite/ld-i386/reloc.s8
-rw-r--r--ld/testsuite/ld-i386/tlsindntpoff.dd16
-rw-r--r--ld/testsuite/ld-i386/tlsindntpoff.s19
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp46
-rw-r--r--ld/testsuite/ld-powerpc/reloc.d16
-rw-r--r--ld/testsuite/ld-powerpc/reloc.s9
-rw-r--r--ld/testsuite/ld-sh/sh64/gotplt.d12
-rw-r--r--ld/testsuite/ld-sh/sh64/gotplt.map4
-rw-r--r--ld/testsuite/ld-sh/sh64/gotplt.s8
12 files changed, 196 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/combreloc.d b/ld/testsuite/ld-i386/combreloc.d
new file mode 100644
index 0000000..762f481
--- /dev/null
+++ b/ld/testsuite/ld-i386/combreloc.d
@@ -0,0 +1,18 @@
+# Test that orphan reloc sections are merged into .rel.dyn with
+# -z combreloc.
+#source: combreloc.s
+#as: --32
+#ld: -shared -melf_i386 -z combreloc
+#readelf: -r
+#target: i?86-*-*
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+01 R_386_32 [0-9a-f]+ _start
+[0-9a-f]+ [0-9a-f]+06 R_386_GLOB_DAT [0-9a-f]+ _start
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ [0-9a-f]+07 R_386_JUMP_SLOT [0-9a-f]+ foo
diff --git a/ld/testsuite/ld-i386/combreloc.s b/ld/testsuite/ld-i386/combreloc.s
new file mode 100644
index 0000000..2a78a7c
--- /dev/null
+++ b/ld/testsuite/ld-i386/combreloc.s
@@ -0,0 +1,22 @@
+ .text
+ .globl _start, foo
+ .type _start,@function
+_start:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+ movl _start@GOT(%ebx), %eax
+ movl (%eax), %eax
+ call foo@PLT
+ movl (%esp), %ebx
+ leave
+foo: ret
+ .data
+ .long _start
+ .section "__libc_subfreeres", "aw", @progbits
+ .long _start
+ .section "__libc_atexit", "aw", @progbits
+ .long _start
diff --git a/ld/testsuite/ld-i386/reloc.d b/ld/testsuite/ld-i386/reloc.d
new file mode 100644
index 0000000..9e8faa4
--- /dev/null
+++ b/ld/testsuite/ld-i386/reloc.d
@@ -0,0 +1,18 @@
+# Test that orphan reloc sections are placed before .rel.plt even when
+# .rel.plt is the only reloc section.
+#source: reloc.s
+#as: --32
+#ld: -shared -melf_i386 -z nocombreloc
+#objdump: -hw
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+#...
+.*\.relplatypus.*
+#...
+.*\.rel\.plt.*
+# x86 ld doesn't output non-alloc reloc sections to shared libs, so disable
+# the following two lines for the time being.
+# #...
+# .*\.relechidna.*
+#pass
diff --git a/ld/testsuite/ld-i386/reloc.s b/ld/testsuite/ld-i386/reloc.s
new file mode 100644
index 0000000..0e3ff1d
--- /dev/null
+++ b/ld/testsuite/ld-i386/reloc.s
@@ -0,0 +1,8 @@
+ .section echidna
+ .long .text
+
+ .section platypus,"ax"
+ .long .text
+
+ .text
+ jmp _start@plt
diff --git a/ld/testsuite/ld-i386/tlsindntpoff.dd b/ld/testsuite/ld-i386/tlsindntpoff.dd
new file mode 100644
index 0000000..db20de1
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsindntpoff.dd
@@ -0,0 +1,16 @@
+#source: tlsindntpoff.s
+#as: --32
+#ld: -melf_i386
+#objdump: -drj.text
+#target: i?86-*-*
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+[0-9a-f]+000 <_start>:
+ [0-9a-f]+000: 39 d8[ ]+cmp %ebx,%eax
+ [0-9a-f]+002: 73 08[ ]+jae [0-9a-f]+00c <_start\+0xc>
+ [0-9a-f]+004: b8 fc ff ff ff[ ]+mov \$0xfffffffc,%eax
+ [0-9a-f]+009: 65 8b 00[ ]+mov %gs:\(%eax\),%eax
+ [0-9a-f]+00c: c3[ ]+ret *
diff --git a/ld/testsuite/ld-i386/tlsindntpoff.s b/ld/testsuite/ld-i386/tlsindntpoff.s
new file mode 100644
index 0000000..4bc93f6
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsindntpoff.s
@@ -0,0 +1,19 @@
+ /* Force .got aligned to 4K, so it very likely gets at 0x804a100
+ (0x60 bytes .tdata and 0xa0 bytes .dynamic) */
+ .data
+ .balign 4096
+ .section ".tdata", "awT", @progbits
+ .globl foo
+foo: .long 27
+
+ /* Force .text aligned to 4K, so it very likely gets at 0x8049000. */
+ .text
+ .balign 4096
+ .globl _start
+ .type _start,@function
+_start:
+ cmp %ebx, %eax
+ jae 1f
+ movl foo@indntpoff, %eax
+ movl %gs:(%eax), %eax
+1: ret
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
new file mode 100644
index 0000000..f52278d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -0,0 +1,46 @@
+# Expect script for ld-powerpc tests
+# Copyright (C) 2002 Free Software Foundation
+#
+# This file 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+if { ![istarget "powerpc*-*-*"] } {
+ return
+}
+
+# powerpc 32 bit ELF only at the moment.
+
+if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
+ || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
+ || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
+ || [istarget "*-*-beos*"] || [istarget "powerpc64*-*-*"] } {
+ return
+}
+
+# List contains test-items with 3 items followed by 2 lists:
+# 0:name 1:ld options 2:assembler options
+# 3:filenames of assembler files 4: action and options. 5: 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 ppcelftests {
+ {"Reloc section order" "-shared -z nocombreloc" "" {reloc.s}
+ {{objdump -hw reloc.d}} "reloc.so"}
+}
+
+run_ld_link_tests $ppcelftests
diff --git a/ld/testsuite/ld-powerpc/reloc.d b/ld/testsuite/ld-powerpc/reloc.d
new file mode 100644
index 0000000..08a209d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/reloc.d
@@ -0,0 +1,16 @@
+# Test that orphan reloc sections are placed before .rela.plt even when
+# .rela.plt is the only reloc section. Also tests that orphan non-alloc
+# reloc sections go after alloc sections.
+
+#source: reloc.s
+#ld: -shared -z nocombreloc
+#objdump: -hw
+
+.*: +file format elf.*
+#...
+.*\.relaplatypus.*
+#...
+.*\.rela\.plt.*
+#...
+.*\.relaechidna.*
+#pass
diff --git a/ld/testsuite/ld-powerpc/reloc.s b/ld/testsuite/ld-powerpc/reloc.s
new file mode 100644
index 0000000..4e66151
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/reloc.s
@@ -0,0 +1,9 @@
+ .section echidna
+ .long .text
+
+ .section platypus,"ax"
+ .long .text
+
+ .text
+ b _start@plt
+ nop
diff --git a/ld/testsuite/ld-sh/sh64/gotplt.d b/ld/testsuite/ld-sh/sh64/gotplt.d
new file mode 100644
index 0000000..3339a65
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/gotplt.d
@@ -0,0 +1,12 @@
+#source: gotplt.s
+#as: --abi=32 --isa=SHmedia
+#ld: -shared -mshelf32 --version-script=$srcdir/$subdir/gotplt.map
+#readelf: -r
+#target: sh64-*-elf
+
+# Make sure that gotplt relocations of forced local symbols
+# use the GOT.
+
+Relocation section '\.rela\.dyn' at offset 0x3fc contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name \+ Addend
+0000052c 000000a5 R_SH_RELATIVE 00000408
diff --git a/ld/testsuite/ld-sh/sh64/gotplt.map b/ld/testsuite/ld-sh/sh64/gotplt.map
new file mode 100644
index 0000000..a27c22c
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/gotplt.map
@@ -0,0 +1,4 @@
+GLIBC_2.2 {
+ local:
+ xxx;
+};
diff --git a/ld/testsuite/ld-sh/sh64/gotplt.s b/ld/testsuite/ld-sh/sh64/gotplt.s
new file mode 100644
index 0000000..45ed0b2
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh64/gotplt.s
@@ -0,0 +1,8 @@
+ .text
+ .global xxx
+xxx:
+ ptabs r18, tr0
+ blink tr0, r63
+ .global yyy
+yyy:
+ movi ((xxx@GOTPLT) & 65535), r1