SYSDEV@dlvc.daresbury.ac.UK (09/04/87)
Hi there,
I think I have found a bug in the VAX linker. It appears when trying
to use a shareable image library to include the standard VAX C library. If
the following small program (C_BUG)
#include stdio
main()
{ printf("printf\n");
fprintf(stderr, "stderr\n");
fprintf(stdout, "stdout\n");
}
is linked with the library thus:
or $ link c_bug,sys$input/opt
sys$share:vaxcrtl/share
$ link c_bug,sys$library:vaxcrtl/lib
or $ define lnk$library sys$library:vaxcrtl.olb
$ link c_bug
all is well. However I want to be able to use the sharable image without
having to specify an options each time. This always produces an image which
runs, but which does not behave as expected. When linked in one of the
following ways the only output is the first line, ie. "printf" appears:
$ lib/create/share myimagelib sys$share:vaxcrtl.exe
$ link c_bug,myimagelib/lib
or $ lib/create/share myimagelib sys$share:vaxcrtl.exe
$ define lnk$library disk:[dir]myimagelib.olb
$ link c_bug
or $ lib/include/share sys$library:imagelib sys$share:vaxcrtl.exe
$ link c_bug
Other C runtime I/O routines also fail, eg. freopen(...) stops working in
images linked using a shareable image library to find the C library. Does
anyone know if this is a known bug/restriction ? Can anyone help please,
Dave Hines.
Bitnet/NetNorth/Earn: hines@mail.daresbury.ac.uk
Arpa : hines@mail.daresbury.ac.uk@ucl-cs.arpa
leichter@VENUS.YCC.YALE.EDU ("Jerry Leichter") (09/04/87)
[The author tried to place VAXCRTL.EXE in a shareable image library and link against the library. His program failed in strange ways.] This is, indeed, a Linker bug - and old and hoary one. I've seen the details explained, before but I really don't remember them. They go something like this: In certain situations with shareable image libraries, the Linker doesn't match PSECT's up correctly. The result is multiple copies of some of the static data the program uses, with different pieces of code being linked against different copies. The result will be a rather confused program. Unfortunately, the VAX C shareable runtime library runs smack into this bug. I gather it does so in ways that would require a lot of work on the VAX C on the part of the VAX C developers to fix, and they don't consider the effort justifiable. Meanwhile, the Linker, one of the more arcane pieces of VMS, has scared of most of the people who've looked at it. Fixing this particular bug is apparently not easy.... Priorities for different bug fixes are influenced by the perceived problems the bugs are causing. If you feel strongly about this bug, submit an SPR. -- Jerry ------