public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [rfa] fix alpha ld.so undef symbol
@ 2007-03-13 16:48 Richard Henderson
  2007-03-13 20:17 ` Roland McGrath
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2007-03-13 16:48 UTC (permalink / raw)
  To: libc-hacker

Since

2007-02-12  Ulrich Drepper  <drepper@redhat.com>

        * elf/rtld.c (RESOLVE_MAP): Always return bootstrap_map reference.
        * elf/Makefile ($(objpfx)ld.so): Check that ld.so has no undefined
        references.

ld.so has failed on alpha, because we'd had an undef weak symbol
that was resolved from libc.so.  This patch rearranges things so
that the symbol is now defined in ld.so instead.

Of course, that meant that I had to find a new place to get the
symbol defined for the static libc, and in the process I discovered
that we weren't processing the auxv entries for the static libc
either.  This patch fixes that with one ifdef in common code.

Ok?


r~


2007-03-13  Richard Henderson  <rth@redhat.com>

	* elf/dl-support.c (_dl_aux_init): Honor DL_PLATFORM_AUXV.
	* sysdeps/unix/sysv/linux/alpha/dl-auxv.h: New file.
	* sysdeps/unix/sysv/linux/alpha/dl-support.c: New file.
	* sysdeps/unix/sysv/linux/alpha/dl-sysdep.c (__libc_alpha_cache_shape):
	Move to dl-auxv.h; initialize instead of extern weak.
	(DL_PLATFORM_AUXV): Move to dl-auxv.h; don't test for undef
	weak symbol.
	* sysdeps/unix/sysv/linux/alpha/sysconf.c (__libc_alpha_cache_shape):
	Extern instead of initialized.

Index: elf/dl-support.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-support.c,v
retrieving revision 1.91
diff -u -p -r1.91 dl-support.c
--- elf/dl-support.c	19 Dec 2006 15:23:02 -0000	1.91
+++ elf/dl-support.c	13 Mar 2007 16:09:45 -0000
@@ -211,6 +211,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
 	__libc_enable_secure = av->a_un.a_val;
 	__libc_enable_secure_decided = 1;
 	break;
+#ifdef DL_PLATFORM_AUXV
+      DL_PLATFORM_AUXV
+#endif
       }
   if (seen == 0xf)
     {
Index: sysdeps/unix/sysv/linux/alpha/dl-auxv.h
===================================================================
RCS file: sysdeps/unix/sysv/linux/alpha/dl-auxv.h
diff -N sysdeps/unix/sysv/linux/alpha/dl-auxv.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/unix/sysv/linux/alpha/dl-auxv.h	13 Mar 2007 16:09:50 -0000
@@ -0,0 +1,36 @@
+/* Auxiliary vector processing for Linux/Alpha.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C 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.  */
+
+/* Scan the Aux Vector for the cache shape entries.  */
+
+long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 };
+
+#define DL_PLATFORM_AUXV				\
+      case AT_L1I_CACHESHAPE:				\
+	__libc_alpha_cache_shape[0] = av->a_un.a_val;	\
+	break;						\
+      case AT_L1D_CACHESHAPE:				\
+	__libc_alpha_cache_shape[1] = av->a_un.a_val;	\
+	break;						\
+      case AT_L2_CACHESHAPE:				\
+	__libc_alpha_cache_shape[2] = av->a_un.a_val;	\
+	break;						\
+      case AT_L3_CACHESHAPE:				\
+	__libc_alpha_cache_shape[3] = av->a_un.a_val;	\
+	break;
Index: sysdeps/unix/sysv/linux/alpha/dl-support.c
===================================================================
RCS file: sysdeps/unix/sysv/linux/alpha/dl-support.c
diff -N sysdeps/unix/sysv/linux/alpha/dl-support.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/unix/sysv/linux/alpha/dl-support.c	13 Mar 2007 16:09:50 -0000
@@ -0,0 +1,2 @@
+#include "dl-auxv.h"
+#include <elf/dl-support.c>
Index: sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 dl-sysdep.c
--- sysdeps/unix/sysv/linux/alpha/dl-sysdep.c	8 Jan 2006 08:21:16 -0000	1.2
+++ sysdeps/unix/sysv/linux/alpha/dl-sysdep.c	13 Mar 2007 16:09:50 -0000
@@ -1,59 +1,2 @@
-/* Operating system support for run-time dynamic linker.  Linux/Alpha version.
-   Copyright (C) 1997, 1998, 2001, 2003, 2006 Free Software Foundation, Inc.
-   This file is part of the GNU C 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.  */
-
-#include <config.h>
-#include <kernel-features.h>
-#include <ldsodefs.h>
-
-extern long __libc_alpha_cache_shape[4];
-weak_extern (__libc_alpha_cache_shape);
-
-
-/* Scan the Aux Vector for the cache shape entries.  */
-#define DL_PLATFORM_AUXV				\
-      case AT_L1I_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[0] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L1D_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[1] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L2_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[2] = av->a_un.a_val;			\
-	  break;					\
-	}						\
-      case AT_L3_CACHESHAPE:				\
-	{						\
-	  long *cls = __libc_alpha_cache_shape;		\
-	  if (cls != NULL)				\
-	    cls[3] = av->a_un.a_val;			\
-	  break;					\
-	}
-
+#include "dl-auxv.h"
 #include <sysdeps/unix/sysv/linux/dl-sysdep.c>
Index: sysdeps/unix/sysv/linux/alpha/sysconf.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sysconf.c,v
retrieving revision 1.1
diff -u -p -r1.1 sysconf.c
--- sysdeps/unix/sysv/linux/alpha/sysconf.c	7 May 2004 01:57:19 -0000	1.1
+++ sysdeps/unix/sysv/linux/alpha/sysconf.c	13 Mar 2007 16:09:51 -0000
@@ -27,7 +27,7 @@ static long int linux_sysconf (int name)
 #define CSHAPE(totalsize, linesize, assoc) \
   ((totalsize & ~0xff) | (linesize << 4) | assoc)
 
-long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 };
+extern long __libc_alpha_cache_shape[4];
 
 static inline unsigned long
 implver (void)

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

* Re: [rfa] fix alpha ld.so undef symbol
  2007-03-13 16:48 [rfa] fix alpha ld.so undef symbol Richard Henderson
@ 2007-03-13 20:17 ` Roland McGrath
  2007-03-13 20:41   ` Steven Munroe
  2007-03-13 21:15   ` [rfa] fix alpha ld.so undef symbol Richard Henderson
  0 siblings, 2 replies; 8+ messages in thread
