From: Andreas Schwab <schwab@suse.de>
To: libc-hacker@sourceware.org
Subject: Fix section selection in crt objects
Date: Sun, 17 Jun 2007 17:10:00 -0000 [thread overview]
Message-ID: <jeodjeeccz.fsf@sykes.suse.de> (raw)
When compiling with gcc 4.2 the call to call_gmon_start is inlined into
_init in initfini.c. This is normally not a problem, but on ppc64 a TOC
entry needs to be allocated, and because gcc does not know about the
manually changed section it just switches back to .text afterwards. So
we better tell gcc about the nonstandard sections. Currently only _init
in sysdeps/generic/initfini.c is affected, but for future-proofness I've
changed _fini and the uses in nptl as well.
Andreas.
2007-06-17 Andreas Schwab <schwab@suse.de>
* sysdeps/pthread/pt-initfini.c: Tell gcc about the nonstandard
sections.
--- nptl/sysdeps/pthread/pt-initfini.c.~1.4.~ 2005-02-28 14:18:03.000000000 +0100
+++ nptl/sysdeps/pthread/pt-initfini.c 2007-06-17 12:35:07.000000000 +0200
@@ -72,7 +72,7 @@ call_initialize_minimal (void)
}
SECTION (".init");
-extern void _init (void);
+extern void __attribute__ ((section (".init"))) _init (void);
void
_init (void)
{
@@ -93,7 +93,7 @@ asm ("\n/*@_init_EPILOG_ENDS*/");
asm ("\n/*@_fini_PROLOG_BEGINS*/");
SECTION (".fini");
-extern void _fini (void);
+extern void __attribute__ ((section (".fini"))) _fini (void);
void
_fini (void)
{
2007-06-17 Andreas Schwab <schwab@suse.de>
* sysdeps/generic/initfini.c: Tell gcc about the nonstandard
sections.
--- sysdeps/generic/initfini.c.~1.9.~ 2004-08-16 11:08:09.000000000 +0200
+++ sysdeps/generic/initfini.c 2007-06-17 12:24:24.000000000 +0200
@@ -81,7 +81,7 @@ call_gmon_start(void)
}
SECTION (".init");
-extern void _init (void);
+extern void __attribute__ ((section (".init"))) _init (void);
void
_init (void)
{
@@ -107,7 +107,7 @@ asm ("\n/*@_init_EPILOG_ENDS*/");
asm ("\n/*@_fini_PROLOG_BEGINS*/");
SECTION (".fini");
-extern void _fini (void);
+extern void __attribute__ ((section (".fini"))) _fini (void);
void
_fini (void)
{
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next reply other threads:[~2007-06-17 17:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-17 17:10 Andreas Schwab [this message]
2007-06-17 18:03 ` Ulrich Drepper
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=jeodjeeccz.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=libc-hacker@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).