[MC] Support labels as offsets in .reloc directive
authorVladimir Stefanovic <vladimir.stefanovic@rt-rk.com>
Wed, 21 Nov 2018 16:28:39 +0000 (16:28 +0000)
committerVladimir Stefanovic <vladimir.stefanovic@rt-rk.com>
Wed, 21 Nov 2018 16:28:39 +0000 (16:28 +0000)
commit1d2714be13e05d0a134f5936345332ad504e7378
treee7b7dbaaf2c83b35159919cf05738b23d0af385d
parent2359864be2192dfa9d6e6384f5df310b4eae1363
[MC] Support labels as offsets in .reloc directive

Currently, expressions like

  .reloc 1f, R_MIPS_JALR, foo
  1: nop

are not allowed, ie. an offset in .reloc can only be absolute value.
This patch adds support for labels as offsets.
If offset is a forward declared label, MCObjectStreamer keeps the fixup locally
and adds it to the fixups vector after the label (and its offset) is defined.
label+number is not supported yet.

Differential revision: https://reviews.llvm.org/D53990

llvm-svn: 347397
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/test/MC/Mips/reloc-directive-bad-obj.s [new file with mode: 0644]
llvm/test/MC/Mips/reloc-directive-bad.s
llvm/test/MC/Mips/reloc-directive-label-offset.s [new file with mode: 0644]
llvm/test/MC/Mips/reloc-directive-negative.s [deleted file]