public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Fix section selection in crt objects
@ 2007-06-17 17:10 Andreas Schwab
  2007-06-17 18:03 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2007-06-17 17:10 UTC (permalink / raw)
  To: libc-hacker

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."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix section selection in crt objects
  2007-06-17 17:10 Fix section selection in crt objects Andreas Schwab
@ 2007-06-17 18:03 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2007-06-17 18:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Checked in.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFGdXds2ijCOnn/RHQRAml7AJ92Dj45l2hGNRAn5WpSmRczWXE/zwCggtSU
V3F8di2K37Cnfc4QHIJKI50=
=uZli
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-17 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-17 17:10 Fix section selection in crt objects Andreas Schwab
2007-06-17 18:03 ` Ulrich Drepper

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).