Question on /lib/compile (for cross-compiling to Sys4-3.2 on 4.0)

Samuel C. Kendall kendall%saber%harvard at husc6.harvard.edu
Sat Mar 4 16:22:26 AEST 1989


My Sun-4 runs 4.0, but has the Sys4-3.2 filesystems mounted under
/root3.2.  I've nearly got a "cc3.2" command working on 4.0 that makes
Sys4-3.2 binaries.  It's very simple; it just invokes
/root3.2/lib/compile, making sure its argv[0] ends in "cc", and passes in
the right -Qpath, -I, and -L options.

It almost works.  The problem is in linking.  /root3.2/lib/compile invokes
the right ld (/root3.2/pub/bin/ld), but passes it two options "-dc -dp"
that are understood only by the 4.0 ld (it should pass just "-d" instead).

My question, then, is how does /lib/compile know what arguments to pass to
ld?  The arguments are not "hardwired" into the binary, because the same
"compile" binary invokes ld differently depending on which OS is running,
and what paths must be used to get to certain files.  But I haven't been
able to find the template file that drives it, if there is one.

I can fix this by invoking /root3.2/pub/bin/ld myself, but it would be
easier to let "compile" do it.

My script "cc3.2" is as follows:

#! /bin/sh
exec /usr/local/lib/cc3.2/cc -Qpath /root3.2/pub/lib -Qpath /root3.2/pub/bin \
        -Qpath /root3.2/usr/lib -I/root3.2/usr/include -L/root3.2/pub/lib \
        -L/root3.2/usr/lib -L/root3.2/usr/local/lib $*

"/usr/local/lib/cc3.2/cc" is a link to "/root3.2/lib/compile"; it exists
so that "compile" can be invoked with an argv[0] that ends in "cc".

----
Sam Kendall 
Saber Software, Inc.
kendall%saber at harvard.edu
(617) 876-7636



More information about the Comp.sys.sun mailing list