aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2006-03-14 07:47:49 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2006-03-14 07:47:49 +0000
commit81d43bffb567f96a583839f2384445f91e69a4fc (patch)
tree71943bdba439e0c3d55eeff065ae9ef4957cf37d /ld
parent2f83030ff55770f7d5382868d0cef5dd7844f4b0 (diff)
downloadgdb-81d43bffb567f96a583839f2384445f91e69a4fc.zip
gdb-81d43bffb567f96a583839f2384445f91e69a4fc.tar.gz
gdb-81d43bffb567f96a583839f2384445f91e69a4fc.tar.bz2
bfd/
* elf32-mips.c (mips_elf_adjust_addend): New function, mostly split out from... (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend for final links too. ld/testsuite/ * ld-mips/emit-relocs-1a.s, ld-mips/emit-relocs-1b.s, * ld-mips/emit-relocs-1.ld, ld-mips/emit-relocs-1.d: New test. * ld-mips/mips-elf.exp: Run it.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-mips-elf/emit-relocs-1.d37
-rw-r--r--ld/testsuite/ld-mips-elf/emit-relocs-1.ld20
-rw-r--r--ld/testsuite/ld-mips-elf/emit-relocs-1a.s22
-rw-r--r--ld/testsuite/ld-mips-elf/emit-relocs-1b.s17
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp4
6 files changed, 106 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 972581c..a9f1357 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-14 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-mips/emit-relocs-1a.s, ld-mips/emit-relocs-1b.s,
+ * ld-mips/emit-relocs-1.ld, ld-mips/emit-relocs-1.d: New test.
+ * ld-mips/mips-elf.exp: Run it.
+
2006-03-07 Richard Sandiford <richard@codesourcery.com>
* ld-arm/vxworks1.dd, ld-arm/vxworks1.ld, ld-arm/vxworks1-lib.dd,
diff --git a/ld/testsuite/ld-mips-elf/emit-relocs-1.d b/ld/testsuite/ld-mips-elf/emit-relocs-1.d
new file mode 100644
index 0000000..520d401
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emit-relocs-1.d
@@ -0,0 +1,37 @@
+#name: Emit relocs 1
+#source: emit-relocs-1a.s -mabi=n32 -EB
+#source: emit-relocs-1b.s -mabi=n32 -EB
+#ld: -q -T emit-relocs-1.ld -melf32btsmipn32
+#objdump: -sr
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE *
+00000000 R_MIPS_32 \.data
+00000004 R_MIPS_32 \.data\+0x00001000
+00000008 R_MIPS_32 \.merge1\+0x00000002
+0000000c R_MIPS_32 \.merge2
+00000010 R_MIPS_32 \.merge3
+00000014 R_MIPS_32 \.merge3\+0x00000004
+00000020 R_MIPS_32 \.data\+0x00000020
+00000024 R_MIPS_32 \.data\+0x00001020
+00000028 R_MIPS_32 \.merge1
+0000002c R_MIPS_32 \.merge2\+0x00000002
+00000030 R_MIPS_32 \.merge3\+0x00000008
+00000034 R_MIPS_32 \.merge3\+0x00000004
+
+
+Contents of section \.text:
+ 80000 03e00008 00000000 00000000 00000000 .*
+Contents of section \.merge1:
+ 80400 666c7574 74657200 flutter.*
+Contents of section \.merge2:
+ 80800 74617374 696e6700 tasting.*
+Contents of section \.merge3:
+ 80c00 00000100 00000200 00000300 .*
+Contents of section \.data:
+ 81000 00081000 00082000 00080402 00080800 .*
+ 81010 00080c00 00080c04 00000000 00000000 .*
+ 81020 00081020 00082020 00080400 00080802 .*
+ 81030 00080c08 00080c04 .*
diff --git a/ld/testsuite/ld-mips-elf/emit-relocs-1.ld b/ld/testsuite/ld-mips-elf/emit-relocs-1.ld
new file mode 100644
index 0000000..1879ef4
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emit-relocs-1.ld
@@ -0,0 +1,20 @@
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x80000;
+ .text : { *(.text) }
+
+ . = ALIGN (0x400);
+ .merge1 : { *(.merge1) }
+
+ . = ALIGN (0x400);
+ .merge2 : { *(.merge2) }
+
+ . = ALIGN (0x400);
+ .merge3 : { *(.merge3) }
+
+ . = ALIGN (0x400);
+ .data : { *(.data) }
+
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-mips-elf/emit-relocs-1a.s b/ld/testsuite/ld-mips-elf/emit-relocs-1a.s
new file mode 100644
index 0000000..9176f97
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emit-relocs-1a.s
@@ -0,0 +1,22 @@
+ .text
+ .globl _start
+_start:
+ jr $31
+
+ .section .merge1,"aMS",@progbits,1
+A: .string "utter"
+
+ .section .merge2,"aMS",@progbits,1
+B: .string "tasting"
+
+ .section .merge3,"aM",@progbits,4
+C: .4byte 0x100
+D: .4byte 0x200
+
+ .data
+E: .4byte E
+ .4byte E + 0x1000
+ .4byte A
+ .4byte B
+ .4byte C
+ .4byte D
diff --git a/ld/testsuite/ld-mips-elf/emit-relocs-1b.s b/ld/testsuite/ld-mips-elf/emit-relocs-1b.s
new file mode 100644
index 0000000..0e88c14
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emit-relocs-1b.s
@@ -0,0 +1,17 @@
+ .section .merge1,"aMS",@progbits,1
+A: .string "flutter"
+
+ .section .merge2,"aMS",@progbits,1
+B: .string "sting"
+
+ .section .merge3,"aM",@progbits,4
+C: .4byte 0x300
+D: .4byte 0x200
+
+ .data
+E: .4byte E
+ .4byte E + 0x1000
+ .4byte A
+ .4byte B
+ .4byte C
+ .4byte D
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index da278ae..aac3418 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -105,6 +105,10 @@ if { $linux_gnu } {
run_dump_test "textrel-1"
}
+if $has_newabi {
+ run_dump_test "emit-relocs-1"
+}
+
# For tests which may involve multiple files, use run_ld_link_tests.
# List contains test-items with 3 items followed by 2 lists: