[PATCH] Implement the ldr-pseudo opcode for ARM assembly

David Peixotto dpeixott at codeaurora.org
Wed Nov 20 11:51:10 PST 2013


I've attached updated patches that contain the corresponding tests for
darwin. I also modifed the patch to use MCContext::CreateTempSymbol()
instead of creating the symbols explicitly.

 

Please help to review this change.

 

From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of David Peixotto
Sent: Tuesday, November 19, 2013 7:39 PM
To: 'Jim Grosbach'
Cc: 'Commit Messages and Patches for LLVM'
Subject: RE: [PATCH] Implement the ldr-pseudo opcode for ARM assembly

 

I've converted the ARM tests in ldr-pseudo.s to run for darwin and they are
passing. The darwin tests for arm are attached. I have not converted the
thumb1 and thumb2 tests yet.

 

Compared to the linux tests, I made the following changes:

 

1. Adjust CHECK lines for the address of the constant pool entries. Needed
because with llvm-objdump -d, new sections do not start at address zero, but
continue from end of previous section. However, llvm-objdump -r still prints
relocation addresses as offset from the section.

2. Adjust CHECK lines for the type of relocation: R_ARM_ABS32(linx) vs.
ARM_RELOC_VANILLA(darwin)

3. Adjust the CHECK lines for the reloc value in the constant pools for
known symbols. For darwin it contains the address in the section rather than
the offset from the symbol (e.g. see test in section h that has a relocation
with value 3c in section d rather than offset 0 from symbol f5).

 

None of the pc-relative loads in the generated ldr instructions needed to
change. For the linux tests, I had gcc to compare against for the correct
output. It is more difficult for me to verify the results on darwin. The
changes look reasonable to me, but I would appreciate any feedback/help on
the test.

 

Thanks,

-David

 

From: David Peixotto [mailto:dpeixott at codeaurora.org] 
Sent: Tuesday, November 19, 2013 6:01 PM
To: 'Jim Grosbach'
Cc: 'Commit Messages and Patches for LLVM'
Subject: RE: [PATCH] Implement the ldr-pseudo opcode for ARM assembly

 

Hi Jim,

 

I had thought that these set of tests would be ok because I was using the
machine independent assembler apis, but I can see that I have made a bad
assumption. I will add the corresponding tests for darwin.

 

(As an aside, I just tried a quick test with the first example from
ldr-pseudo.s and it did not complain about the labels. I'm used the same
commands, but switched the target to armv7-darwin-apple and updated the
.section syntax. In any case I will fix the labels to use real temporaries,
but let me know if there is a better way to test for darwin).

 

As for the subsections-via-symbols, I had looked for a test that I could
follow, but did not see anything. Based on our discussion it seems that
pc-relative loads across symbols is undefined behavior. So even the existing
ldr <label> instructions should have a problem, right? Is there some test
you can point me to that checks for this or some testing guidance you can
provide? I'm not quite sure what the correct behavior should be here.

 

-David

 

 

From: Jim Grosbach [mailto:grosbach at apple.com] 
Sent: Tuesday, November 19, 2013 4:56 PM
To: David Peixotto
Cc: Commit Messages and Patches for LLVM
Subject: Re: [PATCH] Implement the ldr-pseudo opcode for ARM assembly

 

Hi David,

 

As far as I can tell, these patches don't handle the subsections-via-symbols
or anything else Darwin related at all. Am I missing something? For a
trivial example, the label names are not going to work at all on Darwin.

 

-Jim

 

On Nov 15, 2013, at 6:00 PM, David Peixotto <dpeixott at codeaurora.org> wrote:

 

Attached are 3 patches that together implement the ldr pseudo for arm and
the .ltorg directive. Please help to review these patches.

 

Thanks,

David

 

-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
by The Linux Foundation

 

 

<0001-Add-a-finishParse-callback-to-the-targer-asm-parser.patch><0002-Implem
ent-the-ldr-pseudo-opcode-for-ARM-assembly.patch><0003-Implement-the-.ltorg-
directive-for-ARM-assembly.patch>___________________________________________
____
llvm-commits mailing list
 <mailto:llvm-commits at cs.uiuc.edu> llvm-commits at cs.uiuc.edu
 <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131120/970e0da9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-finishParse-callback-to-the-targer-asm-parser.patch
Type: application/octet-stream
Size: 1585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131120/970e0da9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Implement-the-ldr-pseudo-opcode-for-ARM-assembly.patch
Type: application/octet-stream
Size: 23931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131120/970e0da9/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Implement-the-.ltorg-directive-for-ARM-assembly.patch
Type: application/octet-stream
Size: 8357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131120/970e0da9/attachment-0002.obj>


More information about the llvm-commits mailing list