forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
kbuild: re-implement CONFIG_TRIM_UNUSED_KSYMS to make it work in one-…
…pass Commit a555bdd ("Kbuild: enable TRIM_UNUSED_KSYMS again, with some guarding") re-enabled this feature, but Linus is still unhappy about the build time. The reason of the slowness is the recursion - this basically works in two loops. In the first loop, Kbuild builds the entire tree based on the temporary autoksyms.h, which contains macro defines to control whether their corresponding EXPORT_SYMBOL() is enabled or not, and also gathers all symbols required by modules. After the tree traverse, Kbuild updates autoksyms.h and triggers the second loop to rebuild source files whose EXPORT_SYMBOL() needs flipping. This commit re-implements CONFIG_TRIM_UNUSED_KSYMS to make it work in one pass. In the new design, unneeded EXPORT_SYMBOL() instances are trimmed by the linker instead of the preprocessor. After the tree traverse, a linker script snippet <generated/keep-ksyms.h> is generated. It feeds the list of necessary sections to vmlinus.lds.S and modules.lds.S. The other sections fall into /DISCARD/. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
- Loading branch information
1 parent
6710102
commit 331032950fb793dce926a30d68897756d504c4a9
Showing
15 changed files
with
105 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| #ifndef __KSYMS_LDS_H | ||
| #define __KSYMS_LDS_H | ||
|
|
||
| #if defined(CONFIG_TRIM_UNUSED_KSYMS) && !defined(NO_TRIM_KSYMS) | ||
| #include <generated/keep-ksyms.h> | ||
|
|
||
| #define KSYM_DISCARDS *(___ksymtab+*) \ | ||
| *(___ksymtab_gpl+*) \ | ||
| *(___kcrctab+*) \ | ||
| *(___kcrctab_gpl+*) \ | ||
| *(__ksymtab_strings+*) | ||
| #else | ||
| #define KSYMTAB KEEP(*(SORT(___ksymtab+*))) | ||
| #define KSYMTAB_GPL KEEP(*(SORT(___ksymtab_gpl+*))) | ||
| #define KCRCTAB KEEP(*(SORT(___kcrctab+*))) | ||
| #define KCRCTAB_GPL KEEP(*(SORT(___kcrctab_gpl+*))) | ||
| #define KSYMTAB_STRINGS *(__ksymtab_strings+*) | ||
| #define KSYM_DISCARDS | ||
| #endif | ||
|
|
||
| #endif /* __KSYMS_LDS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.