Xref: utzoo comp.unix.questions:24205 comp.unix.wizards:23208 comp.lang.c:30679 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: _why_ does the UNIX linker not distinguish text and data addresses??? Message-ID: <365@taumet.com> Date: 31 Jul 90 16:25:17 GMT References: <1990Jul30.104726.22660@mtcchi.uucp> Followup-To: comp.unix.questions Distribution: na Organization: Taumetric Corporation, San Diego Lines: 27 levy@mtcchi.uucp (Daniel R. Levy) writes: |:::::::::::::: |a.c |:::::::::::::: |main() |{ | (void) bogus(); |} |:::::::::::::: |b.c |:::::::::::::: |int bogus; Traditional Unix object-file formats, and thus the linkers, are very simple-minded. They certainly could distinguish between text and data addresses, but simply don't. It is up to the programmer, even in ANSI C, to take care that extern declarations/definitions in separate compilation units match. Lint will generally pick up mismatches. In C++, BTW, this example will fail at link time no matter what linker is used, since the type of the function is encoded by the compiler into its true external name. -- Steve Clamage, TauMetric Corp, steve@taumet.com