From b5f5fd962ef368674d3460bf78a9c6d13a2ab72b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 13 Nov 2007 10:40:29 +0000 Subject: * config/tc-mn10300.c (mn10300_force_relocation): Force a reloc to be generated for alignment fixups. * config/tc-mn10300.h (TC_FORCE_RELOCATION): Call mn10300_force_relocation. * elf-m10300.c (mn10300_elf_final_link_relocate): Prevent the accidental termination of DWARF location list entries. (mn10300_elf_relax_delete_bytes): Stop deletion if an align reloc is encountered that is larger than or not a mutliple of the number of bytes being deleted. When adjusting symbols, any symbols inside the region being deleted must be moved to the end of the region. Move align relocs forward if there is room for them after the deletion of the region. --- ld/testsuite/ChangeLog | 8 ++++++++ ld/testsuite/ld-mn10300/i127740.d | 17 +++++++++++++++++ ld/testsuite/ld-mn10300/i127740.s | 12 ++++++++++++ ld/testsuite/ld-mn10300/i135409-3.d | 16 ++++++++++++++++ ld/testsuite/ld-mn10300/i135409-3.s | 16 ++++++++++++++++ ld/testsuite/ld-mn10300/mn10300.exp | 16 ++++++++++++++++ 6 files changed, 85 insertions(+) create mode 100644 ld/testsuite/ld-mn10300/i127740.d create mode 100644 ld/testsuite/ld-mn10300/i127740.s create mode 100644 ld/testsuite/ld-mn10300/i135409-3.d create mode 100644 ld/testsuite/ld-mn10300/i135409-3.s (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 0805299..83fce11 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2007-11-13 Nick Clifton + + * ld-mn10300/i127740.s: New test: Checks relaxation and alignment. + * ld-mn10300/i127740.d: New file: Expected disassembly. + * ld-mn10300/i135409-3.s: New test: Check symbols inside a relaxed region. + * ld-mn10300/i135409-3.d: New file: Expected disassembly. + * ld-mn10300/mn10300.exp: Run new tests. + 2007-11-08 Nathan Sidwell * ld-vxworks/tls-2.d: New. diff --git a/ld/testsuite/ld-mn10300/i127740.d b/ld/testsuite/ld-mn10300/i127740.d new file mode 100644 index 0000000..456a75b --- /dev/null +++ b/ld/testsuite/ld-mn10300/i127740.d @@ -0,0 +1,17 @@ + +tmpdir/i127740.x: file format elf32-.* + +Disassembly of section .text: + +0+0100 <_main>: + 100: 2d 00 03[ ]+mov 768,d1 + 103: cb[ ]+nop + 104: cb[ ]+nop + 105: cb[ ]+nop + ... + +0+0200 <_dummy>: + 200: 00[ ]+clr d0 + 201: 02 00 00[ ]+movbu d0,\(0 <_main-0x100>\) + 204: df 00 00[ ]+ret \[\],0 + ... diff --git a/ld/testsuite/ld-mn10300/i127740.s b/ld/testsuite/ld-mn10300/i127740.s new file mode 100644 index 0000000..358266b --- /dev/null +++ b/ld/testsuite/ld-mn10300/i127740.s @@ -0,0 +1,12 @@ + .section .text + .global _main + .global _dummy +_main: + mov _g_label,d1 # instruction is changed by relaxations + + .balign 0x100 +_dummy: + .long _dummy + ret [],0 + .size _main, .-_main + .comm _g_label,4,4 diff --git a/ld/testsuite/ld-mn10300/i135409-3.d b/ld/testsuite/ld-mn10300/i135409-3.d new file mode 100644 index 0000000..1ea91ba --- /dev/null +++ b/ld/testsuite/ld-mn10300/i135409-3.d @@ -0,0 +1,16 @@ + +tmpdir/i135409-3.x: file format elf32-.* + +Disassembly of section .text: + +0+0 <_func>: + 0: 25 1f 00[ ]+mov 31,a1 + 3: cb[ ]+nop + +0+04 : + 4: 25 1f 00[ ]+mov 31,a1 + 7: cb[ ]+nop + +0+08 : + 8: e1[ ]+add d0,d1 +#pass diff --git a/ld/testsuite/ld-mn10300/i135409-3.s b/ld/testsuite/ld-mn10300/i135409-3.s new file mode 100644 index 0000000..e83ad96 --- /dev/null +++ b/ld/testsuite/ld-mn10300/i135409-3.s @@ -0,0 +1,16 @@ + .text + .global _start +_start: + .type _func, @function +_func: + mov L001,A1 + nop +A: + mov L001,A1 +BOTTOM: + .balign 0x8 + add D0,D1 + .size _func, .-func + + .data +L001: diff --git a/ld/testsuite/ld-mn10300/mn10300.exp b/ld/testsuite/ld-mn10300/mn10300.exp index 18bbad3..232a5fb 100644 --- a/ld/testsuite/ld-mn10300/mn10300.exp +++ b/ld/testsuite/ld-mn10300/mn10300.exp @@ -48,6 +48,14 @@ set mn10300_tests { "i112045-3.x" } { + "relaxation and alignment directives" + "-relax -Ttext 100" + "" + { "i127740.s" } + { {objdump -d i127740.d} } + "i127740.x" + } + { "adjustment of symbols due to relaxation" "-Tdata 1f -Ttext 0 -relax" "" @@ -63,6 +71,14 @@ set mn10300_tests { { {readelf --syms i135409-2.d} } "i135409-2.x" } + { + "adjustment of symbols due to relaxation (with a symbol in the deleted region)" + "-Tdata 1f -Ttext 0 -relax" + "" + { "i135409-3.s" } + { {objdump -d i135409-3.d} } + "i135409-3.x" + } } run_ld_link_tests $mn10300_tests -- cgit v1.1