This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Add R_MICROMIPS_PC18_S3 relocation
ClosedPublic

Authored by zoran.jovanovic on Nov 26 2015, 7:56 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

zoran.jovanovic retitled this revision from to [mips][microMIPS] Add R_MICROMIPS_PC19_S3 relocation.
zoran.jovanovic updated this object.
zoran.jovanovic added a subscriber: llvm-commits.
zoran.jovanovic retitled this revision from [mips][microMIPS] Add R_MICROMIPS_PC19_S3 relocation to [mips][microMIPS] Add R_MICROMIPS_PC18_S3 relocation.Dec 15 2015, 7:22 AM
dsanders accepted this revision.Dec 18 2015, 7:10 AM
dsanders edited edge metadata.

This patch LGTM but there's a quirk that we may need to worry about in some LLVM components (e.g. CodeGen, MCJIT, etc.) that I should mention.

This relocation and some of of the other new R_MICROMIPS_PC*_S* relocations have a slightly different concept of 'PC' compared to the relocations that came before. The difference is that the PC is rounded down to the specified alignment first whereas other relocations will happily use an unaligned PC. So the PC for R_MICROMIPS_PC18_S3 is 'PC & ~0x7'. I doubt there's much practical difference for the *_PC*_S2's and *_PC*_S1's because code needs to be correctly aligned anyway, but R_MICROMIPS_PC18_S3 requires a greater alignment than code does and may expose the difference more easily.

Another slight difference is that both the symbol and addend must be correctly aligned rather than merely that the sum of the two is correctly aligned. I'm told this is so that REL and RELA have the same constraints.

This revision is now accepted and ready to land.Dec 18 2015, 7:10 AM
dsanders added inline comments.Dec 18 2015, 7:42 AM
lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
137 ↗(On Diff #41259)

Thinking about it a bit more, we should check the alignment here for the micromips case.

This revision was automatically updated to reflect the committed changes.