ld -A ... on SunOs 4.0?
Jan Wielemaker
mcvax!swivax!jan at uunet.uu.net
Wed Dec 21 01:49:43 AEST 1988
Under SunOs 3.4 I wrote a foreign language interface to my Prolog
compiler. This was done by calling the loader with the following flags:
ld -N -A <prolog executable> -T <address> -e <entry> <files> -lc
Where <entry> was the name of an initialisation function called by
Prolog to register the new predicates with Prolog. This worked fine
until we got SunOs 4.0 ...
Problems
Prolog itself has been linked dynamically. Any attempt to link it
statically was refused by the loader, complaining I redefined _end,
_edata and _etext. I most certainly did not define these symbols and
even the most trivial C-program I tried to compile with cc -Bstatic ...
gave this complaint.
If (with the dynamically linked Prolog) try to invoke the loader as
above it complains with ``__DYNAMIC not found''. If I delete the ``-e
entry'' options I don't get this message. So I now scan the symbol
table myself to find the entry point. Now linking goes fine, but as
soon as the initialisation function calls one of Prologs interface
functions a crash follows. Presumably I have to call ``ld.so'' somehow,
but SUN is very vague about how to do this (a small example would be
most helpfull).
Finally the manual of ld(1) says that using the -A option the resulting
a.out file will contain both the symbols of the original executable as
those from the new linked material. This used to be the case with SunOs
3.4, but seems not to be the case any more. `nm' only reports new
symbols. I want a file with ALL symbols both for debugging as for
subsequent runs of ld.
Questions
- Would a static linked Prolog solve the problem and how do I get
a static linked version?
- How should I use ``ld.so'' in this case? I've looked at link(5)
and the shared library chapter of the SUN manual. This is too
vague to me.
- How do I get a file holding ALL symbols? Is it a bug of ld?
Any hint is welcome! Jan Wielemaker
More information about the Comp.sys.sun
mailing list