public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix readelf warning for AVR target relocations
@ 2016-04-29 10:10 Sivanupandi, Pitchumani
  2016-04-29 13:07 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Sivanupandi, Pitchumani @ 2016-04-29 10:10 UTC (permalink / raw)
  To: binutils; +Cc: Alan Modra, Denis Chertykov

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;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Fix readelf warning for AVR target relocations
  2016-04-29 10:10 [patch] Fix readelf warning for AVR target relocations Sivanupandi, Pitchumani
@ 2016-04-29 13:07 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2016-04-29 13:07 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani, binutils; +Cc: Alan Modra, Denis Chertykov

Hi Sivanupandi,

> 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.
 
Approved and applied.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-29 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 10:10 [patch] Fix readelf warning for AVR target relocations Sivanupandi, Pitchumani
2016-04-29 13:07 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).