From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20209 invoked by alias); 17 Jun 2007 17:10:10 -0000 Received: (qmail 20192 invoked by uid 22791); 17 Jun 2007 17:10:09 -0000 X-Spam-Check-By: sourceware.org Received: from ns.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 17 Jun 2007 17:10:07 +0000 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id D4BE612268 for ; Sun, 17 Jun 2007 19:10:04 +0200 (CEST) From: Andreas Schwab To: libc-hacker@sourceware.org Subject: Fix section selection in crt objects X-Yow: Hello... IRON CURTAIN? Send over a SAUSAGE PIZZA! World War III? No thanks! Date: Sun, 17 Jun 2007 17:10:00 -0000 Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00011.txt.bz2 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 * 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 * 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."