From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Link failures due to __bug_table in current -next
Date: Mon, 19 Sep 2011 20:12:40 +0100 [thread overview]
Message-ID: <20110919191240.GA15786@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110919185809.GA16381@n2100.arm.linux.org.uk>
On Mon, Sep 19, 2011 at 07:58:09PM +0100, Russell King - ARM Linux wrote:
> What you're actually after is:
>
> 7c8a25b (CRIS: Discard exit.text and .data at runtime)
You're talking about this:
SECURITY_INIT
+ /* .exit.text is discarded at runtime, not link time,
+ * to deal with references from __bug_table
+ */
+ .exit.text : {
+ EXIT_TEXT
+ }
+ .exit.data : {
+ EXIT_DATA
+ }
+
This "fix" won't work for us - the exit text is being discarded
by the very first /DISCARD/ statement due to merging of /DISCARD/
output sections in the linker script, as I explained in my initial
reply to you.
include/asm-generic/vmlinux.lds.S:
#define EXIT_TEXT \
*(.exit.text) \
DEV_DISCARD(exit.text) \
CPU_DISCARD(exit.text) \
MEM_DISCARD(exit.text)
#define DISCARDS \
/DISCARD/ : { \
EXIT_TEXT \
EXIT_DATA \
EXIT_CALL \
*(.discard) \
*(.discard.*) \
}
and our vmlinux.lds.S:
SECTIONS
{
/*
* unwind exit sections must be discarded before the rest of the
* unwind sections get included.
*/
/DISCARD/ : {
*(.ARM.exidx.exit.text)
*(.ARM.extab.exit.text)
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
#ifndef CONFIG_HOTPLUG
*(.ARM.exidx.devexit.text)
*(.ARM.extab.devexit.text)
#endif
#ifndef CONFIG_MMU
*(.fixup)
*(__ex_table)
#endif
#ifndef CONFIG_SMP_ON_UP
*(.alt.smp.init)
#endif
}
...
.exit.text : {
ARM_EXIT_KEEP(EXIT_TEXT)
}
...
/* Default discards */
DISCARDS
}
This is functionally equivalent with *current* linkers to:
SECTIONS
{
/*
* unwind exit sections must be discarded before the rest of the
* unwind sections get included.
*/
/DISCARD/ : {
*(.ARM.exidx.exit.text)
*(.ARM.extab.exit.text)
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
#ifndef CONFIG_HOTPLUG
*(.ARM.exidx.devexit.text)
*(.ARM.extab.devexit.text)
#endif
#ifndef CONFIG_MMU
*(.fixup)
*(__ex_table)
#endif
#ifndef CONFIG_SMP_ON_UP
*(.alt.smp.init)
#endif
EXIT_TEXT
EXIT_DATA
EXIT_CALL
*(.discard)
*(.discard.*)
}
...
.exit.text : {
ARM_EXIT_KEEP(EXIT_TEXT)
}
...
}
and as *current* linker behaviour is the first input section found in
order in its internal list of output sections matches, the result is
that .exit.text is _always_ discarded irrespective of whether we want
it or not.
As an additional note, I can find nothing in the linker manual which
defines the behaviour of:
/DISCARD/ : {
*(.this.section.should.be.discarded)
}
.keep : {
*(.this.section.*)
}
It is entirely undefined whether ".this.section.should.be.discarded"
would be discarded or whether it ends up in .keep - it all depends on
the internal - undocumented - behaviour of the linker when assigning
input sections to output sections. As I mention above, that's
observably internal-merged-output-section-order,
input-section-order-within-output-section with current linkers but
there's no guarantee it'll remain that way.
I think we're running into some fundamental problems here, and I think
we need to get binutils people to come out with a statement concerning
how input sections are matched to output sections when there's multiple
statements in the linker script which match (eg, the most specific
match gets priority) and then we need to ensure that the kernels linker
scripts do not rely on section ordering.
next prev parent reply other threads:[~2011-09-19 19:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 12:09 Link failures due to __bug_table in current -next Mark Brown
2011-09-19 18:40 ` Russell King - ARM Linux
2011-09-19 18:42 ` Mark Brown
2011-09-19 18:58 ` Russell King - ARM Linux
2011-09-19 19:06 ` Mark Brown
2011-09-19 19:16 ` Russell King - ARM Linux
2011-09-20 7:35 ` Uwe Kleine-König
2011-09-19 19:12 ` Russell King - ARM Linux [this message]
2011-09-19 20:03 ` Russell King - ARM Linux
2011-09-20 7:06 ` Simon Glass
2011-09-20 7:59 ` Russell King - ARM Linux
2011-09-20 17:00 ` Simon Glass
2011-09-20 18:51 ` Russell King - ARM Linux
2011-09-20 19:13 ` Arnd Bergmann
2011-09-20 19:57 ` Nicolas Pitre
2011-09-21 22:58 ` Simon Glass
2011-09-21 22:45 ` Simon Glass
2011-09-20 11:02 ` Mark Brown
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=20110919191240.GA15786@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).