Feature idea for GCC: link dependencies

Martin Schaffner maschaffner@gmx.ch
Mon Jul 14 17:00:00 GMT 2003


Hi,

GCC is already able to create makefile fragments containing compile
dependencies of source files.

I propose an extension to enable it to add link dependencies to such
makefile fragments. A file main.c has a link dependency on foo.c if a function
defined in main.c calls a function defined in foo.c. The idea is to maintain such
link dependencies in the source code instead of in "makefile" or
"makefile.am". If foo.h contains a line `#pragma linkdep "foo.c"', then the compiler
knows that every source file with a line `#include "foo.h"' has a link dependency
on foo.c. If it links main.o into an executable, it has to link it with
foo.o.

I created a patch which implements the above proposition:
http://in3www.epfl.ch/~schaffne/use/gcc-cvs-3-7-14-linkdep.ptch
Please comment and criticize.

Martin Schaffner

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!



More information about the Gcc mailing list