OK, so why _does_ ld resolve text against data?

Peter van der Linden linden at adapt.Sun.COM
Thu Aug 23 04:38:42 AEST 1990


David Steffens points out a serious deficiency in "ld", and in fact
it's even more heinous than the example he gives.  If you happen to 
choose a function name that duplicates a library name, then your function 
is used in preference to the library function both in your code AND in 
any library routines you call!

Most of us know to avoid names like malloc, but everyone calls something
index sooner or later.  This has tremendous potential for mysterious
bugs, and I see it 4 or 5 times a year.  The first time a programmer
encounters it is an enlightening and "character-building" experience.

ld should definitely be enhanced to complain about duplicate references
in libraries (possibly with an option "shut up -- I meant to do this").


----------------
Peter van der Linden     linden at eng.sun.com    (415) 336-6206
The antlers of the largest Irish Elk in the world are at Yale, 
and those of the smallest are at Harvard.



More information about the Comp.unix.wizards mailing list