This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch, avr] Add 32 bit PC relative relocation
- From: Denis Chertykov <chertykov at gmail dot com>
- To: "Sivanupandi, Pitchumani" <Pitchumani dot Sivanupandi at atmel dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 8 Jul 2015 21:44:01 +0300
- Subject: Re: [patch, avr] Add 32 bit PC relative relocation
- Authentication-results: sourceware.org; auth=none
- References: <CAC140656783604CABA6AE60C2A6D5A4A267790F at penmbx01>
2015-07-06 15:03 GMT+03:00 Sivanupandi, Pitchumani
<Pitchumani.Sivanupandi@atmel.com>:
>
> This patch adds PC relative difference relocation for AVR target. This
> relocation is needed when generating per-function section names for dwarf
> line information.
>
> Consider the following test case that is failing when assemble with
> '--gdwarf-sections' option.
> Test case:
> volatile int x;
> void foo()
> {
> x++;
> }
> int main()
> {
> foo();
> return x;
> }
>
> Command line: avr-gcc test.c -mmcu=atmega1280 -Wa,--gdwarf-sections -g1
>
> Error messages:
> /tmp/cc83MGOI.s: Assembler messages:
> /tmp/cc83MGOI.s: Error: can't resolve `.debug_line_end' {.debug_line_end section} - `.Ldebug_line_start' {.debug_line section}
>
>
> This patch defines DIFF_EXPR_OK for avr target to allow PC relative difference
> relocation. When generating relocation (tc_gen_reloc) 32 bit relocation fixup
> is changed to new 32 bit PC relative relocation if the fixup has pc-relative
> flag set.
>
> This relocation and fixup updates are similar to ARM target.
> Is this approach is ok?
>
> I have ran the regression test for binutils, gas, ld and gcc using avrtest.
> No regression found.
>
> If OK, could someone commit please? I do not have commit access.
>
> Regards,
> Pitchumani
>
> bfd/ChangeLog
>
> 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> * elf32-avr.c: Add 32 bit PC relative relocation for AVR target.
>
> gas/ChangeLog
>
> 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> * config/tc-avr.c (tc_gen_reloc): Change 32 bit relocation to
> 32 bit PC relative and update offset if the fixup is pc-relative.
> * config/tc-avr.h (DIFF_EXPR_OK): Define to enable PC relative diff
> relocs.
>
> gas/testsuite/ChangeLog
>
> 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> * gas/avr/pc-relative-reloc.d: New test for 32 bit pc relative reloc.
> * gas/avr/per-function-debugline.s: New test source.
>
> include/ChangeLog
>
> 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> * elf/avr.h: Add new 32 bit PC relative relocation.
>
> ld/testsuite/ChangeLog
>
> 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
>
> * ld-avr/gc-section-debugline.d: New test.
> * ld-avr/per-function-debugline.s: Source for new test.
Committed.
Denis.