[PATCH] D76575: [LLD][ELF][ARM] Replace assembler files with yaml

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 13:38:51 PDT 2020


MaskRay added a comment.

In D76575#1936275 <https://reviews.llvm.org/D76575#1936275>, @grimar wrote:

> I think it is fine. When llvm-mc can't be used it is a job for yaml2obj.
>
> I've investigated one of the test cases and put few comments about excessive YAML parts mostly.
>  These comments seems are general and can be applied to other tests added as well.


yaml2obj tests do seem to be more verbose and opaque. I just remembered the `.reloc` directive (e.g. D61992 <https://reviews.llvm.org/D61992>). Ideally we could test with:

  .globl target3
  target3:
  
  .reloc ., R_ARM_THM_PC12, foo
  ldr r2, target3
  # arm-linux-gnueabi-as assembles fine.

However, our use cases are:

- we hope a MCFixupKind corresponding to a short-range relocation gets resolved at assembly time.
- we hope a `.reloc` directive is emitted as is.

The current logic does not meet our needs:

  bool MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
                                            const MCExpr *Expr, SMLoc Loc,
                                            const MCSubtargetInfo &STI) {
    // Name ("R_ARM_THM_PC12") is converted to a MCFixupKind
    Optional<MCFixupKind> MaybeKind = Assembler->getBackend().getFixupKind(Name);

Then, `ARMAsmBackend::getFixupKindInfo` thinks this MCFixupKind should be resolved at assembly time.


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

https://reviews.llvm.org/D76575





More information about the llvm-commits mailing list