[comp.sys.amiga.tech] Anyone has the source of a good linker?

U211344@HNYKUN11.BITNET (Olaf 'Rhialto' Seibert) (02/17/89)

Currently, there are sources available for at least two C compilers,
and several assemblers. But we seem to be missing a linker with
source.

I know there is Blink, but since it has gone commercial, the
freely distributable version is missing several features from the
latest commercial version. And there has never been source, which
is (as some of you might remember) against my religion.

So has anyone already written such a replacement linker? (with
source available). If not, then I would consider doing it myself.
(he said, optimistic as ever). In that case, I could use hints on
useful techniques to include, sample source for other systems/
file formats. And, an explanation of the Lattice extensions to the
object file format (16 bit relocation, function index, whatever)
is a must.

I already have (of course) all RKM's, AmigaDOG manual V1.2, and
autodocs. And an example linker in the form of the Sozobon linker.
(Unfortunately, it is for ST format object files, has no knowledge
of hunks apart from 1 code/1 data/1 bss, and an external identifier
length limit of 8 characters).

I hope that my mailbox will be flooded with info. If that seems
useful, I'll summarize.

shs@uts.amdahl.com (Steve Schoettler) (02/18/89)

In article <8902171605.AA16549@jade.berkeley.edu> U211344@HNYKUN11.BITNET (Olaf 'Rhialto' Seibert) writes:
> ... we seem to be missing a linker with source.

Well, the gnu linker is available in binutils.tar.Z on prep.ai.mit.edu.
Naturally, the output is in a.out (b.out) unix executable format.

I can think of three ways to get the gnu ld to be useful on the amiga
(listed from most to least plausible):

1. For a first try, you might use the linker option that leaves the
   resulting file in relocatable format, just before it causes it
   to map to location 0.  I suspect it wouldn't be too hard to add some
   hunk headers to this format.

2. Use the a.out format, and rewrite loadseg() to act like the unix loader.
   It would look in the first few bytes for a magic number.  If no magic number
   is found, it could call the old loadseg().  This would have the neat
   advantage of being able to call AREXX if the file was in a particular
   directory or had a special sequence of characters at the top.

3. If you knew there were going to be an MMU in the machine, just use
   the regular unix a.out format and write a loader that tells the MMU
   to install this at some virtual address 0.  I don't really know if
   the MMU can do this, and the program might have a problem communicating
   with other tasks running in real address space.

I don't really give much credibility to (3), but I've thought a lot about
combinations of (1) and (2).  Using a.out format would also allow you to
use a lot of other unix archiving programs, debuggers, etc.  With your own
loader in place, you could write a version of resident that could make both
compiled programs and AREXX programs resident!  And of course, you could use
gcc/gas/ld, which is why I suspect Olaf wanted a linker in the first place.

Something to think about anyway.

Steve
-- 

        Steve Schoettler
        shs@uts.amdahl.com
        {sun,decwrl,pyramid,ames,uunet}!amdahl!shs
        Amdahl Corp., M/S 213, 1250 E. Arques Ave, Sunnyvale, CA 94088

peter@sugar.uu.net (Peter da Silva) (02/19/89)

In article <01k165dDlp10106aJkM@amdahl.uts.amdahl.com>, shs@uts.amdahl.com (Steve Schoettler) writes:
> 3. If you knew there were going to be an MMU in the machine, just use
>    the regular unix a.out format and write a loader that tells the MMU
>    to install this at some virtual address 0.  I don't really know if
>    the MMU can do this, and the program might have a problem communicating
>    with other tasks running in real address space.

This would be an ideal way to start building a UNIX environment on top of
AmigaOS. You just need to implement a set of handlers that let the software
make system calls.

You could even emulate fork()!

Why would you want to do this? Well, you'd retain the fast AmigaOS response
time, while gaining the security of UNIX.
-- 
Peter "Have you hugged your wolf today" da Silva  `-_-'  Hackercorp.
...texbell!sugar!peter, or peter@sugar.uu.net      'U`

janhen@wn2.sci.kun.nl (Jan Hendrikx) (02/21/89)

In article <01k165dDlp10106aJkM@amdahl.uts.amdahl.com>, shs@uts.amdahl.com (Steve Schoettler) writes:
> In article <8902171605.AA16549@jade.berkeley.edu> U211344@HNYKUN11.BITNET (Olaf 'Rhialto' Seibert) writes:
    [that's me, for the record]
> > ... we seem to be missing a linker with source.
> 
> Well, the gnu linker is available in binutils.tar.Z on prep.ai.mit.edu.
> Naturally, the output is in a.out (b.out) unix executable format.

Yes, and that is exactly the problem. I don't want to write some
patch programs that I must run before I can execute the program I just
linked. And (not being familiar with GNU ld) I assume it eats lots
of memory, and also only knows about the Unix-'Hunks' Text, Data and Bss.
No multiple code or data hunks. A third problem is that I don't have
the source here, and can't ftp.

> And of course, you could use
> gcc/gas/ld, which is why I suspect Olaf wanted a linker in the first place.

Actually, the idea was to use it with PDC/A68k, but the intention
is about the same.

> Steve
-Olaf Seibert (using Jan's account)