This is an archive of the discontinued LLVM Phabricator instance.

MIPS64r6 Relocations R_MIPS_PC21_S2, R_MIPS_PC26_S2
ClosedPublic

Authored by jkolek on May 19 2014, 7:01 AM.

Details

Summary

Implemented relocations:

  • R_MIPS_PC21_S2,
  • R_MIPS_PC26_S2.

R_MIPS_PC16 is tested with the new instructions beqc and bnec.

Diff Detail

Event Timeline

jkolek updated this revision to Diff 9532.May 19 2014, 7:01 AM
jkolek retitled this revision from to MIPS64r6 Relocations R_MIPS_PC21_S2, R_MIPS_PC26_S2.
jkolek updated this object.
jkolek edited the test plan for this revision. (Show Details)
jkolek added reviewers: dsanders, vmedic.
jkolek added a subscriber: zoran.jovanovic.
dsanders edited edge metadata.May 22 2014, 6:20 AM

LGTM with a few nits, particularly the '/ 2' one.

The comment about the A's being in the wrong place seems to be a general problem in our target. I don't think it should block this patch

lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
108

This should either be '>> 2' or '/ 4'

116

Same

lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
263–264

This line break looks strange and isn't necessary.

285–286

Same

test/MC/Mips/mips32r6/reloc-pc16.s
9

It's worth mentioning that the A's are in the wrong place. It's correct for little endian so it looks like they aren't accounting for endianness. I'll take a quick look to see if I can spot the bug

19–20

We should check the address and the value too:

0x0 R_MIPS_PC21_S2 bar 0x0
0x4 R_MIPS_PC21_S2 bar 0x0
test/MC/Mips/mips32r6/reloc-pc21.s
19–20

Same

test/MC/Mips/mips32r6/reloc-pc26.s
19–20

Same

jkolek updated this revision to Diff 9700.May 22 2014, 8:22 AM
jkolek edited edge metadata.
dsanders accepted this revision.May 23 2014, 1:41 AM
dsanders edited edge metadata.

LGTM

test/MC/Mips/mips32r6/reloc-pc16.s
9

I've found the bug. It affects all targets but I'll have a MIPS specific workaround shortly. Essentially MCFixupKindInfo's bit offset doesn't account for endianness. Big endian targets are using the offset of the top bit of the field, while little endian targets are using the offset of the bottom bit of the field.

This revision is now accepted and ready to land.May 23 2014, 1:41 AM
dsanders added inline comments.May 23 2014, 3:13 AM
test/MC/Mips/mips32r6/reloc-pc16.s
9

D3889 fixes the bug in llvm-mc. The order we commit in doesn't matter since I'll update the tests in this patch if this is committed first.

jkolek closed this revision.May 27 2014, 6:03 AM
jkolek updated this revision to Diff 9835.

Closed by commit rL209655 (authored by zjovanovic).

jkolek edited edge metadata.Nov 18 2014, 5:52 AM
jkolek added a subscriber: Unknown Object (MLST).