[PATCH] D37615: [AVR] implement the relocation of LDI and other Instructions for LLD

Leslie Zhai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 02:03:40 PDT 2017


xiangzhai updated this revision to Diff 114782.
xiangzhai added a comment.

Add testcase for `R_AVR_LDS_STS_16`.

  $ avr-readelf -r tiny-avr.o 
  
  Relocation section '.rela.text' at offset 0xa4 contains 2 entries:
   Offset     Info    Type            Sym.Value  Sym. Name + Addend
  00000000  00000121 R_AVR_LDS_STS_16  00000000   .text + 2
  00000002  00000103 R_AVR_13_PCREL    00000000   .text + 2

only for AVR Tiny family:

  $ avr-readelf -h tiny-avr.o 
  ELF Header:
    Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
    Class:                             ELF32
    Data:                              2's complement, little endian
    Version:                           1 (current)
    OS/ABI:                            UNIX - System V
    ABI Version:                       0
    Type:                              REL (Relocatable file)
    Machine:                           Atmel AVR 8-bit microcontroller
    Version:                           0x1
    Entry point address:               0x0
    Start of program headers:          0 (bytes into file)
    Start of section headers:          240 (bytes into file)
    Flags:                             0xe4, avr:100, link-relax
    Size of this header:               52 (bytes)
    Size of program headers:           0 (bytes)
    Number of program headers:         0
    Size of section headers:           40 (bytes)
    Number of section headers:         8
    Section header string table index: 5

LLD:

  $ avr-objdump -d tiny-avr-lld 
  
  tiny-avr-lld:     file format elf32-avr
  
  
  Disassembly of section .text:
  
  00000040 <main>:
    40:   12 a1           ldd     r17, Z+34       ; 0x22
  
  00000042 <foo>:
    42:   ff cf           rjmp    .-2             ; 0x42 <foo>


Repository:
  rL LLVM

https://reviews.llvm.org/D37615

Files:
  ELF/Arch/AVR.cpp
  test/ELF/basic-avr.s
  test/ELF/tiny-avr.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37615.114782.patch
Type: text/x-patch
Size: 8477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/cd92eefc/attachment.bin>


More information about the llvm-commits mailing list