On Wed, 5 Apr 2000, Graham Stoney wrote:
> What you've seen is the Makefiles and/or linker removing entire .o files which
> weren't referenced. The current compiler settings won't remove unused
> functions from .o's which contain other functions that are used. The /proc
> support functions scattered in objects that are needed for other reasons is
> one example: they are there even if CONFIG_PROC_FS is turned off.
I hate to be a pain, but I am _very_ certain the current linking
environment will remove individual functions from .a files.
The kernel Makefile uses "--start-group", an exerpt from the manual of LD:
[begin quote from LD manual]
--start-group archives --end-group
The archives should be a list of archive files. They may be either
explicit file names, or `-l' options. The specified archives are searched
repeatedly until no new undefined references are created. Normally, an archive is
searched only once in the order that it is specified on the command line.
If a symbol in that archive is needed to resolve an undefined symbol referred to by
an object in an archive that appears later on the command line, the linker
would not be able to resolve that reference. By grouping the
archives, they all be searched repeatedly until all possible references
are resolved. Using this option has a significant performance cost. It is best
to use it only when there are unavoidable circular references between two or more
archives.
[end quote]
This implies that (and it actually happens)
1) Normal linking of .a files removes all not-yet-referenced functions, in
a way that if a function is referenced in an .o/.a file later on the
commandline, it's to bad as it is already removed.
2) with the --start-group/--end-group directives, the removal of the
unreferenced functions is postponed to the point where the "--end-group"
function is located, but the removal still takes place
Greetings,
Arjan van de Ven
-------------------------------------------------------------------
Is'nt it great that two people from competing R&D labs still are able
to talk about Linux in a public forum
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:14 EST