[PATCH] D61973: [AArch64] Support .reloc *, R_AARCH64_NONE, *

Ryan Prichard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 23:22:13 PDT 2019


rprichard added a comment.

FWIW: I noticed that the binutils assembler's .reloc directive can reference an arbitrary symbol whereas with this patch, a .reloc directive referencing a label turns into a section reference. e.g.:

  $ cat test.s
    nop
  foo:
    nop
  bar:
    .reloc bar, R_AARCH64_NONE, foo
    .reloc bar, R_AARCH64_NONE, .text + 8
  
  $ clang test.s -target aarch64-linux-gnu -c && readelf -r test.o
  
  Relocation section '.rela.text' at offset 0xc0 contains 2 entries:
    Offset          Info           Type           Sym. Value    Sym. Name + Addend
  000000000008  000400000000 R_AARCH64_NONE    0000000000000000 .text + 4
  000000000008  000400000000 R_AARCH64_NONE    0000000000000000 .text + 8
  
  $ clang test.s -target aarch64-linux-gnu -c -fno-integrated-as && readelf -r test.o
  
  Relocation section '.rela.text' at offset 0x100 contains 2 entries:
    Offset          Info           Type           Sym. Value    Sym. Name + Addend
  000000000008  000500000000 R_AARCH64_NONE    0000000000000004 foo + 0
  000000000008  000100000000 R_AARCH64_NONE    0000000000000000 .text + 8

I see the same difference with the MIPS LLVM backend versus `/usr/bin/mipsel-linux-gnu-as`, so this is probably fine. I think referencing a section would be sufficient for the crtbegin usage described in D61825 <https://reviews.llvm.org/D61825>.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61973/new/

https://reviews.llvm.org/D61973





More information about the llvm-commits mailing list