Xref: utzoo comp.unix.ultrix:1835 comp.sys.mips:168 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!um-math!sharkey!cfctech!teemc!hpftc!zardoz!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!usc!apple!brutus.cs.uiuc.edu!tut.cis.ohio-state.edu!ucbvax!agate!shelby!polya!neon.stanford.edu!maslen From: maslen@neon.stanford.edu (Thomas Maslen) Newsgroups: comp.unix.ultrix,comp.sys.mips Subject: "ld -A" on PMAXen -- help wanted Keywords: ld, incremental linking, PMAX, 3100, SICSTUS Message-ID: <11589@polya.Stanford.EDU> Date: 30 Aug 89 21:16:12 GMT Sender: USENET News SystemReply-To: maslen@polya.stanford.edu (Thomas Maslen) Followup-To: comp.sys.mips Distribution: usa Organization: Stanford University, Computer Science Dept. Lines: 57 [ Posted to comp.unix.ultrix and comp.sys.mips, followup-to comp.sys.mips; hope that's appropriate. My apologies if this has been around the net previously, but I haven't seen it in the traffic since 15-Aug. ] I'm trying to port a Prolog implementation (SICSTUS 0.6, including the foreign function interface) which wants to use incremental loading ("ld -A") to do clever things at runtime; I'm not having much fun. Has anyone Out There successfully used the -A flag? If it matters, I'm working on one of the server boxes in the same family as the DECStation 3100, running Ultrix 3.1 (at least, I think that's what the login gibberish is trying to say). It is my impression, however, that my problems stem from MIPS-derived software rather than from anything weird that DEC did -- please tell me if I'm wrong. The main thing that makes life difficult is GP-addressed variables (small data and small bss). I understand why incremental loading demands that all the newly loaded modules be compiled with -G 0, but it's still a pain to deal with. For modules under my control, I can simply grit my teeth and add -G 0 to the Makefile, but when those modules refer to something in a library (e.g. libc.a) which isn't already linked into the program, and that something uses GP addressing, it's a little difficult for me to do much about it. So: (1) Is there a way to deal with this that I don't know about? Maybe a program which, somewhat in the manner of pixie, mungs .o files to remove any GP-relative addressing (how feasible is it to use $at for this sort of thing?) (2) Failing that, how have other people dealt with porting systems that want to load foreign functions at runtime? I assume that this should arise in some of the LISP and Prolog systems that were on John Mashey's list of third-party software for MIPS boxes (true?). (3) The good folks at MIPS normally have pretty convincing numbers to back their decisions. Question: how much slower would things be if the system-wide default was -G 0 rather than -G 8? (Yes, I realize this is as ill-formed a question as "so, how many MIPS does it do?"). Wouldn't -G 0 be a better default, with -G 8 left for the speed freaks? The 26-bit addresses in jumps are also a bit of a nuisance, but it looks as though one can get around this by building the original (non-incremental) executable with -N (OMAGIC) or perhaps with clever choice of -T and -D values. If anybody cares, the rest of SICSTUS 0.6 seems to work pretty happily, although we haven't tested it a whole lot. The save/restore code needed some tweaking to find the start of the (writable) data segment, but that was about all. Thanks for any light you can shed, Thomas Maslen maslen@polya.stanford.edu