"Can't modify text section" error trying to load .so library

Mike Frysinger vapier at gentoo.org
Wed Jan 9 00:46:21 UTC 2008


On Tuesday 08 January 2008, Robert Dodier wrote:
> I am trying to run IBM J9 JVM on a Gumstix, which is an ARM cpu +
> Linux device. The C library is uClibc. When I try to execute J9,
> I get a message "Can't modify libj9vm23.so text section".
> The message appears to originate from uClibc/ldso/ldso/dl-elf.c.
>
> From browsing the web it appears the immediate cause of the
> error is that some part of the .so library was not compiled w/ -fPIC.
> Unfortunately I don't have the source code to recompile it.
> Is there something I can do with the library as it stands?
> e.g. environment settings, modify the .so library somehow?

it is not something you can do without the source.  well, i guess if you spent 
enough time reverse engineering the code and rewriting the assembly by hand, 
anything is possible ...

as you've found out, uClibc rejects TEXTRELs by default in shared code because 
this means the code is no longer shared ... and that's sort of the point of 
having the shared object in the first place.

> I see the error message is within the else part of
> #ifndef __FORCE_SHAREABLE_TEXT_SEGMENTS__.
> If I undefine that and recompile uClibc, I guess it would disable the
> error message. Could I expect uClibc to generally work OK with
> that undefined?

it's a uClibc configure option, you do not need to modify the source code.  if 
you allow TEXTRELs in shared objects, then this should not affect any shared 
objects that are compiled correctly in any way.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080108/de0cebd1/attachment-0002.pgp 


More information about the uClibc mailing list