aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-03-07 08:54:35 +0000
committerAlan Modra <amodra@gmail.com>2007-03-07 08:54:35 +0000
commitab96bf03fd98b6f68cd213ac81f52be3aca9c435 (patch)
tree0ecbe550786caccafc932ac5087e07d9924a1510 /ld
parent057cac083006e9c5e43e5f5ce7ed18730f499af2 (diff)
downloadgdb-ab96bf03fd98b6f68cd213ac81f52be3aca9c435.zip
gdb-ab96bf03fd98b6f68cd213ac81f52be3aca9c435.tar.gz
gdb-ab96bf03fd98b6f68cd213ac81f52be3aca9c435.tar.bz2
PR 3958
bfd/ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link. (elf_discarded_section): Move.. * bfd-in.h: ..to here. * bfd-in2.h: Regenerate. * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols from discarded sections before relocate_section has done its job. * reloc.c (bfd_generic_get_relocated_section_contents): Handle relocs against symbols from discarded sections. * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on SECREL32. (elf_hppa_relocate_section): Handle relocatable link after setting sec, sym, h etc. for final link. Squash error messages for relocatable link. Clear section contents for relocs against symbols in discarded sections, and zero reloc. Remove existing zero r_symndx code. * elf-m10200.c (mn10200_elf_relocate_section): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. (bfin_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-m32c.c (m32c_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-mt.c (mt_elf_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-score.c (_bfd_score_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Always adjust section symbols for relocatable link. Don't use always-zero st_value. (elf_backend_rela_normal): Don't define. * elf32-bfin.c (bfinfdpic_relocate_section): Use RELOC_FOR_GLOBAL_SYMBOL. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE section symbol adjustments with same for relocatable link. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move.. (elf32_m68hc11_check_relocs): ..to here. * elf32-score.c (score_elf_final_link_relocate): Remove zero r_symndx code. * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. ld/testsuite/ * ld-elf/linkonce1.d: New. * ld-elf/linkonce1a.s: New. * ld-elf/linkonce1b.s: New. * ld-elf/linkonce2.d: New. * ld-i386/pcrel16abs.d: New. * ld-i386/pcrel16abs.s: New. * ld-i386/i386.exp: Run it.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/linkonce1.d12
-rw-r--r--ld/testsuite/ld-elf/linkonce1a.s3
-rw-r--r--ld/testsuite/ld-elf/linkonce1b.s17
-rw-r--r--ld/testsuite/ld-elf/linkonce2.d12
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/pcrel16abs.d12
-rw-r--r--ld/testsuite/ld-i386/pcrel16abs.s6
8 files changed, 74 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 9493773..82c0bc9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2007-03-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR 3958
+ * ld-elf/linkonce1.d: New.
+ * ld-elf/linkonce1a.s: New.
+ * ld-elf/linkonce1b.s: New.
+ * ld-elf/linkonce2.d: New.
+ * ld-i386/pcrel16abs.d: New.
+ * ld-i386/pcrel16abs.s: New.
+ * ld-i386/i386.exp: Run it.
+
2007-03-06 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4144
diff --git a/ld/testsuite/ld-elf/linkonce1.d b/ld/testsuite/ld-elf/linkonce1.d
new file mode 100644
index 0000000..35e1787
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkonce1.d
@@ -0,0 +1,12 @@
+#source: linkonce1a.s
+#source: linkonce1b.s
+#ld: -r
+#objdump: -r
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[.debug_frame\]:
+OFFSET[ ]+TYPE[ ]+VALUE[ ]*
+.*(NONE|unused).*\*ABS\*
+
+#pass
diff --git a/ld/testsuite/ld-elf/linkonce1a.s b/ld/testsuite/ld-elf/linkonce1a.s
new file mode 100644
index 0000000..5c2d8c2
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkonce1a.s
@@ -0,0 +1,3 @@
+ .section .gnu.linkonce.d.dummy,"aw"
+bar:
+ .long 0
diff --git a/ld/testsuite/ld-elf/linkonce1b.s b/ld/testsuite/ld-elf/linkonce1b.s
new file mode 100644
index 0000000..fd45cec
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkonce1b.s
@@ -0,0 +1,17 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .long 0
+
+ .section .gnu.linkonce.d.dummy,"aw"
+ .long 0
+foo:
+ .long 0
+ .section .debug_frame,"",%progbits
+ .long foo
diff --git a/ld/testsuite/ld-elf/linkonce2.d b/ld/testsuite/ld-elf/linkonce2.d
new file mode 100644
index 0000000..33eb14f
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkonce2.d
@@ -0,0 +1,12 @@
+#source: linkonce1a.s
+#source: linkonce1b.s
+#ld: -emit-relocs
+#objdump: -r
+
+.*: file format .*
+
+RELOCATION RECORDS FOR \[.debug_frame\]:
+OFFSET[ ]+TYPE[ ]+VALUE[ ]*
+.*(NONE|unused).*\*ABS\*
+
+#pass
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index ad8a610..d0d4cad 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -113,3 +113,4 @@ run_ld_link_tests $i386tests
run_dump_test "abs"
run_dump_test "pcrel8"
run_dump_test "pcrel16"
+run_dump_test "pcrel16abs"
diff --git a/ld/testsuite/ld-i386/pcrel16abs.d b/ld/testsuite/ld-i386/pcrel16abs.d
new file mode 100644
index 0000000..f4bfca5
--- /dev/null
+++ b/ld/testsuite/ld-i386/pcrel16abs.d
@@ -0,0 +1,12 @@
+#name: PCREL16 absolute reloc
+#as: --32
+#ld: -melf_i386 -Ttext 0xfffffff0
+#objdump: -drj.text -m i8086
+
+.*: +file format elf32-i386
+
+Disassembly of section .text:
+
+f+0 <_start>:
+f+0: e9 0d e0[ ]+jmp[ ]+ffffe000 <SEGMENT_SIZE\+0xfffee000>
+#pass
diff --git a/ld/testsuite/ld-i386/pcrel16abs.s b/ld/testsuite/ld-i386/pcrel16abs.s
new file mode 100644
index 0000000..4bf68a7
--- /dev/null
+++ b/ld/testsuite/ld-i386/pcrel16abs.s
@@ -0,0 +1,6 @@
+SEGMENT_SIZE = 0x10000
+RVECTOR = 0x00010
+.code16
+ .globl _start
+_start:
+ jmp SEGMENT_SIZE-(0x1f00 +0xf0 +RVECTOR)