From: Roland McGrath @ 2007-03-13 20:17 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-hacker

> +#ifdef DL_PLATFORM_AUXV
> +      DL_PLATFORM_AUXV
> +#endif

This looks ok to me, but make it # ifdef there inside another #ifdef.

This will also affect powerpc, which AFAICT was also failing to set its
__cache_line_size in static programs.  It looks to me like that will be fine.


Thanks,
Roland

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

* Re: [rfa] fix alpha ld.so undef symbol
  2007-03-13 20:17 ` Roland McGrath
@ 2007-03-13 20:41   ` Steven Munroe
  2007-03-13 21:04     ` Roland McGrath
  2007-03-20 12:36     ` [PATCH] Fix up ppc __cache_line_size Jakub Jelinek
  2007-03-13 21:15   ` [rfa] fix alpha ld.so undef symbol Richard Henderson
  1 sibling, 2 replies; 8+ messages in thread
From: Steven Munroe @ 2007-03-13 20:41 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Richard Henderson, libc-hacker

Roland McGrath wrote:
>> +#ifdef DL_PLATFORM_AUXV
>> +      DL_PLATFORM_AUXV
>> +#endif
>>     
>
> This looks ok to me, but make it # ifdef there inside another #ifdef.
>
> This will also affect powerpc, which AFAICT was also failing to set its
> __cache_line_size in static programs.  It looks to me like that will be fine.
>
>   
hmmm looks like powerpc needs a
sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV
and include /elf/dl-support.c ?

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

* Re: [rfa] fix alpha ld.so undef symbol
  2007-03-13 20:41   ` Steven Munroe
@ 2007-03-13 21:04     ` Roland McGrath
  2007-03-20 12:36     ` [PATCH] Fix up ppc __cache_line_size Jakub Jelinek
  1 sibling, 0 replies; 8+ messages in thread
From: Roland McGrath @ 2007-03-13 21:04 UTC (permalink / raw)
  To: Steven Munroe; +Cc: Richard Henderson, libc-hacker

> hmmm looks like powerpc needs a
> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV
> and include /elf/dl-support.c ?

Ah yes, you are right.  

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

