From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Michal Marek <mmarek@suse.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 0/8] Trim unused exported kernel symbols
Date: Fri, 4 Mar 2016 00:40:42 -0500 [thread overview]
Message-ID: <1457070050-1564-1-git-send-email-nicolas.pitre@linaro.org> (raw)
This patch series provides the option to omit exported symbols from
the kernel and modules that are never referenced by any of the selected
modules in the current kernel configuration. this allows for optimizing
the compiled code and reducing final binaries' size. When using LTO the
binary size reduction is even more effective. It could also be argued
that this could bring some security advantages.
The original cover letter with lots of test results can be found here:
https://lkml.org/lkml/2016/2/8/813
Please consider for merging into your tree. Alternately, the following
branch can be pulled:
http://git.linaro.org/people/nicolas.pitre/linux.git autoksyms
Thanks.
Changes from v4:
- Correctness changes plus small cleanup to adjust_autoksyms.sh as
suggested by Michal Marek.
- Changed ksym build dependency generation by re-running the preprocessor
rather than collecting those dependencies as warnings through stderr
which was too fragile.
Changes from v3:
- Shell portability changes to adjust_autoksyms.sh, partly from
suggestions by Zev Weiss.
- Fix sample modules by building them before adjust_autoksyms.sh is run.
Changes from v2:
- Generating the build dependencies by parsing the source with fixdep
turned out to be unreliable due to all the EXPORT_SYMBOL() variants,
and especially their use within macros where the actual symbol name
is known only after running the preprocessor. This list of symbol names
is now obtained from the preprocessor directly, fixing allmodconfig
builds.
Changes from v1:
- Replaced "exp" that doesn't convey the right meaning as noted by
Sam Ravnborg. The "ksym" identifier is actually what the kernel
already uses for this. Therefore:
- CONFIG_TRIM_UNUSED_EXPSYMS --> CONFIG_TRIM_UNUSED_KSYMS
- include/generated/expsyms.h --> include/generated/autoksyms.h
- #define __EXPSYM_* --> #define __KSYM_*
- Some sed regexp improvements as suggested by Al Viro.
- Renamed vmlinux_recursive target to autoksyms_recursive.
- Accept EXPORT_SYMBOL variants with a prefix, e.g. ACPI_EXPORT_SYMBOL.
- Minor commit log clarifications.
- Added Rusty's ACK.
diffstat:
Makefile | 23 ++++++--
include/linux/export.h | 33 +++++++++++-
init/Kconfig | 16 ++++++
scripts/Kbuild.include | 29 ++++++++++-
scripts/Makefile.build | 22 ++++----
scripts/adjust_autoksyms.sh | 101 ++++++++++++++++++++++++++++++++++++
scripts/basic/fixdep.c | 61 ++++++++++++++++------
7 files changed, 255 insertions(+), 30 deletions(-)
next reply other threads:[~2016-03-04 5:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-04 5:40 Nicolas Pitre [this message]
2016-03-04 5:40 ` [PATCH v5 1/8] kbuild: record needed exported symbols for modules Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 2/8] allow for per-symbol configurable EXPORT_SYMBOL() Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 3/8] fixdep: accept extra dependencies on stdin Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 4/8] kbuild: de-duplicate fixdep usage Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 5/8] kbuild: add fine grained build dependencies for exported symbols Nicolas Pitre
2016-03-04 22:51 ` Michal Marek
2016-03-04 22:53 ` Michal Marek
2016-03-05 7:12 ` Michal Marek
2016-03-06 2:33 ` Nicolas Pitre
2016-03-06 6:20 ` Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 6/8] create/adjust generated/autoksyms.h Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 7/8] kbuild: build sample modules along with the rest of the kernel Nicolas Pitre
2016-03-04 5:40 ` [PATCH v5 8/8] kconfig option for TRIM_UNUSED_KSYMS Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457070050-1564-1-git-send-email-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®