Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* RH5.0 - undefined refs behavior changed?
@ 1998-03-27 20:14 Harvey J. Stein
  0 siblings, 0 replies; only message in thread
From: Harvey J. Stein @ 1998-03-27 20:14 UTC (permalink / raw)
  To: randy, lloyd, darryl, martinob, axp-list, bugs


Under all versions of Linux, I've always been able to link a binary
with undefined references & it would run fine, assuming the program
never tries to execute the unresolved reference.

This was especially convenient when linking f2c'ed Fortran into a C
main, because libf2c.so contains a main which calls MAIN__, and f2c
creates a MAIN__ when compiling a Fortran PROGRAM.  Thus, MAIN__ is
unresolved & will never execute when main is defined in a C program.

However, this seems to have changed under RH5.0:

   hjstein@aldev5:~$ gcc -o foo foo.o misc_func.o -g -DUSE_F2C -DALPHA_LINUX -Xlinker -noinhibit-exec -lp2c -lopt -lf2c -lgdbm -lm
   /usr/lib/libf2c.so: undefined reference to `MAIN__'
   hjstein@aldev5:~$ ./foo <tst.in
   ./foo: error in loading shared libraries
   /usr/lib/libf2c.so.0: undefined symbol: MAIN__
   hjstein@aldev5:~$ 

Compare to the same under RH4.2:

   hjstein@aldev5:~$ gcc -o foo foo.o misc_func.o -g -DUSE_F2C -DALPHA_LINUX -Xlinker -noinhibit- exec -lp2c -lopt -lf2c -lgdbm -lm
   /usr/lib/libf2c.so: undefined reference to `MAIN__'
   hjstein@aldev5:~$ ./foo <tst.in
   <program goes on to process input and create useful output>

Is this the way it's supposed to be?  Any reason this was changed?
Any way to change it back?  It seems pretty dumb to have a
-noinhibit-exec switch for ld while simultaneously refusing to run
binaries containing undefined symbols.

Thanks,

-- 
Harvey J. Stein
Berger Financial Research
hjstein@bfr.co.il


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-03-27 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-27 20:14 RH5.0 - undefined refs behavior changed? Harvey J. Stein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox