Question about linking files
Chris Torek
chris at mimsy.UUCP
Mon Mar 27 02:10:37 AEST 1989
In article <16541 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>Given that the pANS does not have the concept of a `library', or
>even of `separate compilation', ...
I should probably rephrase that. It does have something called
`external linkage'; it just does not tie it specifically to `separate
compilation' and `libraries'. (The difference is that between what
must be and what usually is.)
I should also restate my point, which is this: You cannot tell which
functions are needed---consider the program
main()
{
while (the_machine_continues_to_exist())
/* void */;
/* never gets here */
library_function_f();
exit(0);
}
---so the best you can do is an approximation (`the function strftime
will never be called; the function strcpy might be called; ...').
Unfortunately, unless the link file format has been carefully defined
and the compiler cooperates, you cannot even do that:
_foo: .globl _foo
.word 0
movl $_foo+foosize,r0
calls $0,(r0)
ret
.align 2
0: .set foosize,0b-_foo
The VAX-assembly-code function foo() calls whichever function is
linked immediately following it, so eliding that function because it
appears unused changes the execution.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list