[patch] Fix readelf warning for AVR target relocations
Sivanupandi, Pitchumani
Pitchumani.Sivanupandi@atmel.com
Fri Apr 29 10:10:00 GMT 2016
Hi,
Readelf would complain about AVR target relocations when debug dump. This patch
allows readelf to recognize few of AVR target DIFF relocations.
Example:
$avr-as -g gas/testsuite/gas/lns/lns-duplicate.s -o lns-duplicate.o
$avr-readelf -wlr lns-duplicate.o
Warning: unable to apply unsupported reloc type 31 to section .debug_line
Warning: unable to apply unsupported reloc type 32 to section .debug_aranges
$avr-as -g gas/testsuite/gas/lns/lns-big-delta.s -o lns-big-delta.o
$avr-readelf -wlr lns-big-delta.o
Warning: unable to apply unsupported reloc type 31 to section .debug_line
Warning: unable to apply unsupported reloc type 32 to section .debug_aranges
Also, 'R_AVR_32_PCREL' relocation is recognized as 32 bit pc relocation.
If Ok, could someone commit please? I do not have commit access.
NOTE: tests in lns.exp shall run during make check if avr is marked
as elf target (Ref: https://sourceware.org/ml/binutils/2016-04/msg00395.html)
Regards,
Pitchumani
binutils/ChangeLog
2016-04-29 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
* readelf.c (is_32bit_pcrel_reloc): Return true if reloc is 32-bit PC
relocation for AVR target.
(is_none_reloc): Return true if reloc is any of AVR diff relocations.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cf91755..e647d37 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -11705,6 +11705,9 @@ is_32bit_pcrel_reloc (unsigned int reloc_type)
case EM_XTENSA_OLD:
case EM_XTENSA:
return reloc_type == 14; /* R_XTENSA_32_PCREL. */
+ case EM_AVR_OLD:
+ case EM_AVR:
+ return reloc_type == 36; /* R_AVR_32_PCREL. */
default:
/* Do not abort or issue an error message here. Not all targets use
pc-relative 32-bit relocs in their DWARF debug information and we
@@ -11928,6 +11931,12 @@ is_none_reloc (unsigned int reloc_type)
|| reloc_type == 19 /* R_XTENSA_DIFF32. */);
case EM_METAG:
return reloc_type == 3; /* R_METAG_NONE. */
+ case EM_AVR_OLD:
+ case EM_AVR:
+ return (reloc_type == 0 /* R_AVR_NONE. */
+ || reloc_type == 30 /* R_AVR_DIFF8. */
+ || reloc_type == 31 /* R_AVR_DIFF16. */
+ || reloc_type == 32 /* R_AVR_DIFF32. */);
}
return FALSE;
}
More information about the Binutils
mailing list