Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: jackson@csc-ws-srv.umd.edu Newsgroups: comp.sys.sun Subject: Re: Question on /lib/compile (for cross-compiling to Sys4-3.2 on 4.0) Keywords: Software Message-ID: <8903041623.AA04450@epsl.UMD.EDU> Date: 17 Mar 89 00:29:07 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 20 Approved: Sun-Spots@rice.edu Original-Date: Sat, 4 Mar 89 11:23:45 EST X-Sun-Spots-Digest: Volume 7, Issue 202, message 2 of 21 >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 This is tricky. What happens is that compile tries to find some file (I'm thinking crt0.o, but I don't remember for sure) in both /usr/lib and /lib. If it finds it in /usr/lib, it thinks you're on a 4.0 system and uses 4.0 ld arguments. If it's in /lib, it thinks you're on 3.2 and uses 3.2 ld arguments. (Evidently, the 3.2 compile is really the 4.0 compile with hooks for backwards compatiblity.) I found this by use of the trace(1) command, and fixed the problem by changing the offending file name in the 3.2 compile binary using adb. (Change it to something like "/zzz/lib/whatever"; it won't be found, and compile will use 3.2-style argments for ld.) Chris Jackson University of Maryland Computer Science Department (no, I don't work here, I'm just a student...)