From e4ef1b6c3fee295ab41138bf77a82dff16f1d7c3 Mon Sep 17 00:00:00 2001 From: Denis Chertykov Date: Thu, 10 Apr 2014 19:50:33 +0400 Subject: bfd/ChangeLog * elf32-avr.c: Add DIFF relocations for AVR. (avr_final_link_relocate): Handle the DIFF relocs. (bfd_elf_avr_diff_reloc): New. (elf32_avr_is_diff_reloc): New. (elf32_avr_adjust_diff_reloc_value): Reduce difference value. (elf32_avr_relax_delete_bytes): Recompute difference after deleting bytes. * reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations gas/ChangeLog * config/tc-avr.c: Add new flag mlink-relax. (md_show_usage): Add flag and help text. (md_parse_option): Record whether link relax is turned on. (relaxable_section): New. (avr_validate_fix_sub): New. (avr_force_relocation): New. (md_apply_fix): Generate DIFF reloc. (avr_allow_local_subtract): New. * config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0. (TC_FORCE_RELOCATION): Define. (TC_FORCE_RELOCATION_SUB_SAME): Define. (TC_VALIDATE_FIX_SUB): Define. (avr_force_relocation): Declare. (avr_validate_fix_sub): Declare. (md_allow_local_subtract): Define. (avr_allow_local_subtract): Declare. gas/testsuite/ChangeLog * gas/avr/diffreloc_withrelax.d: New testcase. * gas/avr/noreloc_withoutrelax.d: Likewise. * gas/avr/relax.s: Likewise. include/ChangeLog * elf/avr.h: Add new DIFF relocs. ld/testsuite/ChangeLog * ld-avr/norelax_diff.d: New testcase. * ld-avr/relax_diff.d: Likewise. * ld-avr/relax.s: Likewise. --- ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-avr/avr.exp | 31 +++++++++++++++++++++++++++++++ ld/testsuite/ld-avr/norelax_diff.d | 13 +++++++++++++ ld/testsuite/ld-avr/relax.s | 12 ++++++++++++ ld/testsuite/ld-avr/relax_diff.d | 14 ++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 ld/testsuite/ld-avr/avr.exp create mode 100644 ld/testsuite/ld-avr/norelax_diff.d create mode 100644 ld/testsuite/ld-avr/relax.s create mode 100644 ld/testsuite/ld-avr/relax_diff.d (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index cbc12f6..e239ce8 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-04-10 Senthil Kumar Selvaraj + + * ld-avr/norelax_diff.d: New testcase. + * ld-avr/relax_diff.d: Likewise. + * ld-avr/relax.s: Likewise. + 2014-04-05 Andreas Schwab * ld-plugin/lto.exp: Make "-Wp," prefix optional when filtering diff --git a/ld/testsuite/ld-avr/avr.exp b/ld/testsuite/ld-avr/avr.exp new file mode 100644 index 0000000..d196d96 --- /dev/null +++ b/ld/testsuite/ld-avr/avr.exp @@ -0,0 +1,31 @@ +# Copyright 2014 +# Free Software Foundation, Inc. + +# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# +# Some AVR tests +# + +if {![istarget avr-*-*]} { + return +} + +set avr_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach avr_test $avr_test_list { + verbose [file rootname $avr_test] + run_dump_test [file rootname $avr_test] +} + diff --git a/ld/testsuite/ld-avr/norelax_diff.d b/ld/testsuite/ld-avr/norelax_diff.d new file mode 100644 index 0000000..1891d6e --- /dev/null +++ b/ld/testsuite/ld-avr/norelax_diff.d @@ -0,0 +1,13 @@ +#name: AVR No change in behavior without relaxation +#as: -mmcu=avrxmega2 +#ld: -mavrxmega2 +#source: relax.s +#objdump: -s +#target: avr-*-* + +.*: file format elf32-avr + +Contents of section .text: + 0000 0c940000 .* +Contents of section .data: + 802000 0400 .* diff --git a/ld/testsuite/ld-avr/relax.s b/ld/testsuite/ld-avr/relax.s new file mode 100644 index 0000000..fbb7bae --- /dev/null +++ b/ld/testsuite/ld-avr/relax.s @@ -0,0 +1,12 @@ + .file "relax.s" +.section .text,"ax",@progbits +main: +L1: + jmp L1 +L2: +.global x + .section .data + .type x, @object + .size x, 2 +x: + .word L2 - L1 diff --git a/ld/testsuite/ld-avr/relax_diff.d b/ld/testsuite/ld-avr/relax_diff.d new file mode 100644 index 0000000..b84df81 --- /dev/null +++ b/ld/testsuite/ld-avr/relax_diff.d @@ -0,0 +1,14 @@ +#name: AVR Account for relaxation in label differences +#as: -mmcu=avrxmega2 -mlink-relax +#ld: -mavrxmega2 --relax +#source: relax.s +#objdump: -s +#target: avr-*-* + +.*: file format elf32-avr + +Contents of section .text: + 0000 ffcf .* +Contents of section .data: + 802000 0200 .* + -- cgit v1.1