From: Stephen Boyd <sboyd@codeaurora.org>
To: josh@joshtriplett.org, "Peter Hüwe" <PeterHuewe@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: .exit.text section in vmlinux ?
Date: Tue, 21 Oct 2014 17:10:52 -0700 [thread overview]
Message-ID: <5446F60C.4010500@codeaurora.org> (raw)
In-Reply-To: <5446F2C0.10309@codeaurora.org>
On 10/21/2014 04:56 PM, Stephen Boyd wrote:
> On 10/21/2014 04:35 PM, josh@joshtriplett.org wrote:
>> --->8---
>> From 1646d051a4a4c18b9a6163fceabcafa20628c728 Mon Sep 17 00:00:00 2001
>> From: Josh Triplett <josh@joshtriplett.org>
>> Date: Tue, 21 Oct 2014 16:14:19 -0700
>> Subject: [PATCH] linux/init.h: Always omit __exit code and data for in-kernel
>> compilation
>>
>> __exit code and data only exists for module removal; when compiling such
>> code in the kernel, omit the __exit functions to save space. For x86
>> defconfig this saves about 9k, and significantly more in the compiled
>> binary size.
> Does it boot? Usually we can't get rid of the exit section because we
> have some table pointing at it somewhere for bug tables, alternatives,
> etc. See this comment in arch/x86/kernel/vmlinux.lds.S for example:
>
> /*
> * .exit.text is discard at runtime, not link time, to deal with
> * references from .altinstructions and .eh_frame
> */
> .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
> EXIT_TEXT
> }
>
> .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
> EXIT_DATA
> }
>
>
Furthermore, on ARM we discard the exit text and exit data in the linker
script if we're not using the generic bug tables or patching spinlocks
for uniprocessor hardware (see arch/arm/kernel/vmlinux.lds.S). Maybe
something similar can be done for x86?
#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
defined(CONFIG_GENERIC_BUG)
#define ARM_EXIT_KEEP(x) x
#define ARM_EXIT_DISCARD(x)
#else
#define ARM_EXIT_KEEP(x)
#define ARM_EXIT_DISCARD(x) x
#endif
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
prev parent reply other threads:[~2014-10-22 0:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 21:19 .exit.text section in vmlinux ? Peter Hüwe
2014-10-21 23:35 ` josh
2014-10-21 23:56 ` Stephen Boyd
2014-10-22 0:10 ` Stephen Boyd [this message]
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=5446F60C.4010500@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=PeterHuewe@gmx.de \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
/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