Article View: comp.sys.sun
Article #11280Question on /lib/compile (for cross-compiling to Sys4-3.2 on 4.0)
From: Samuel C. Kendall
Date: Sat, 04 Mar 1989 06:22
Date: Sat, 04 Mar 1989 06:22
34 lines
2037 bytes
2037 bytes
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@harvard.edu
(617) 876-7636
Technical Details
Message-ID:
<331@wjh12.harvard.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: kendall%saber%harvard@husc6.harvard.edu (Samuel C. Kendall) Newsgroups: comp.sys.sun Subject: Question on /lib/compile (for cross-compiling to Sys4-3.2 on 4.0) Message-ID: <331@wjh12.harvard.edu> Date: 4 Mar 89 06:22:26 GMT Sender: usenet@rice.edu Organization: Saber Software, Inc. Lines: 34 Approved: Sun-Spots@rice.edu Original-Date: 22 Feb 89 00:44:34 GMT X-Sun-Spots-Digest: Volume 7, Issue 180, message 9 of 12