Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ukma!xanth!lll-winken!uunet!convex!csmith From: csmith@convex.UUCP (Chris Smith) Newsgroups: gnu.g++.bug Subject: Re: Installing g++ 1.35.0 on Convex C-220 Message-ID: <1226@convex.UUCP> Date: 28 May 89 11:02:28 GMT References: <3187@cps3xx.UUCP> Reply-To: csmith@convex.com Lines: 103 In-reply-to: adc@cpsvax.cps.msu.edu's message of 28 May 89 04:06:06 GMT No flavor of GNU ld will work easily on a Convex because the a.out format isn't right. Here's an ld++ program that runs /bin/ld. If you have Icon, you can just run it, otherwise I guess you have to write something equivalent. Touch newld.o and ld++ in the g++ build directory (to shut make up), and install this as /usr/local/lib/ld++. (PS: there is a gotcha in stream.cc -- convex _doprnt returns void, not a status indication, so take out the "stat = " part of the "stat = _doprnt ..." line, and add "stat = ". Let me know if you figure out what the right thing is... I'm using 0 for now.) ---------- ld++.icn ---------- procedure main (argv) # Get scratch file names pid := read (open ("echo $$", "p")) | stop ("can't read pid") codefile := "/tmp/" || pid || ".out" hookfile := "/tmp/" || pid || ".o" # Scan args. Remove -C. Remove "-o name" and remember it. ldargs := "" args := create !argv while arg := @args do case arg of { "-o" : outfile := @args "-C" : {} default: ldargs ||:= " " || arg } /outfile := "a.out" # load the program with -r, feed that to nm, open a pipe to the nm output. inf := open ("ld -r -o " || codefile || ldargs || " && nm -p " || codefile, "rp") # open a pipe to the assembler outf := open ("/usr/local/lib/gcc-as -o " || hookfile, "wp") # write the hooks file and assemble it write_hooks (inf, outf) # see if it all worked if integer (close (inf)) ~= 0 | integer (close (outf)) ~= 0 then { system ("rm -f " || codefile || " " || hookfile) stop ("load failed") } # now load in the hook file and write the real output file system ("ld -o " || outfile || " " || codefile || " " || hookfile || " && rm " || codefile || " " || hookfile) end procedure write_hooks (inf, outf) constructors := [] destructors := [] every !inf ? if tab (find ("__GLOBAL_$I$")) then put (constructors, tab (0)) else if tab (find ("__GLOBAL_$D$")) then put (destructors, tab (0)) # in .text, list of constructor addresses, one per word, terminated by zero write (outf, ".text") write (outf, ".globl ___CTOR_LIST__") write (outf, "___CTOR_LIST__:") every write (outf, "\tds.w ", !constructors) write (outf, "\tds.w 0") # in .data, linked list of destructor addresses (link in first word, # destructor address in second word), terminated by zero link, # pointed to by ___DTOR_LIST__ . write (outf, ".data") write (outf, ".globl ___DTOR_LIST__") if *destructors = 0 then write (outf, "___DTOR_LIST__:\n\tds.w 0") else { d := create !destructors write (outf, "\tds.w 0\n\tds.w ", @d) while write (outf, "\tds.w .-8\n\tds.w ", @d) write (outf, "___DTOR_LIST__:\n\tds.w .-8") } end