This is an archive of the discontinued LLVM Phabricator instance.

Fix for pr24346: arm asm label calculation error in sub
ClosedPublic

Authored by laszio on Dec 10 2015, 11:52 PM.

Details

Summary

Some ARM instructions encode 32-bit immediates as a 8-bit integer (0-255)
and a 4-bit rotation (0-30, even) in its least significant 12 bits. The
original fixup, FK_Data_4, patches the instruction by the value bit-to-bit,
regardless of the encoding. For example, assuming the label L1 and L2 are
0x0 and 0x104 respectively, the following instruction:

add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260

would be assembled to the following, which adds 1 to r0, instead of 260:

e2800104 add r0, r0, #4, 2 ; equivalently 1

The new fixup kind fixup_arm_mod_imm takes care of the encoding:

e2800f41 add r0, r0, #260

Diff Detail

Event Timeline

laszio updated this revision to Diff 42503.Dec 10 2015, 11:52 PM
laszio retitled this revision from to Fix for pr24346: arm asm label calculation error in sub.
laszio updated this object.
laszio added a reviewer: llvm-commits.
laszio added a subscriber: llvm-commits.

Hi Asiri,

It seems that the fixup for modified-immediates needs some adjustment. Would you mind to take a look or suggest some other reviewers?

rmaprath edited edge metadata.Jan 5 2016, 1:22 AM

The patch looks fine for me.

I'd rather let someone with access to source/ARMARM approve this (I'm on holiday). @olista01: can you please have a look?

\ Asiri

jmolloy accepted this revision.Jan 6 2016, 5:27 AM
jmolloy edited edge metadata.

Hi,

This seems correct to me.

Cheers,

James

This revision is now accepted and ready to land.Jan 6 2016, 5:27 AM

Hi James, Asiri and Oliver,

Could you please help me commit this? I've read the developer policy several times but still can't figure out how to get this landed without bothering a developer with commit access.

If you're planning to be doing more LLVM work, then it's easy enough to request commit access: http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access (basically, e-mail Chris with the necessary details for the account you want).

Otherwise, we're generally quite happy to commit on other people's behalf. It's really not much work when the patch applies cleanly. Let us know which you want.

Cheers.

Tim.

Hi Tim,

Thanks for the information. I read it again and according to the first sentence of the quoted section:

"We grant commit access to contributors with a track record of submitting high quality patches."

Although it is subjective, and despite of the fact that I shall be working on LLVM frequently, I'm not confident enough because this is my first patch :)

May I ask you for a favor to commit this for me? Or is it OK to request commit access directly?

Hi,

r265122

Thanks!

James

rmaprath closed this revision.May 4 2016, 6:50 AM