From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9857 invoked by alias); 8 Aug 2006 13:22:32 -0000 Received: (qmail 9838 invoked by uid 22791); 8 Aug 2006 13:22:32 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 08 Aug 2006 13:22:28 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id k78DMIgu014895; Tue, 8 Aug 2006 15:22:18 +0200 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id k78DMIxD014894; Tue, 8 Aug 2006 15:22:18 +0200 Date: Tue, 08 Aug 2006 13:22:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix strtol_l.c for GCC 4.2 Message-ID: <20060808132217.GD4556@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00007.txt.bz2 Hi! GCC 4.2 is very upset if a variable is made linkonce behind its back (particularly the var anchoring code). This patch changes it, so that the arrays are only defined in one of the .o{,s} files they are used and all the others use it. 2006-08-08 Jakub Jelinek * stdlib/strtol_l.c (__strtol_ul_max_tab, __strtol_ul_rem_tab, __strtol_ull_max_tab, __strtol_ull_rem_tab): Declare. (DEF): Don't put the var into .gnu.linkonce.r.* section. Only provide var definitions in strtol_l (or for *ull* in strtoll_l). --- libc/stdlib/strtol_l.c.jj 2005-12-14 12:13:59.000000000 +0100 +++ libc/stdlib/strtol_l.c 2006-08-08 14:21:19.000000000 +0200 @@ -1,5 +1,5 @@ /* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -168,10 +168,15 @@ /* Define tables of maximum values and remainders in order to detect overflow. Do this at compile-time in order to avoid the runtime overhead of the division. */ +extern const unsigned long __strtol_ul_max_tab[] attribute_hidden; +extern const unsigned char __strtol_ul_rem_tab[] attribute_hidden; +#if defined(QUAD) && __WORDSIZE == 32 +extern const unsigned long long __strtol_ull_max_tab[] attribute_hidden; +extern const unsigned char __strtol_ull_rem_tab[] attribute_hidden; +#endif #define DEF(TYPE, NAME) \ - const TYPE NAME[] attribute_hidden \ - __attribute__((section(".gnu.linkonce.r." #NAME))) = \ + const TYPE NAME[] attribute_hidden = \ { \ F(2), F(3), F(4), F(5), F(6), F(7), F(8), F(9), F(10), \ F(11), F(12), F(13), F(14), F(15), F(16), F(17), F(18), F(19), F(20), \ @@ -179,20 +184,22 @@ F(31), F(32), F(33), F(34), F(35), F(36) \ } -#define F(X) ULONG_MAX / X +#if !UNSIGNED && !defined (USE_WIDE_CHAR) && !defined (QUAD) +# define F(X) ULONG_MAX / X DEF (unsigned long, __strtol_ul_max_tab); -#undef F -#if defined(QUAD) && __WORDSIZE == 32 +# undef F +# define F(X) ULONG_MAX % X + DEF (unsigned char, __strtol_ul_rem_tab); +# undef F +#endif +#if !UNSIGNED && !defined (USE_WIDE_CHAR) && defined (QUAD) \ + && __WORDSIZE == 32 # define F(X) ULONG_LONG_MAX / X DEF (unsigned long long, __strtol_ull_max_tab); # undef F # define F(X) ULONG_LONG_MAX % X DEF (unsigned char, __strtol_ull_rem_tab); # undef F -#else -# define F(X) ULONG_MAX % X - DEF (unsigned char, __strtol_ul_rem_tab); -# undef F #endif #undef DEF Jakub