* Re: [rfa] fix alpha ld.so undef symbol
  2007-03-13 20:17 ` Roland McGrath
  2007-03-13 20:41   ` Steven Munroe
@ 2007-03-13 21:15   ` Richard Henderson
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2007-03-13 21:15 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-hacker

On Tue, Mar 13, 2007 at 01:17:06PM -0700, Roland McGrath wrote:
> This will also affect powerpc, which AFAICT was also failing to set its
> __cache_line_size in static programs.  It looks to me like that will be fine.

ppc can be improved by this patch, but is currently setting __cache_line_size
via a separate loop over auxv in their libc-start.c.


r~

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

* [PATCH] Fix up ppc __cache_line_size
  2007-03-13 20:41   ` Steven Munroe
  2007-03-13 21:04     ` Roland McGrath
@ 2007-03-20 12:36     ` Jakub Jelinek
  2007-03-20 14:59       ` Steven Munroe
  2007-03-22 22:01       ` Steven Munroe
  1 sibling, 2 replies; 8+ messages in thread
From: Jakub Jelinek @ 2007-03-20 12:36 UTC (permalink / raw)
  To: Steven Munroe, Ulrich Drepper
  Cc: Roland McGrath, Richard Henderson, libc-hacker

On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote:
> Roland McGrath wrote:
> >> +#ifdef DL_PLATFORM_AUXV
> >> +      DL_PLATFORM_AUXV
> >> +#endif
> >>     
> >
> > This looks ok to me, but make it # ifdef there inside another #ifdef.
> >
> > This will also affect powerpc, which AFAICT was also failing to set its
> > __cache_line_size in static programs.  It looks to me like that will be fine.
> >
> >   
> hmmm looks like powerpc needs a
> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV
> and include /elf/dl-support.c ?

IMHO there is no reason to use weak_extern for __cache_line_size.
Code to check the weak references and only conditionally set it is
certainly bigger than just defining the hidden variables in libc-start.c
and dl-sysdep.c.
Additionally, if you build power4+ optimized ld.so, __cache_line_size
isn't defined at all and thus dl-machine.c will never use it.

