aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-09-19 08:06:11 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-09-19 08:06:11 +0000
commit18e04883d03f67a6b9ec701089494d92841b92fd (patch)
tree144531f36fa1eb2069710f3759c9ed5ed201b499 /ld
parent8179e7399121c25d5e046368d223c3b44c32716a (diff)
downloadgdb-18e04883d03f67a6b9ec701089494d92841b92fd.zip
gdb-18e04883d03f67a6b9ec701089494d92841b92fd.tar.gz
gdb-18e04883d03f67a6b9ec701089494d92841b92fd.tar.bz2
bfd/
* elf-bfd.h (eh_cie_fde): Add personality_offset and make_per_encoding_relative to the CIE structure. Add a padding field. * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Use 0x70 rather than 0xf0 when masking out the base address encoding Record the offset of personality data from the start of the CIE. Remove a repeated elf_backend_can_make_relative_eh_frame check. (find_merged_cie): Take an info argument. If the personality binds locally, try converting an absolute personality into a local one. (_bfd_elf_discard_section_eh_frame): Use 0x70 rather than 0xf0 when masking out the base address encoding. Update the call to find_merged_cie. (_bfd_elf_eh_frame_section_offset): Discard relocations against the personality data if we are converting into PC-relative form. (_bfd_elf_write_section_eh_frame): Use 0x70 rather than 0xf0 when masking out the base address encoding. Handle make_per_encoding_relative. ld/testsuite/ * ld-mips-elf/eh-frame5.s, ld-mips-elf/eh-frame5.ld, ld-mips-elf/eh-frame5.d: New test. * ld-mips-elf/mips-elf.exp: Run it.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-mips-elf/eh-frame5.d278
-rw-r--r--ld/testsuite/ld-mips-elf/eh-frame5.ld18
-rw-r--r--ld/testsuite/ld-mips-elf/eh-frame5.s107
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp11
5 files changed, 420 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index e19919a..abcda78 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-19 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * ld-mips-elf/eh-frame5.s, ld-mips-elf/eh-frame5.ld,
+ ld-mips-elf/eh-frame5.d: New test.
+ * ld-mips-elf/mips-elf.exp: Run it.
+
2009-09-18 Alan Modra <amodra@bigpond.net.au>
* ld-powerpc/tlsso.d: Update.
diff --git a/ld/testsuite/ld-mips-elf/eh-frame5.d b/ld/testsuite/ld-mips-elf/eh-frame5.d
new file mode 100644
index 0000000..9720890
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/eh-frame5.d
@@ -0,0 +1,278 @@
+
+Relocation section '.rel.dyn' at offset 0x101f0 contains 8 entries:
+ Offset Info Type Sym.Value Sym. Name
+00000000 .* R_MIPS_NONE *
+#
+# The order of the relocations doesn't really matter, but they must
+# be some permutation of the list below.
+#
+00010008 .* R_MIPS_REL32 00000000 pers3
+00000c7b .* R_MIPS_REL32 00000828 global_pers
+00000d7f .* R_MIPS_REL32 00000000 extern_indirect_ptr
+00010000 .* R_MIPS_REL32 00000000 pers1
+00010004 .* R_MIPS_REL32 00000000 pers2
+00000caf .* R_MIPS_REL32 00000000 extern_pers
+00000d4b .* R_MIPS_REL32 00010008 global_indirect_ptr
+Contents of the \.eh_frame section:
+
+# Text addresses
+# --------------
+# f1 = 0x800
+# f2 = 0x804
+# f3 = 0x808
+# f4 = 0x80c
+# f5 = 0x810
+# f6 = 0x814
+# f7 = 0x818
+# f8 = 0x81c
+# local_pers = 0x820
+# hidden_pers = 0x824
+# global_pers = 0x828
+
+# Data addresses
+# --------------
+# local_indirect_ptr = 0x10000
+# hidden_indirect_ptr = 0x10004
+# global_indirect_ptr = 0x10008
+# LSDA = 0x1000c
+
+#-------------------------------------------------------------------------
+# f1
+#-------------------------------------------------------------------------
+00000000 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xc12: DW_EH_PE_pcrel for personality encoding
+# 0xc13: 0x820 - 0xc13 (local_pers - .)
+# 0xc17: DW_EH_PE_pcrel for LDSA encoding
+# 0xc18: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 10 ff ff fc 0d 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+0000001c 00000014 00000020 FDE cie=00000000 pc=00000800..00000804
+#
+# 0xc2d: 0x1000c - 0xc2d (LDSA - .)
+#
+ Augmentation data: 00 00 f3 df
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f2
+#-------------------------------------------------------------------------
+00000034 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xc46: DW_EH_PE_pcrel for personality encoding
+# 0xc47: 0x824 - 0xc47 (hidden_pers - .)
+# 0xc4d: DW_EH_PE_pcrel for LDSA encoding
+# 0xc4e: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 10 ff ff fb dd 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+00000050 00000014 00000020 FDE cie=00000034 pc=00000804..00000808
+#
+# 0xc61: 0x1000c - 0xc61 (LDSA - .)
+#
+ Augmentation data: 00 00 f3 ab
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f3
+#-------------------------------------------------------------------------
+00000068 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xc7a: DW_EH_PE_absptr for personality encoding
+# 0xc7b: global_pers (reloc above)
+# 0xc7f: DW_EH_PE_pcrel for LDSA encoding
+# 0xc80: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 00 00 00 00 00 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+00000084 00000014 00000020 FDE cie=00000068 pc=00000808..0000080c
+#
+# 0xc95: 0x1000c - 0xc95 (LDSA - .)
+#
+ Augmentation data: 00 00 f3 77
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f4
+#-------------------------------------------------------------------------
+0000009c 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xcae: DW_EH_PE_absptr for personality encoding
+# 0xcaf: extern_pers (reloc above)
+# 0xcb3: DW_EH_PE_pcrel for LDSA encoding
+# 0xcb4: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 00 00 00 00 00 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+000000b8 00000014 00000020 FDE cie=0000009c pc=0000080c..00000810
+#
+# 0xcc9: 0x1000c - 0xcc9 (LDSA - .)
+#
+ Augmentation data: 00 00 f3 43
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f5
+#-------------------------------------------------------------------------
+000000d0 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xce2: DW_EH_PE_indirect | DW_EH_PE_pcrel for personality encoding
+# 0xce3: 0x10000 - 0xce3 (local_indirect_ptr - .)
+# 0xce7: DW_EH_PE_pcrel for LDSA encoding
+# 0xce8: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 90 00 00 f3 1d 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+000000ec 00000014 00000020 FDE cie=000000d0 pc=00000810..00000814
+#
+# 0xcfd: 0x1000c - 0xcfd (LDSA - .)
+#
+ Augmentation data: 00 00 f3 0f
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f6
+#-------------------------------------------------------------------------
+00000104 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xd16: DW_EH_PE_pcrel for personality encoding
+# 0xd17: 0x10004 - 0xd17 (hidden_indirect_ptr - .)
+# 0xd1d: DW_EH_PE_pcrel for LDSA encoding
+# 0xd1e: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 90 00 00 f2 ed 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+00000120 00000014 00000020 FDE cie=00000104 pc=00000814..00000818
+#
+# 0xd31: 0x1000c - 0xd31 (LDSA - .)
+#
+ Augmentation data: 00 00 f2 db
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f7
+#-------------------------------------------------------------------------
+00000138 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xd4a: DW_EH_PE_indirect | DW_EH_PE_absptr for personality encoding
+# 0xd4b: global_indirect_ptr (reloc above)
+# 0xd4f: DW_EH_PE_pcrel for LDSA encoding
+# 0xd50: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 80 00 00 00 00 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+00000154 00000014 00000020 FDE cie=00000138 pc=00000818..0000081c
+#
+# 0xd65: 0x1000c - 0xd65 (LDSA - .)
+#
+ Augmentation data: 00 00 f2 a7
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+#-------------------------------------------------------------------------
+# f8
+#-------------------------------------------------------------------------
+0000016c 00000018 00000000 CIE
+ Version: 1
+ Augmentation: "zPLR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 31
+#
+# 0xd7e: DW_EH_PE_indirect | DW_EH_PE_absptr for personality encoding
+# 0xd7f: extern_indirect_ptr (reloc above)
+# 0xd83: DW_EH_PE_pcrel for LDSA encoding
+# 0xd84: DW_EH_PE_pcrel | DW_EH_PE_sdata4 for FDE encoding
+#
+ Augmentation data: 80 00 00 00 00 10 1b
+
+ DW_CFA_def_cfa_register: r29
+ DW_CFA_nop
+
+00000188 00000014 00000020 FDE cie=0000016c pc=0000081c..00000820
+#
+# 0xd99: 0x1000c - 0xd99 (LDSA - .)
+#
+ Augmentation data: 00 00 f2 73
+
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
diff --git a/ld/testsuite/ld-mips-elf/eh-frame5.ld b/ld/testsuite/ld-mips-elf/eh-frame5.ld
new file mode 100644
index 0000000..f00cb27
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/eh-frame5.ld
@@ -0,0 +1,18 @@
+SECTIONS
+{
+ . = 0;
+ .reginfo : { *(.reginfo) }
+ .dynamic : { *(.dynamic) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .rel.dyn : { *(.rel.dyn) }
+ . = 0x800;
+ .text : { *(.text) }
+ . = 0xc00;
+ .eh_frame : { *(.eh_frame) }
+ . = 0x10000;
+ .data : { *(.data) }
+ . = 0x10400;
+ _gp = . + 0x7ff0;
+ .got : { *(.got) }
+}
diff --git a/ld/testsuite/ld-mips-elf/eh-frame5.s b/ld/testsuite/ld-mips-elf/eh-frame5.s
new file mode 100644
index 0000000..741a021
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/eh-frame5.s
@@ -0,0 +1,107 @@
+ .cfi_startproc
+ .cfi_personality 0x0,local_pers
+ .cfi_lsda 0x0,LSDA
+ .ent f1
+f1:
+ nop
+ .end f1
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x0,hidden_pers
+ .cfi_lsda 0x0,LSDA
+ .ent f2
+f2:
+ nop
+ .end f2
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x0,global_pers
+ .cfi_lsda 0x0,LSDA
+ .ent f3
+f3:
+ nop
+ .end f3
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x0,extern_pers
+ .cfi_lsda 0x0,LSDA
+ .ent f4
+f4:
+ nop
+ .end f4
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x80,local_indirect_ptr
+ .cfi_lsda 0x0,LSDA
+ .ent f5
+f5:
+ nop
+ .end f5
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x80,hidden_indirect_ptr
+ .cfi_lsda 0x0,LSDA
+ .ent f6
+f6:
+ nop
+ .end f6
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x80,global_indirect_ptr
+ .cfi_lsda 0x0,LSDA
+ .ent f7
+f7:
+ nop
+ .end f7
+ .cfi_endproc
+
+ .cfi_startproc
+ .cfi_personality 0x80,extern_indirect_ptr
+ .cfi_lsda 0x0,LSDA
+ .ent f8
+f8:
+ nop
+ .end f8
+ .cfi_endproc
+
+
+ .ent local_pers
+local_pers:
+ nop
+ .end local_pers
+
+ .globl hidden_pers
+ .hidden hidden_pers
+ .ent hidden_pers
+hidden_pers:
+ nop
+ .end hidden_pers
+
+ .globl global_pers
+ .ent global_pers
+global_pers:
+ nop
+ .end global_pers
+
+ .section .data,"aw",@progbits
+
+local_indirect_ptr:
+ .4byte pers1
+
+ .globl hidden_indirect_ptr
+ .hidden hidden_indirect_ptr
+hidden_indirect_ptr:
+ .4byte pers2
+
+ .globl global_indirect_ptr
+global_indirect_ptr:
+ .4byte pers3
+
+LSDA:
+ .4byte 0
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index bd06d20..7622ac3 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -304,6 +304,17 @@ if {$embedded_elf} {
run_dump_test "eh-frame3"
run_dump_test "eh-frame4"
}
+if {$linux_gnu} {
+ set eh_frame5_test {
+ {"MIPS eh-frame 5"
+ "-melf32btsmip -shared -Teh-frame5.ld"
+ "-32 -EB"
+ {eh-frame5.s}
+ {{readelf {--relocs -wf} eh-frame5.d}}
+ "eh-frame5.so"}
+ }
+ run_ld_link_tests $eh_frame5_test
+}
run_dump_test "jaloverflow"
run_dump_test "jaloverflow-2"