]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch 'binutils-
authornobody <>
Mon, 21 Oct 2002 14:59:31 +0000 (14:59 +0000)
committernobody <>
Mon, 21 Oct 2002 14:59:31 +0000 (14:59 +0000)
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

14 files changed:
gas/testsuite/gas/mips/elf-rel7.d [new file with mode: 0644]
gas/testsuite/gas/mips/elf-rel7.s [new file with mode: 0644]
ld/testsuite/ld-i386/combreloc.d [new file with mode: 0644]
ld/testsuite/ld-i386/combreloc.s [new file with mode: 0644]
ld/testsuite/ld-i386/reloc.d [new file with mode: 0644]
ld/testsuite/ld-i386/reloc.s [new file with mode: 0644]
ld/testsuite/ld-i386/tlsindntpoff.dd [new file with mode: 0644]
ld/testsuite/ld-i386/tlsindntpoff.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/powerpc.exp [new file with mode: 0644]
ld/testsuite/ld-powerpc/reloc.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/reloc.s [new file with mode: 0644]
ld/testsuite/ld-sh/sh64/gotplt.d [new file with mode: 0644]
ld/testsuite/ld-sh/sh64/gotplt.map [new file with mode: 0644]
ld/testsuite/ld-sh/sh64/gotplt.s [new file with mode: 0644]

diff --git a/gas/testsuite/gas/mips/elf-rel7.d b/gas/testsuite/gas/mips/elf-rel7.d
new file mode 100644 (file)
index 0000000..d72ae15
--- /dev/null
@@ -0,0 +1,31 @@
+#objdump: -dr --prefix-addresses
+#name: MIPS ELF reloc 7
+
+.*: +file format elf.*mips.*
+
+Disassembly of section \.text:
+0+00 <.*> lui  a0,0x0
+                       0: R_MIPS_HI16  .barsec
+0+04 <.*> lw   a0,8\(a0\)
+                       4: R_MIPS_LO16  .barsec
+0+08 <.*> lui  a0,0x0
+                       8: R_MIPS_HI16  bar
+0+0c <.*> lw   a0,4\(a0\)
+                       c: R_MIPS_LO16  bar
+0+10 <.*> lui  a0,0x0
+                       10: R_MIPS_HI16 bar
+0+14 <.*> lw   a0,8\(a0\)
+                       14: R_MIPS_LO16 bar
+0+18 <.*> lui  a0,0x0
+                       18: R_MIPS_HI16 frob
+0+1c <.*> lw   a0,0\(a0\)
+                       1c: R_MIPS_LO16 frob
+0+20 <.*> lui  a0,0x0
+                       20: R_MIPS_HI16 frob
+0+24 <.*> lw   a0,4\(a0\)
+                       24: R_MIPS_LO16 frob
+0+28 <.*> lui  a0,0x0
+                       28: R_MIPS_HI16 frob
+0+2c <.*> lw   a0,16\(a0\)
+                       2c: R_MIPS_LO16 frob
+#pass
diff --git a/gas/testsuite/gas/mips/elf-rel7.s b/gas/testsuite/gas/mips/elf-rel7.s
new file mode 100644 (file)
index 0000000..15665ee
--- /dev/null
@@ -0,0 +1,12 @@
+       .global frob
+       .section .barsec,"aM",@progbits,8
+       .word   0,1
+bar:   .word   2,3
+frob:  .word   4,5
+       .text
+foo:   lw      $4,bar
+       lw      $4,bar+4
+       lw      $4,bar+8
+       lw      $4,frob
+       lw      $4,frob+4
+       lw      $4,frob+16
diff --git a/ld/testsuite/ld-i386/combreloc.d b/ld/testsuite/ld-i386/combreloc.d
new file mode 100644 (file)
index 0000000..762f481
--- /dev/null
@@ -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 (file)
index 0000000..2a78a7c
--- /dev/null
@@ -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 (file)
index 0000000..9e8faa4
--- /dev/null
@@ -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 (file)
index 0000000..0e3ff1d
--- /dev/null
@@ -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 (file)
index 0000000..db20de1
--- /dev/null
@@ -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 (file)
index 0000000..4bc93f6
--- /dev/null
@@ -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 (file)
index 0000000..f52278d
--- /dev/null
@@ -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 (file)
index 0000000..08a209d
--- /dev/null
@@ -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 (file)
index 0000000..4e66151
--- /dev/null
@@ -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 (file)
index 0000000..3339a65
--- /dev/null
@@ -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 (file)
index 0000000..a27c22c
--- /dev/null
@@ -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 (file)
index 0000000..45ed0b2
--- /dev/null
@@ -0,0 +1,8 @@
+       .text
+       .global xxx
+xxx:
+       ptabs   r18, tr0
+       blink   tr0, r63
+       .global yyy
+yyy:
+       movi    ((xxx@GOTPLT) & 65535), r1