public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix _itoa_lower_digits (was Re: bootstrap 2.95 libc not building on alpha)
       [not found] <3C8F6C22.6B38A19E@iol.unh.edu>
@ 2002-03-13  8:36 ` Jakub Jelinek
  2002-03-13 15:13   ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-03-13  8:36 UTC (permalink / raw)
  To: Ulrich Drepper, Matthew Bemis; +Cc: libc-hacker

Hi!

On Wed, Mar 13, 2002 at 10:11:30AM -0500, Matthew Bemis wrote:
> todays build produced the following error
> /mnt/u9/toolchain/buildsys/build/alpha9/bootstrap-gcc_2.95.3/native/libc/elf/dl-
> 
> allobjs.os:/mnt/u9/toolchain/buildsys/source/libc/elf/rtld.c:1475: first
> defined
>  here
> /home/toolchain/baseline/install/alpha9/bootstrap-gcc_2.95.3/native/binutils-2.1
> 
> 1.2/bin/ld: Warning: size of symbol `_itoa_lower_digits' changed from 16
> to 36 in itoa-digits.os
> collect2: ld returned 1 exit status

I think we should use _itoa_lower_digits_internal to avoid confusion.
The above error is because rtld.c used stdio-common/_itoa.h while
dl-reloc.c and dl-minimal.c used/defined _itoa_lower_digits explicitely.

BTW: It is wrong that mp_clz_tab.c is "Not needed anywhere", it is
just not needed anywhere on certain arches. I'd think the best thing to do
would be to put them back, make __clz_tab hidden (but am not sure if
it should be in stdlib/longlong.h header (as e.g. gcc is not interested in
such changes), probably in include/longlong.h instead and include
<stdlib/longlong.h> in there), include <longlong.h> and other needed headers
in mp_clz_tab.c and surround the actual table with something like:
#if defined(COUNT_LEADING_ZEROS_0) \
    && !defined(__a29k__) && !defined(__m88000__) && !defined(_ARCH_PPC)
...
#endif
(or in longlong.h:
 extern const UQItype __clz_tab[];
+#define CLZ_TAB_NEEDED

and test that in mp_clz_tab.c).

Also, I guess libc-symbols.h:
# define _INTVARDEF(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((alias (#name), \
                                                   visibility ("hidden")));
will need some #ifdef around if attribute_hidden is not supported.

2002-03-13  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-minimal.c (_itoa): Use _itoa_lower_digits_internal if
	SHARED.
	* elf/dl-reloc.c (_dl_reloc_bad_type): Likewise.

