/lib/crt0.o -lm -lc
Note the absence of -berok. After this link, all references should
be resolved (unless you're doing a multistage link and making another
NOTE THE ORDER OF MODULES. This is extremely important if, for example,
you had a subroutine named "load" in your Fortran stuff. Putting the
C libraries before the intermediate module would make the C "load"
the operable definition, rather than the Fortran version EVEN THOUGH
THE FORTRAN MODULE HAS ALREADY BEEN THROUGH A LINK AND ALL REFERENCES
TO THE SYMBOL ARE CONTAINED IN THE FORTRAN MODULE. This can
be extremely difficult to find (trust me on this one :-) Is this
a bug, a feature, or what?
[As mentioned in section 2.03 of this article, it is a feature that you
can replace individual objects in linked files, ed.]
The result will be a slightly larger object than normal. (I say slightly
because mine went up 5%, but then it's a 2 MB object :-)
Comments & Caveats:
From the documentation the -r argument to the linker should do what
-berok does. It does not. Very strange results come from using the
-r argument. I have not been able to make -r work in a sensible manner
(even for intermediate links which is what it is supposed to be for).
Note from Mike Heath (firstname.lastname@example.org):
'ld -r' is essentially shorthand for 'ld -berok -bnogc -bnoglink'.
Certainly, using -berok with an export file (so garbage collection
can be done) is preferable to ld -r, but the latter is easier.
When binding an intermediate module, use an export file to define the
entry points you want visible in the later link. If you don't do this,
you'll get the dreaded "unresolved reference" error. Import files name
entry points that will be dynamically resolved (and possibly where).
If you are in doubt about what parameters or libraries to link, use the
-v arg when linking and modify the exec call that shows up into
an ld command. Some thought about the libraries will usually yield an
idea of when to use what. If you don't know what an argument is for,
leave it in. It's there for a purpose (even if you don't understand it).
Watch the order of external definitions (ie, libraries) when more than
one version of a routine may show up, eg "load". The first one defined
on the ld command line is the winner.
The getenv (and system and signal) problem is a problem that started out
minor, got somewhat worse in 3003 and, eventually will be correctly fixed.
Basically, you should extract the 3002 version of these three routines
from xlf.a before doing the update and save them away, then link these
routines in if you use these Fortran system services.