The following patch works for me (though only tested with
binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size
references don't need runtime relocation).  Not sure if we still support
older binutils.

2007-03-20  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/powerpc/libc-start.c
	(__cache_line_size): Define the variable here.  Add
	attribute_hidden, remove weak_extern.
	(__libc_start_main): Set __cache_line_size
	unconditionally.
	* sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
	(__cache_line_size): Define the variable here.  Add
	attribute_hidden, remove weak_extern.
	(DL_PLATFORM_AUXV): Set __cache_line_size
	unconditionally.
	* sysdeps/powerpc/powerpc32/dl-machine.c (__cache_line_size): Remove
	weak_extern, add attribute_hidden.
	(__elf_machine_runtime_setup): Assume __cache_line_size is always
	defined in ld.so.
	* sysdeps/powerpc/powerpc32/memset.S (__cache_line_size): Remove
	definition.
	* sysdeps/powerpc/powerpc64/memset.S (__cache_line_size): Likewise.

--- libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c.jj	2005-12-30 08:30:11.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c	2007-03-20 11:56:13.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,8 +23,7 @@
 #include <bp-start.h>
 #include <bp-sym.h>
 
-extern int __cache_line_size;
-weak_extern (__cache_line_size)
+int __cache_line_size attribute_hidden;
 /* The main work is done in the generic function.  */
 #define LIBC_START_MAIN generic_start_main
 #define LIBC_START_DISABLE_INLINE
@@ -113,11 +113,7 @@ int
     switch (av->a_type)
       {
       case AT_DCACHEBSIZE:
-	{
-	  int *cls = &__cache_line_size;
-	  if (cls != NULL)
-	    *cls = av->a_un.a_val;
-	}
+	__cache_line_size = av->a_un.a_val;
 	break;
       }
 #ifdef SHARED
--- libc/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c.jj	2006-01-11 16:55:32.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c	2007-03-20 11:57:19.000000000 +0100
@@ -1,5 +1,6 @@
 /* Operating system support for run-time dynamic linker.  Linux/PPC version.
-   Copyright (C) 1997, 1998, 2001, 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2001, 2003, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,8 +22,7 @@
 #include <kernel-features.h>
 #include <ldsodefs.h>
 
-extern int __cache_line_size;
-weak_extern (__cache_line_size)
+int __cache_line_size attribute_hidden;
 
 /* Scan the Aux Vector for the "Data Cache Block Size" entry.  If found
    verify that the static extern __cache_line_size is defined by checking
@@ -30,12 +30,8 @@ weak_extern (__cache_line_size)
    value to __cache_line_size.  */
 #define DL_PLATFORM_AUXV						      \
       case AT_DCACHEBSIZE:						      \
-	{								      \
-	  int *cls = & __cache_line_size;				      \
-	  if (cls != NULL)						      \
-	    *cls = av->a_un.a_val;					      \
-	}								      \
-      break;
+	__cache_line_size = av->a_un.a_val;				      \
+	break;
 
 #ifndef __ASSUME_STD_AUXV
 
--- libc/sysdeps/powerpc/powerpc64/memset.S.jj	2005-06-06 14:36:11.000000000 +0200
+++ libc/sysdeps/powerpc/powerpc64/memset.S	2007-03-20 11:59:30.000000000 +0100
@@ -1,5 +1,6 @@
 /* Optimized memset implementation for PowerPC64.
-   Copyright (C) 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2002, 2003, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,12 +22,6 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-/* Define a global static that can hold the cache line size.  The
-   assumption is that startup code will access the "aux vector" to
-   to obtain the value set by the kernel and store it into this
-   variable.  */
-	.globl __cache_line_size
-	.lcomm __cache_line_size,4,4
 	.section	".toc","aw"
 .LC0:
 	.tc __cache_line_size[TC],__cache_line_size
--- libc/sysdeps/powerpc/powerpc32/memset.S.jj	2005-06-22 18:34:22.000000000 +0200
+++ libc/sysdeps/powerpc/powerpc32/memset.S	2007-03-20 12:01:36.000000000 +0100
@@ -1,5 +1,5 @@
 /* Optimized memset implementation for PowerPC.
-   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,14 +21,6 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-/* Define a global static that can hold the cache line size.  The
-   assumption is that startup code will access the "aux vector" to
-   to obtain the value set by the kernel and store it into this
-   variable.  */
-
-	.globl __cache_line_size
-	.lcomm __cache_line_size,4,4
-
 /* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
    Returns 's'.
 
--- libc/sysdeps/powerpc/powerpc32/dl-machine.c.jj	2006-11-28 11:25:24.000000000 +0100
+++ libc/sysdeps/powerpc/powerpc32/dl-machine.c	2007-03-20 12:06:30.000000000 +0100
@@ -26,10 +26,9 @@
 #include <dl-machine.h>
 #include <stdio-common/_itoa.h>
 
-/* The value __cache_line_size is defined in memset.S and is initialised
+/* The value __cache_line_size is defined in dl-sysdep.c and is initialised
    by _dl_sysdep_start via DL_PLATFORM_INIT.  */
-extern int __cache_line_size;
-weak_extern (__cache_line_size)
+extern int __cache_line_size attribute_hidden;
 
 /* Because ld.so is now versioned, these functions can be in their own file;
    no relocations need to be done to call them.
@@ -318,15 +317,9 @@ __elf_machine_runtime_setup (struct link
       /* Default minimum 4 words per cache line.  */
       int line_size_words = 4;
 
-      /* Don't try this until ld.so has relocated itself!  */
-      int *line_size_ptr = &__cache_line_size;
-      if (lazy && line_size_ptr != NULL)
-	{
-	  /*  Verify that __cache_line_size is defined and set.  */
-	  if (*line_size_ptr != 0)
-	    /* Convert bytes to words.  */
-	    line_size_words = *line_size_ptr / 4;
-	}
+      if (lazy && __cache_line_size != 0)
+	/* Convert bytes to words.  */
+	line_size_words = __cache_line_size / 4;
 
       size_modified = lazy ? rel_offset_words : 6;
       for (i = 0; i < size_modified; i += line_size_words)


	Jakub

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

* Re: [PATCH] Fix up ppc __cache_line_size
  2007-03-20 12:36     ` [PATCH] Fix up ppc __cache_line_size Jakub Jelinek
@ 2007-03-20 14:59       ` Steven Munroe
  2007-03-22 22:01       ` Steven Munroe
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Munroe @ 2007-03-20 14:59 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Ulrich Drepper, Roland McGrath, Richard Henderson, libc-hacker

Jakub Jelinek wrote:
> On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote:
>   
>> Roland McGrath wrote:
>>     
>>>> +#ifdef DL_PLATFORM_AUXV
>>>> +      DL_PLATFORM_AUXV
>>>> +#endif
>>>>     
>>>>         
>>> This looks ok to me, but make it # ifdef there inside another #ifdef.
>>>
>>> This will also affect powerpc, which AFAICT was also failing to set its
>>> __cache_line_size in static programs.  It looks to me like that will be fine.
>>>
>>>   
>>>       
>> hmmm looks like powerpc needs a
>> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV
>> and include /elf/dl-support.c ?
>>     
>
> IMHO there is no reason to use weak_extern for __cache_line_size.
> Code to check the weak references and only conditionally set it is
> certainly bigger than just defining the hidden variables in libc-start.c
> and dl-sysdep.c.
> Additionally, if you build power4+ optimized ld.so, __cache_line_size
> isn't defined at all and thus dl-machine.c will never use it.
>
> The following patch works for me (though only tested with
> binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size
> references don't need runtime relocation).  Not sure if we still support
> older binutils.
>   

Looks good, I'll verify this against the powerpc-cpu add-on as soon as I
finish testing and submitt the MUTEX_HINTS patch I am working on ...

Thanks

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

* Re: [PATCH] Fix up ppc __cache_line_size
  2007-03-20 12:36     ` [PATCH] Fix up ppc __cache_line_size Jakub Jelinek
  2007-03-20 14:59       ` Steven Munroe
@ 2007-03-22 22:01       ` Steven Munroe
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Munroe @ 2007-03-22 22:01 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Ulrich Drepper, Roland McGrath, Richard Henderson, libc-hacker

Jakub Jelinek wrote:
> On Tue, Mar 13, 2007 at 03:56:41PM -0500, Steven Munroe wrote:
>   
>> Roland McGrath wrote:
>>     
>>>> +#ifdef DL_PLATFORM_AUXV
>>>> +      DL_PLATFORM_AUXV
>>>> +#endif
>>>>     
>>>>         
>>> This looks ok to me, but make it # ifdef there inside another #ifdef.
>>>
>>> This will also affect powerpc, which AFAICT was also failing to set its
>>> __cache_line_size in static programs.  It looks to me like that will be fine.
>>>
>>>   
>>>       
>> hmmm looks like powerpc needs a
>> sysdeps/unix/sysv/linux/powerpc/dl-support.c to define DL_PLATFORM_AUXV
>> and include /elf/dl-support.c ?
>>     
>
> IMHO there is no reason to use weak_extern for __cache_line_size.
> Code to check the weak references and only conditionally set it is
> certainly bigger than just defining the hidden variables in libc-start.c
> and dl-sysdep.c.
> Additionally, if you build power4+ optimized ld.so, __cache_line_size
> isn't defined at all and thus dl-machine.c will never use it.
>   

Yup, on power4/5/6 processors we know the cache_line_size is 128 and for
970 the L:inux kernel always sets 128 byte cache lines. So we took the
dynamic cache line size code out of the CPU tuned version.

Unfortunately this also remove the definition of __cache_line_size for
the CPU tuned stuff which we still need for dl-machine. So moving the
definition of __cache_line_size to dl-sysdep.c is the correct answer.
> The following patch works for me (though only tested with
> binutils and gcc that support HAVE_ASM_PPC_REL16 (so __cache_line_size
> references don't need runtime relocation).  Not sure if we still support
> older binutils.
>   
HAVE_ASM_PPC_REL16 is required for -msecure-plt and this binutils is a
prereq for -mlong-double-128 (GCC-4.1). So I suspect building with older
binutils is not really an option any more.

So this patch is Ok with me.

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

end of thread, other threads:[~2007-03-22 22:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-13 16:48 [rfa] fix alpha ld.so undef symbol Richard Henderson
2007-03-13 20:17 ` Roland McGrath
2007-03-13 20:41   ` Steven Munroe
2007-03-13 21:04     ` Roland McGrath
2007-03-20 12:36     ` [PATCH] Fix up ppc __cache_line_size Jakub Jelinek
2007-03-20 14:59       ` Steven Munroe
2007-03-22 22:01       ` Steven Munroe
2007-03-13 21:15   ` [rfa] fix alpha ld.so undef symbol Richard Henderson

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