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

Re: 32-bit binaries (was: Re: Star Office)



Christopher C Chimelis <chris@beezer.med.miami.edu> writes:

> On 15 Sep 1999, Ron Farrer wrote:
> 
> > There was a hack posted on the Rat Hat axp-list for ld? to fool it
> > into making a 32-bit binary. I know the place in the > archive that
> > it is located if you want me to post it. Does anyone know if this
> > would work?
> 
> I have it and it should work, but it probably could bear to be reposted
> here in case others want to know.  I have the linker script saved without
> the message, so if you can dig up the original message and repost, it
> would help :-)
> 

Here's a compendium of the relevant messages (haven't tried it myself)...
-- 
David Daniel <ddd@null.net>


Richard Henderson <rth@twiddle.net> writes:

>Greg Lindahl <lindahl@cs.virginia.edu> writes:
>
> >Ivan Kokshaysky <ink@jurassic.park.msu.ru> writes:
> >
> > > Greg Lindahl <lindahl@cs.virginia.edu> writes:
> > >
> > > > What we really need is the -taso flag added to GNU ld. This flag links
> > > > a process so that it runs in a 32-bit address space (e.g. it places
> > > > everything so that the upper 32 bits of all addresses is zero). Minor
> > > > kernel changes are also needed. That would allow Netscape and a
> > > > variety of other broken programs to be easily compiled in AlphaLinux.
> > > 
> > > Actually, it's possible right now. Create linker script with
> > > `ld --verbose', edit it like this
> > > -  . = 0x120000000 + SIZEOF_HEADERS;
> > > +  . = 0x10000 + SIZEOF_HEADERS;
> > > and link with it. Then you have to set 1 (EF_ALPHA_32BIT)
> > > at file offset 0x30 (Elf64_Ehdr.e_flags) in the executable.
> > > Any 2.2.x kernel supports this flag.
> >
> > OK, so you need to:
> > 
> > ld --verbose > script
> > delete up to the "============" and the one at the end
> > make the above change
> > ld -T script -static
> > flip the bit at 0x30
> > 
>
> You don't have to make it static if you don't want.
> 
> This bit [at 0x30] means you won't get anything mapped at addresses
> above 0x7fffffff without explicitly requesting it (via mmap
> MAP_FIXED).
> 
> The upshot of this is that the shared libraries and the brk arena
> wind up in the low 31 bits, which means you can cast pointers
> through int and back without damage.


Reply to: