[LLVMdev] [Patch] Let MC/ELF generate Thumb/Thumb-2 are properly

Koan-Sin Tan koansin.tan at gmail.com
Mon May 16 06:21:19 PDT 2011


splited patches and test cases

mc-elf-thumbfunction-bit.diff: for 1
mc-elf-arm-backend-bl-blx-sign-bit.diff: for 2.
mc-elf-thumb-bl-blx-relocation-table-entry.diff: for 3.
mc-elf-cpu-xscale-attributes.diff: for 4.

elf-thumbfunc.s: test case for 1
elf-thumbfunc-reloc.ll: test case for 2 and 3
elf-xscale-attribute.ll: test case for 4

On Fri, May 13, 2011 at 1:42 PM, Koan-Sin Tan <koansin.tan at gmail.com> wrote:
> Hi,
>
> We are trying to use clang as a drop-in replacement for the gcc come with
> Android NDK. I found that MC/ELF doesn't not handle Thumb functions properly,
> e.g., bit 0 of the function name in the .symtab is not set to 1, and some thumb
> instructions are not generated correctly, e.g., the addresses for tBL/tBLX are
> not calculated right.
>
> With that attached patch, we can compile and run some (not all) Android
> NDK samples without problem.
>
> The attached initial patch
> 1. sets bit 0 of the function address of thumb function in .symtab
>   ("T is 1 if the target symbol S has type STT_FUNC and the
>   symbol addresses a Thumb instruction ;it is 0 otherwise."
>   from "ELF for the ARM Architecture" 4.7.1.2)
>
> 2. fixes target address tBL and tBLX
> 3. sets relocation type of tBL/tBLX to R_ARM_THM_CALL
>    (4.7.1.6)
> 4. adds some attributes to attribute section when cpu is "xscale"
>   (this is what used in Android NDK, when architecture is ARMv5)
>
> --
> // koan-sin tan
>



-- 
// koan-sin tan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcelf-thumb.tgz
Type: application/x-gzip
Size: 3785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110516/e574675b/attachment.bin>


More information about the llvm-dev mailing list