Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] thumb fixes



On Thu, 2008-09-04 at 15:25 +0300, Mikko Rapeli wrote:
> I suppose 0x8928 is in plt ELF section where objdump also shows a few
> undefined instrunctions:
> 

They aren't instructions, they're data entries  The PLT sequence loads
that value and jumps to it.  Note that PLT sequences rely on the target
being either an ARM instruction or that the CPU running the code is v5t
or later (since ldr pc does not interwork correctly on v4t).

> 00008908 <.plt>:
>     8908:       e52de004        str     lr, [sp, #-4]!
>     890c:       e59fe004        ldr     lr, [pc, #4]    ; 8918 <.plt+0x10>
>     8910:       e08fe00e        add     lr, pc, lr
>     8914:       e5bef008        ldr     pc, [lr, #8]!
>     8918:       0000922c        andeq   r9, r0, ip, lsr #4
>     891c:       e28fc600        add     ip, pc, #0      ; 0x0
>     8920:       e28cca09        add     ip, ip, #36864  ; 0x9000
>     8924:       e5bcf22c        ldr     pc, [ip, #556]!
>     8928:       46c04778        undefined
>     892c:       e28fc600        add     ip, pc, #0      ; 0x0
>     8930:       e28cca09        add     ip, ip, #36864  ; 0x9000
>     8934:       e5bcf220        ldr     pc, [ip, #544]!
>     8938:       46c04778        undefined
>     893c:       e28fc600        add     ip, pc, #0      ; 0x0
>     8940:       e28cca09        add     ip, ip, #36864  ; 0x9000
>     8944:       e5bcf214        ldr     pc, [ip, #532]!
>     8948:       46c04778        undefined
> 
> I don't know what this .plt section is or which object files it's coming
> from, but I suspect the dynamic linker ld.elf_so. Hopefully compiling it
> in ARM mode would solve this. But at least a dynamic /bin/echo works in
> thumb mode now :)

PLT sequences are used for inter-library calls and are intended to
support dynamic loading and lazy binding (resolving the symbol only when
needed).

Before you start messing with that, you should probably read the ARM
Procedure call documentation carefully (see
http://infocenter.arm.com/help/topic/com.arm.doc.subset.swdev.abi/index.html).  
Although NetBSD doesn't conform to the latest version of the spec many of the 
notes will be useful.

R.



Home | Main Index | Thread Index | Old Index