[Top][All Lists]

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

Note: Interix diff horked - don't apply

From: Todd Vierling
Subject: Note: Interix diff horked - don't apply
Date: Wed, 21 Apr 2004 12:36:02 -0400 (EDT)

It seems that "PIC" isn't really PIC in Interix3, nor is non-PIC really

There are some ... issues there that I'm hashing through in NetBSD pkgsrc
and will regen a new diff after it settles.  The resultant change will have
one amusing whopper of a hack in it, but it's worth the hack to get libtool
working well on Interix.


And for the curious:

Under Interix3, the code generated by gcc with or without -fPIC is PIC-like
in that it does have linkage tables for external references.  However,
*intra*-library jumps do not correctly work under -fPIC, and use plain old
direct linkage without -fPIC.

So, a shlib is made without -fPIC.  It is linked to an absolute --image-base
(default 0x10000000, which is itself way too low in memory).  At runtime, if
libraries are overlapping image base addresses or overlap a mmaped block,
one of them will be relocated using .text relocation -- expensive in both
memory and CPU at process startup.

The only semi-sane way I can find to reduce the use of .text relocation is
to provide a randomized image base at link time, thus providing a reasonable
chance that libraries will not overlap.  I'm currently working on a plan
that uses the range 0x50000000-0x6ffc0000 with granularity of 0x00040000
(256KB); so far, it seems to work reasonably well in practice.

The ugly part is the archive_cmds needed to do this.  It injects a

${wl}--image-base,$(($RANDOM % 4096 / 2 * 262144 + 1342177280))

into the link string.  How rude.  8-)

-- Todd Vierling <address@hidden> <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]