--- libc/elf/dl-minimal.c.jj	Wed Mar 13 08:40:49 2002
+++ libc/elf/dl-minimal.c	Wed Mar 13 11:07:04 2002
@@ -290,12 +290,12 @@ _itoa (value, buflim, base, upper_case)
      unsigned int base;
      int upper_case;
 {
-  extern const char _itoa_lower_digits[] attribute_hidden;
+  extern const char INTUSE(_itoa_lower_digits)[] attribute_hidden;
 
   assert (! upper_case);
 
   do
-    *--buflim = _itoa_lower_digits[value % base];
+    *--buflim = INTUSE(_itoa_lower_digits)[value % base];
   while ((value /= base) != 0);
 
   return buflim;
@@ -348,4 +348,5 @@ strong_alias (__strsep, __strsep_g)
 
 /* The '_itoa_lower_digits' variable in libc.so is able to handle bases
    up to 36.  We don't need this here.  */
-const char _itoa_lower_digits[16] = "0123456789abcdef";
+const char INTUSE(_itoa_lower_digits)[16] attribute_hidden
+  = "0123456789abcdef";
--- libc/elf/dl-reloc.c.jj	Wed Mar 13 08:40:49 2002
+++ libc/elf/dl-reloc.c	Wed Mar 13 11:08:41 2002
@@ -210,8 +210,8 @@ void
 internal_function
 _dl_reloc_bad_type (struct link_map *map, unsigned int type, int plt)
 {
-  extern const char _itoa_lower_digits[] attribute_hidden;
-#define DIGIT(b)	_itoa_lower_digits[(b) & 0xf];
+  extern const char INTUSE(_itoa_lower_digits)[] attribute_hidden;
+#define DIGIT(b)	INTUSE(_itoa_lower_digits)[(b) & 0xf];
 
   /* XXX We cannot translate these messages.  */
   static const char msg[2][32] = { "unexpected reloc type 0x",


	Jakub

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

* Re: [PATCH] Fix _itoa_lower_digits (was Re: bootstrap 2.95 libc not building on alpha)
  2002-03-13  8:36 ` [PATCH] Fix _itoa_lower_digits (was Re: bootstrap 2.95 libc not building on alpha) Jakub Jelinek
@ 2002-03-13 15:13   ` Ulrich Drepper
  2002-03-14  9:38     ` [PATCH] Fix __clz_tab Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 2002-03-13 15:13 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Matthew Bemis, libc-hacker

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

On Wed, 2002-03-13 at 08:36, Jakub Jelinek wrote:

> I think we should use _itoa_lower_digits_internal to avoid confusion.
> The above error is because rtld.c used stdio-common/_itoa.h while
> dl-reloc.c and dl-minimal.c used/defined _itoa_lower_digits explicitely.

This shouldn't be necessary but so be it.  I've applied the patch.


> BTW: It is wrong that mp_clz_tab.c is "Not needed anywhere",

Because I haven't looked everywhere I haven't removed the file.

> it is
> just not needed anywhere on certain arches. I'd think the best thing to do
> would be to put them back, make __clz_tab hidden (but am not sure if
> it should be in stdlib/longlong.h header (as e.g. gcc is not interested in
> such changes),

The file is not going back for all archs.  Any change will have to
happen in an architecture-dependent Makefile.  How the attribute is
added is another problem.

Platforms oher than x86 are really not optimized in the moment so there
is no need for such an isolated attempt at this time.  Once I'm through
I'll look at ia64 and alpha but all the rest remains for others.  A lot
of the optimizations are generic but still there is work to do.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

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

* [PATCH] Fix __clz_tab
  2002-03-13 15:13   ` Ulrich Drepper
@ 2002-03-14  9:38     ` Jakub Jelinek
  2002-03-14 12:45       ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-03-14  9:38 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

On Wed, Mar 13, 2002 at 03:13:32PM -0800, Ulrich Drepper wrote:
> > it is
> > just not needed anywhere on certain arches. I'd think the best thing to do
> > would be to put them back, make __clz_tab hidden (but am not sure if
> > it should be in stdlib/longlong.h header (as e.g. gcc is not interested in
> > such changes),
> 
> The file is not going back for all archs.  Any change will have to
> happen in an architecture-dependent Makefile.  How the attribute is
> added is another problem.

Something like this (I haven't bothered with attribute_hidden for it yet)?
I think the default should be to compile __clz_tab in, since
from currently supported glibc major architectures it is needed for 10 and
not needed for 3.

2002-03-14  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/mp_clz_tab.c: New.
	* sysdeps/i386/mp_clz_tab.c: New.
	* sysdeps/hppa/mp_clz_tab.c: New.
	* sysdeps/powerpc/mp_clz_tab.c: New.
	* stdlib/Makefile (aux): Revert last patch.
	* math/Makefile (gmp-objs): Likewise.

--- libc/math/Makefile.jj	Wed Mar 13 07:53:21 2002
+++ libc/math/Makefile	Thu Mar 14 08:00:28 2002
@@ -183,7 +183,7 @@ o = .os
 endif
 gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%$o,\
 		      add_n sub_n cmp addmul_1 mul_1 mul_n divmod_1 \
-		      lshift rshift udiv_qrnnd inlines)
+		      lshift rshift mp_clz_tab udiv_qrnnd inlines)
 $(objpfx)atest-exp: $(gmp-objs)
 $(objpfx)atest-sincos: $(gmp-objs)
 $(objpfx)atest-exp2: $(gmp-objs)
--- libc/stdlib/Makefile.jj	Thu Mar 14 06:20:28 2002
+++ libc/stdlib/Makefile	Thu Mar 14 08:01:28 2002
@@ -70,9 +70,7 @@ mpn-headers = longlong.h gmp.h gmp-impl.
 routines := $(strip $(routines) $(mpn-routines))	\
 	    dbl2mpn ldbl2mpn				\
 	    mpn2flt mpn2dbl mpn2ldbl
-# mp_clz seems not to be used.  At least on x86.  If removing the file
-# does not cause problem clean this up and actually remove the file.
-aux := fpioconst# mp_clz_tab
+aux := fpioconst mp_clz_tab
 distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
 
 generated += isomac isomac.out
--- libc/sysdeps/generic/mp_clz_tab.c.jj	Thu Mar 14 08:04:35 2002
+++ libc/sysdeps/generic/mp_clz_tab.c	Mon Jul  9 14:57:52 2001
@@ -0,0 +1,37 @@
+/* __clz_tab -- support for longlong.h
+   Copyright (C) 1991, 1993, 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in the GNU MP Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if 0
+#include "gmp.h"
+#include "gmp-impl.h"
+#endif
+
+const
+unsigned char __clz_tab[] =
+{
+  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+};
--- libc/sysdeps/hppa/mp_clz_tab.c.jj	Thu Mar 14 08:06:11 2002
+++ libc/sysdeps/hppa/mp_clz_tab.c	Thu Mar 14 08:06:11 2002
@@ -0,0 +1 @@
+/* __clz_tab not needed on hppa.  */
--- libc/sysdeps/i386/mp_clz_tab.c.jj	Thu Mar 14 08:05:58 2002
+++ libc/sysdeps/i386/mp_clz_tab.c	Thu Mar 14 08:05:58 2002
@@ -0,0 +1 @@
+/* __clz_tab not needed on i386.  */
--- libc/sysdeps/powerpc/mp_clz_tab.c.jj	Thu Mar 14 08:06:29 2002
+++ libc/sysdeps/powerpc/mp_clz_tab.c	Thu Mar 14 08:06:29 2002
@@ -0,0 +1 @@
+/* __clz_tab not needed on powerpc.  */


	Jakub

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

* Re: [PATCH] Fix __clz_tab
  2002-03-14  9:38     ` [PATCH] Fix __clz_tab Jakub Jelinek
@ 2002-03-14 12:45       ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2002-03-14 12:45 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On Thu, 2002-03-14 at 09:37, Jakub Jelinek wrote:

> 2002-03-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* sysdeps/generic/mp_clz_tab.c: New.
> 	* sysdeps/i386/mp_clz_tab.c: New.
> 	* sysdeps/hppa/mp_clz_tab.c: New.
> 	* sysdeps/powerpc/mp_clz_tab.c: New.
> 	* stdlib/Makefile (aux): Revert last patch.
> 	* math/Makefile (gmp-objs): Likewise.

I've applied this patch.  Thanks,

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

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

end of thread, other threads:[~2002-03-14 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3C8F6C22.6B38A19E@iol.unh.edu>
2002-03-13  8:36 ` [PATCH] Fix _itoa_lower_digits (was Re: bootstrap 2.95 libc not building on alpha) Jakub Jelinek
2002-03-13 15:13   ` Ulrich Drepper
2002-03-14  9:38     ` [PATCH] Fix __clz_tab Jakub Jelinek
2002-03-14 12:45       ` 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).