This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, avr] Add 32 bit PC relative relocation


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.

Attachment: pc-relative-reloc.patch
Description: pc-relative-reloc.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]