[comp.lang.c] Loader features

schwartz@gondor.psu.edu (Scott E. Schwartz) (10/04/87)

In article <896@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes:+---
|In article <462@eplrx7.UUCP>, lad@eplrx7.UUCP (Lawrence Dziegielewski) writes:
|> [re conflict between a variable "fstat" and the syscall]
|> [program with fstat variable dies: stdio uses fstat() the syscall]
|
|Why?  You haven't redeclared fstat.  The *loader* should warn, but
|currently can't because all it sees in stdio is "reference to external
|undefined" which it can't check against "definition of external data" -
|it doesn't know it should be "...external text".  If the compiler and
|loader cooperated, the loader could complain about satisfying a text
|segment reference with a data segment symbol.
|
|					der Mouse
+---

How about if the loader made sure that each undefined external resolves
to exactly one defined object?  In other words if ld is working on
resolving `fstat' and finds an `int fstat' in the object file and 
an `int fstat()' in a library it should flag this with a warning.


-- Scott Schwartz            schwartz@gondor.psu.edu

ron@topaz.rutgers.edu (Ron Natalie) (10/04/87)

But the basic premise of a library module is that if it is not
needed to satisfy an existing external reference it should be
ignored.