Page MenuHomePhabricator

[LLD][ELF][ARM] use reloc directive for Thumb assembler tests
ClosedPublic

Authored by psmith on Apr 1 2020, 1:40 AM.

Details

Summary

In the near future llvm-mc will resolve the fixups that generate R_ARM_THUMB_PC8 and R_ARM_THUMB_PC12 at assembly time (see comments in D72892), and forbid inter-section references. Change the LLD tests for these relocations to use .inst and .reloc to avoid LLD tests failing when this happens. The tests generate the same instructions, relocations and symbols.

I will need to make equivalent changes for D75349 Arm equivalent relocations, but this is still in review so these don't need changing before llvm-mc.

As the adr and ldr instructions have fixups with special cases for irregular addends, attempts at manipulating the instructions to create the initial addends I needed failed. It was simpler to use .inst to encode the bit-pattern I needed without any relocations.

I noticed that .reloc wasn't behaving well when an Alignment or Padding fragment had been inserted. I've replaced the few inline .balign directives with nops in this case. Will need to look into MC and raise a PR if there is a problem.

Diff Detail

Event Timeline

psmith created this revision.Apr 1 2020, 1:40 AM
MaskRay accepted this revision.Apr 1 2020, 8:25 AM

LGTM.

use reloc directive for Thumb assembler tests

Maybe reloc -> .reloc

I noticed that .reloc wasn't behaving well when an Alignment or Padding fragment had been inserted. I've replaced the few inline .balign directives with nops in this case. Will need to look into MC and raise a PR if there is a problem.

I can't find where nops are used...

This revision is now accepted and ready to land.Apr 1 2020, 8:25 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2020, 4:16 AM