Hello David,

ok, I had the time to look at the dynamic linker's sources, and clearly it
doesn't implement R_ARM_ABS32 properly.
I guess we never encountered this in the system because these relocs are
(correctly) removed by our prelinker system.

can you file a bug in the Issue Tracker for this ?

thanks

On Fri, Mar 28, 2008 at 8:07 PM, David Given <[EMAIL PROTECTED]> wrote:

>
> The next installment in my exciting JNI saga...
>
> I seem to have a situation where dlopen() is incorrectly applying
> relocations in shared libraries. Here's some sample code:
>
> ---snip---
> struct foo { int first, second };
> struct foo Foo = {1, 2};
>
> int* FooPtr[] = { &Foo.first, &Foo.second };
>
> JNIEXPORT jint JNICALL Java_com_cowlark_CTest1
>   (JNIEnv* jenv, jclass clazz)
> {
>        return *FooPtr[0];
> }
>
> JNIEXPORT jint JNICALL Java_com_cowlark_CTest2
>   (JNIEnv* jenv, jclass clazz)
> {
>        return *FooPtr[1];
> }
> ---snip---
>
> When I run this, I'd expect CTest1() and CTest2() to return 1 and 2
> respectively (and that's what I get if I plug it into a test harness on
> the host). What I actually *get* is 1 and 1.
>
> The linker produces (and I've verified manually that this is correct!)
> the following relocation data for FooPtr:
>
> 00000000  00005102 R_ARM_ABS32       00000000   Foo
> 00000004  00005102 R_ARM_ABS32       00000000   Foo
>
> This means 'add the address of Foo to the thing at offset 0 in the
> .data.rel section' (twice). (FooPtr is at offset 0.) Since before
> relocation the FooPtr array contains the offset from Foo of the
> resulting address, that is, 0 and 4 respectively, once the relocation is
> complete FooPtr will contain Foo+0 and Foo+4.
>
> What I actually end up with if Foo+0 and Foo+0. That is, it appears to
> be incorrectly discarding the offset.
>
> I'm building this with the CodeSourcery arm-none-linux-gnueabi toolchain
> using the custom .xsc file as described here:
>
>
> http://honeypod.blogspot.com/2007/12/shared-library-hello-world-for-android.html
>
> I'm compiling everything with -fPIC and linking with -shared. Am I
> missing anything, or is this a bug in dlopen()?
>
> --
> David Given
> [EMAIL PROTECTED]
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to