Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Question about linking files Message-ID: <16546@mimsy.UUCP> Date: 26 Mar 89 16:10:37 GMT References: <18925@iuvax.cs.indiana.edu> <16541@mimsy.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 40 In article <16541@mimsy.UUCP> chris@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@mimsy.umd.edu Path: uunet!mimsy!chris