Using A/UX to build MacOS applications

Tony Cooper tony at tui.marcam.dsir.govt.nz
Tue Jun 11 16:36:27 AEST 1991


In article <867 at taniwha.UUCP>, paul at taniwha.UUCP (Paul Campbell) writes:
|> 
|> |> 1) Is there a way to translate COFF into CODE resources?  If there
isn't, is
|> |> there any real reason why I couldn't write such a beast?
|> 
|> No not really, this is because most Unix compilers/linkers (including
|> the A/UX ones) don't make position independant code (PIC), this is mostly
|> because PIC code often runs slower (and data is a real pain). CODE resources
|> need PIC code and a compiler that understands how to build an 'a5 world'
|> I recomend you use MPW or some such

I don't think this is true. I think PIC code is easy in A/UX, but maybe there
are various degrees of PIC and maybe A5 globals mess things up.

I wrote a DRVR resource using A/UX cc. I presume a DRVR needs PIC code. So I
guess I was lucky that my code turned out to be PIC. Or was I? I don't know.
But this is what I did:

cc -O drvr.c
ld -x -r -o drvr drvr.o  -lmac -lat -lld -lmr -lc
dumpcoff drvr .text > drvr.r

where dumpcoff just does a hex dump of the .text part of drvr. Now since drvr
has not been linked into an executable it is PIC is it not? Or maybe it is
PIC as long as it has no global variables. In that case there is a way round
that too so that globals (but not A5 globals) are stuck in the right place.
And a bit of glue code can handle the case of A5 globals too.

PIC code is important in Unix cos it's needed for things like dynamic linkers
and shared libraries and whatnot. But I don't really know what I'm talking
about. I don't know how long branches and various stuff like that is done.

Cheers,
Tony



More information about the Comp.unix.aux mailing list