* [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC
@ 2006-09-14 15:23 Jakub Jelinek
2006-09-14 16:22 ` Steven Munroe
2006-09-14 18:03 ` Ulrich Drepper
0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2006-09-14 15:23 UTC (permalink / raw)
To: Ulrich Drepper, Steven Munroe; +Cc: Glibc hackers
Hi!
For LD_LIBRARY_PATH, ld.so uses AT_PLATFORM whenever it is set by the
kernel, even if it is not listed in dl-procinfo.[ch] (that only matters
for ldconfig). So, currently e.g. on G5 we look a huge number of dirs:
14931: trying file=/lib/tls/ppc970/altivec/power4/libc.so.6
14931: trying file=/lib/tls/ppc970/altivec/libc.so.6
14931: trying file=/lib/tls/ppc970/power4/libc.so.6
14931: trying file=/lib/tls/ppc970/libc.so.6
14931: trying file=/lib/tls/altivec/power4/libc.so.6
14931: trying file=/lib/tls/altivec/libc.so.6
14931: trying file=/lib/tls/power4/libc.so.6
14931: trying file=/lib/tls/libc.so.6
14931: trying file=/lib/ppc970/altivec/power4/libc.so.6
14931: trying file=/lib/ppc970/altivec/libc.so.6
14931: trying file=/lib/ppc970/power4/libc.so.6
14931: trying file=/lib/ppc970/libc.so.6
14931: trying file=/lib/altivec/power4/libc.so.6
14931: trying file=/lib/altivec/libc.so.6
14931: trying file=/lib/power4/libc.so.6
14931: trying file=/lib/libc.so.6
The following patch limits important hwcaps to just altivec (as it is
present on multiple different platforms, ppc970 (aka G5), ppc74{0,5}0,
ppc-cell-be (and arch_2_05?)) and adds booke which is also set on 4
different platforms. The power4/power5/power5+ bits seem to be completely
redundant with the platform name.
I haven't included all platforms in dl-procinfo*, as I don't think we need
to list there prehistoric CPUs (for which non-optimized libs are good enough
anyway) and embedded stuff (as for embedded use you rarely want to choose
different libcs based on which chip you are on, you pretty much know
which chip it is), listing there all 24 platforms kernel now lists would
be a waste, especially for the scarce bit space in ldconfig's mask (we have
at most 31 bits there for platform and any other future uses, so if we now
take 6 bits out of this for the common contemporary CPUs, we still have
a big reserve for the future).
2006-09-14 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add "booke"
to the beginning.
(_dl_powerpc_platforms): New.
* sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
(HWCAP_IMPORTANT): Remove power{4,5,5+} and cell, add booke.
(_DL_PLATFORMS_COUNT, _DL_FIRST_PLATFORM): Define.
(_DL_HWCAP_PLATFORM): Define to new mask.
(_dl_platform_string, _dl_string_platform): New functions.
* sysdeps/powerpc/sysdep.h (PPC_FEATURE_BOOKE): Define.
--- libc/sysdeps/powerpc/dl-procinfo.c.jj 2006-09-14 13:55:06.000000000 +0200
+++ libc/sysdeps/powerpc/dl-procinfo.c 2006-09-14 16:41:23.000000000 +0200
@@ -1,5 +1,5 @@
/* Data for processor capability information. PowerPC version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 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
@@ -46,10 +46,11 @@
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_cap_flags
#else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[16][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[17][10]
#endif
#ifndef PROCINFO_DECL
= {
+ "booke",
"cell", "power5+", "power5", "power4",
"notb", "efpdouble", "efpsingle", "spe",
"ucache", "4xxmac", "mmu", "fpu",
@@ -62,5 +63,21 @@ PROCINFO_CLASS const char _dl_powerpc_ca
,
#endif
+#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_powerpc_platforms
+#else
+PROCINFO_CLASS const char _dl_powerpc_platforms[6][12]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
--- libc/sysdeps/powerpc/dl-procinfo.h.jj 2006-09-14 13:55:06.000000000 +0200
+++ libc/sysdeps/powerpc/dl-procinfo.h 2006-09-14 16:12:47.000000000 +0200
@@ -1,5 +1,5 @@
/* Processor capability information handling macros. PowerPC version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 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
@@ -23,27 +23,34 @@
#include <ldsodefs.h>
#include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */
-/* There are 16 bits used, but they are bits 16..31. */
-#define _DL_HWCAP_FIRST 16
+/* There are 17 bits used, but they are bits 15..31. */
+#define _DL_HWCAP_FIRST 15
#define _DL_HWCAP_COUNT 32
/* These bits influence library search. */
-#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
- | PPC_FEATURE_POWER4 \
- | PPC_FEATURE_POWER5 \
- | PPC_FEATURE_POWER5_PLUS \
- | PPC_FEATURE_CELL)
-
-/* We don't use AT_PLATFORM. */
-#define _DL_HWCAP_PLATFORM 0
-#define _dl_string_platform(str) (-1)
+#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
+ | PPC_FEATURE_BOOKE)
+
+#define _DL_PLATFORMS_COUNT 6
+
+#define _DL_FIRST_PLATFORM 32
+/* Mask to filter out platforms. */
+#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
+ << _DL_FIRST_PLATFORM)
static inline const char *
__attribute__ ((unused))
_dl_hwcap_string (int idx)
{
return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
-};
+}
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+ return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
+}
static inline int
__attribute__ ((unused))
@@ -53,7 +60,48 @@ _dl_string_hwcap (const char *str)
if (strcmp (str, _dl_hwcap_string (i)) == 0)
return i;
return -1;
-};
+}
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+ if (str == NULL)
+ return -1;
+
+ if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
+ {
+ int ret;
+ str += 5;
+ switch (*str)
+ {
+ case '4':
+ ret = _DL_FIRST_PLATFORM + 0;
+ break;
+ case '5':
+ ret = _DL_FIRST_PLATFORM + 2;
+ if (str[1] == '+')
+ ++ret, ++str;
+ break;
+ case '6':
+ ret = _DL_FIRST_PLATFORM + 4;
+ break;
+ default:
+ return -1;
+ }
+ if (str[1] == '\0')
+ return ret;
+ }
+ else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
+ {
+ if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
+ return _DL_FIRST_PLATFORM + 1;
+ else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
+ return _DL_FIRST_PLATFORM + 5;
+ }
+
+ return -1;
+}
#ifdef IS_IN_rtld
static inline int
--- libc/sysdeps/powerpc/sysdep.h.jj 2005-11-21 12:07:50.000000000 +0100
+++ libc/sysdeps/powerpc/sysdep.h 2006-09-14 16:11:34.000000000 +0200
@@ -37,6 +37,7 @@
#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 microarch level */
#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ microarch level */
#define PPC_FEATURE_CELL 0x00010000 /* CELL PU microarch level */
+#define PPC_FEATURE_BOOKE 0x00008000
#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
#ifdef __ASSEMBLER__
Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC
2006-09-14 15:23 [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC Jakub Jelinek
@ 2006-09-14 16:22 ` Steven Munroe
2006-09-14 18:03 ` Ulrich Drepper
1 sibling, 0 replies; 5+ messages in thread
From: Steven Munroe @ 2006-09-14 16:22 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
Jakub Jelinek wrote:
>Hi!
>
>For LD_LIBRARY_PATH, ld.so uses AT_PLATFORM whenever it is set by the
>kernel, even if it is not listed in dl-procinfo.[ch] (that only matters
>for ldconfig). So, currently e.g. on G5 we look a huge number of dirs:
>...
>The following patch limits important hwcaps to just altivec (as it is
>present on multiple different platforms, ppc970 (aka G5), ppc74{0,5}0,
>ppc-cell-be (and arch_2_05?)) and adds booke which is also set on 4
>different platforms. The power4/power5/power5+ bits seem to be completely
>redundant with the platform name.
>
Correct the these bits should be removed from important mask in favor of
AT_PLATFORM. These bits do designate ISA levels and as such are still
(potentially) useful for runtime test to use specific instructions.
>I haven't included all platforms in dl-procinfo*, as I don't think we need
>to list there prehistoric CPUs (for which non-optimized libs are good enough
>anyway) and embedded stuff (as for embedded use you rarely want to choose
>different libcs based on which chip you are on, you pretty much know
>which chip it is), listing there all 24 platforms kernel now lists would
>be a waste, especially for the scarce bit space in ldconfig's mask (we have
>at most 31 bits there for platform and any other future uses, so if we now
>take 6 bits out of this for the common contemporary CPUs, we still have
>a big reserve for the future).
>
>
This is similar to a patch I submited in January but seems to have been
ignored. So this patch is ok with only one quible, I was told that I
should not use "cell" as the Official name is "Cell Broadband Engine".
So the HWCAP name should be "cellbe".
>2006-09-14 Jakub Jelinek <jakub@redhat.com>
>
> * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add "booke"
> to the beginning.
> (_dl_powerpc_platforms): New.
> * sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
> (HWCAP_IMPORTANT): Remove power{4,5,5+} and cell, add booke.
> (_DL_PLATFORMS_COUNT, _DL_FIRST_PLATFORM): Define.
> (_DL_HWCAP_PLATFORM): Define to new mask.
> (_dl_platform_string, _dl_string_platform): New functions.
> * sysdeps/powerpc/sysdep.h (PPC_FEATURE_BOOKE): Define.
>
>--- libc/sysdeps/powerpc/dl-procinfo.c.jj 2006-09-14 13:55:06.000000000 +0200
>+++ libc/sysdeps/powerpc/dl-procinfo.c 2006-09-14 16:41:23.000000000 +0200
>@@ -1,5 +1,5 @@
> /* Data for processor capability information. PowerPC version.
>- Copyright (C) 2005 Free Software Foundation, Inc.
>+ Copyright (C) 2005, 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
>@@ -46,10 +46,11 @@
> #if !defined PROCINFO_DECL && defined SHARED
> ._dl_powerpc_cap_flags
> #else
>-PROCINFO_CLASS const char _dl_powerpc_cap_flags[16][10]
>+PROCINFO_CLASS const char _dl_powerpc_cap_flags[17][10]
> #endif
> #ifndef PROCINFO_DECL
> = {
>+ "booke",
> "cell", "power5+", "power5", "power4",
> "notb", "efpdouble", "efpsingle", "spe",
> "ucache", "4xxmac", "mmu", "fpu",
>@@ -62,5 +63,21 @@ PROCINFO_CLASS const char _dl_powerpc_ca
> ,
> #endif
>
>+#if !defined PROCINFO_DECL && defined SHARED
>+ ._dl_powerpc_platforms
>+#else
>+PROCINFO_CLASS const char _dl_powerpc_platforms[6][12]
>+#endif
>+#ifndef PROCINFO_DECL
>+= {
>+ "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be"
>+ }
>+#endif
>+#if !defined SHARED || defined PROCINFO_DECL
>+;
>+#else
>+,
>+#endif
>+
> #undef PROCINFO_DECL
> #undef PROCINFO_CLASS
>--- libc/sysdeps/powerpc/dl-procinfo.h.jj 2006-09-14 13:55:06.000000000 +0200
>+++ libc/sysdeps/powerpc/dl-procinfo.h 2006-09-14 16:12:47.000000000 +0200
>@@ -1,5 +1,5 @@
> /* Processor capability information handling macros. PowerPC version.
>- Copyright (C) 2005 Free Software Foundation, Inc.
>+ Copyright (C) 2005, 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
>@@ -23,27 +23,34 @@
> #include <ldsodefs.h>
> #include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */
>
>-/* There are 16 bits used, but they are bits 16..31. */
>-#define _DL_HWCAP_FIRST 16
>+/* There are 17 bits used, but they are bits 15..31. */
>+#define _DL_HWCAP_FIRST 15
> #define _DL_HWCAP_COUNT 32
>
> /* These bits influence library search. */
>-#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
>- | PPC_FEATURE_POWER4 \
>- | PPC_FEATURE_POWER5 \
>- | PPC_FEATURE_POWER5_PLUS \
>- | PPC_FEATURE_CELL)
>-
>-/* We don't use AT_PLATFORM. */
>-#define _DL_HWCAP_PLATFORM 0
>-#define _dl_string_platform(str) (-1)
>+#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
>+ | PPC_FEATURE_BOOKE)
>+
>+#define _DL_PLATFORMS_COUNT 6
>+
>+#define _DL_FIRST_PLATFORM 32
>+/* Mask to filter out platforms. */
>+#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
>+ << _DL_FIRST_PLATFORM)
>
> static inline const char *
> __attribute__ ((unused))
> _dl_hwcap_string (int idx)
> {
> return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
>-};
>+}
>+
>+static inline const char *
>+__attribute__ ((unused))
>+_dl_platform_string (int idx)
>+{
>+ return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
>+}
>
> static inline int
> __attribute__ ((unused))
>@@ -53,7 +60,48 @@ _dl_string_hwcap (const char *str)
> if (strcmp (str, _dl_hwcap_string (i)) == 0)
> return i;
> return -1;
>-};
>+}
>+
>+static inline int
>+__attribute__ ((unused, always_inline))
>+_dl_string_platform (const char *str)
>+{
>+ if (str == NULL)
>+ return -1;
>+
>+ if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
>+ {
>+ int ret;
>+ str += 5;
>+ switch (*str)
>+ {
>+ case '4':
>+ ret = _DL_FIRST_PLATFORM + 0;
>+ break;
>+ case '5':
>+ ret = _DL_FIRST_PLATFORM + 2;
>+ if (str[1] == '+')
>+ ++ret, ++str;
>+ break;
>+ case '6':
>+ ret = _DL_FIRST_PLATFORM + 4;
>+ break;
>+ default:
>+ return -1;
>+ }
>+ if (str[1] == '\0')
>+ return ret;
>+ }
>+ else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
>+ {
>+ if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
>+ return _DL_FIRST_PLATFORM + 1;
>+ else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
>+ return _DL_FIRST_PLATFORM + 5;
>+ }
>+
>+ return -1;
>+}
>
> #ifdef IS_IN_rtld
> static inline int
>--- libc/sysdeps/powerpc/sysdep.h.jj 2005-11-21 12:07:50.000000000 +0100
>+++ libc/sysdeps/powerpc/sysdep.h 2006-09-14 16:11:34.000000000 +0200
>@@ -37,6 +37,7 @@
> #define PPC_FEATURE_POWER5 0x00040000 /* POWER5 microarch level */
> #define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ microarch level */
> #define PPC_FEATURE_CELL 0x00010000 /* CELL PU microarch level */
>+#define PPC_FEATURE_BOOKE 0x00008000
> #define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
>
> #ifdef __ASSEMBLER__
>
> Jakub
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC
2006-09-14 18:03 ` Ulrich Drepper
@ 2006-09-14 17:28 ` Steven Munroe
2006-09-14 18:14 ` Jakub Jelinek
1 sibling, 0 replies; 5+ messages in thread
From: Steven Munroe @ 2006-09-14 17:28 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Jakub Jelinek, Ulrich Drepper, Glibc hackers
Ulrich Drepper wrote:
> On 9/14/06, Jakub Jelinek <jakub@redhat.com> wrote:
>> +#define HWCAP_IMPORTANT
>> (PPC_FEATURE_HAS_ALTIVEC \
>> + | PPC_FEATURE_BOOKE)
>
> booke is not important for reasonable machines. The embedded garbage
> can define their own macros in a file in ports.
>
> I'm going to apply the change without the bit in about 14 hours (when
> I get back online) unless I read a rejection. Mind you, rejection of
> the move to AT_PLATFORM, not the booke stuff.
Ok with me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC
2006-09-14 15:23 [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC Jakub Jelinek
2006-09-14 16:22 ` Steven Munroe
@ 2006-09-14 18:03 ` Ulrich Drepper
2006-09-14 17:28 ` Steven Munroe
2006-09-14 18:14 ` Jakub Jelinek
1 sibling, 2 replies; 5+ messages in thread
From: Ulrich Drepper @ 2006-09-14 18:03 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Steven Munroe, Glibc hackers
On 9/14/06, Jakub Jelinek <jakub@redhat.com> wrote:
> +#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
> + | PPC_FEATURE_BOOKE)
booke is not important for reasonable machines. The embedded garbage
can define their own macros in a file in ports.
I'm going to apply the change without the bit in about 14 hours (when
I get back online) unless I read a rejection. Mind you, rejection of
the move to AT_PLATFORM, not the booke stuff.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC
2006-09-14 18:03 ` Ulrich Drepper
2006-09-14 17:28 ` Steven Munroe
@ 2006-09-14 18:14 ` Jakub Jelinek
1 sibling, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2006-09-14 18:14 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Ulrich Drepper, Steven Munroe, Glibc hackers
On Thu, Sep 14, 2006 at 10:12:48AM -0700, Ulrich Drepper wrote:
> On 9/14/06, Jakub Jelinek <jakub@redhat.com> wrote:
> >+#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
> >+ | PPC_FEATURE_BOOKE)
>
> booke is not important for reasonable machines. The embedded garbage
> can define their own macros in a file in ports.
>
> I'm going to apply the change without the bit in about 14 hours (when
> I get back online) unless I read a rejection. Mind you, rejection of
> the move to AT_PLATFORM, not the booke stuff.
Here is an updated patch that doesn't list BOOKE in HWCAP_IMPORTANT,
on the other side adds another 3 bits to recognized hwcaps (for
LD_SHOW_AUXV=1) and adds some stuff from Steven's
http://sources.redhat.com/ml/libc-alpha/2006-01/msg00096.html
patch.
2006-09-14 Jakub Jelinek <jakub@redhat.com>
Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add 4 new cap
names to the beginning. Rename "cell" to "cellbe".
(_dl_powerpc_platforms): New.
* sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
(HWCAP_IMPORTANT): Remove power{4,5,5+} and cell.
(_DL_PLATFORMS_COUNT, _DL_FIRST_PLATFORM): Define.
(_DL_HWCAP_PLATFORM): Define to new mask.
(_dl_platform_string, _dl_string_platform): New functions.
* sysdeps/powerpc/sysdep.h (PPC_FEATURE_BOOKE, PPC_FEATURE_SMT,
PPC_FEATURE_ICACHE_SNOOP, PPC_FEATURE_ARCH_2_05): Define.
--- libc/sysdeps/powerpc/dl-procinfo.c.jj 2006-09-14 13:55:06.000000000 +0200
+++ libc/sysdeps/powerpc/dl-procinfo.c 2006-09-14 19:57:49.000000000 +0200
@@ -1,5 +1,5 @@
/* Data for processor capability information. PowerPC version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 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
@@ -46,11 +46,12 @@
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_cap_flags
#else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[16][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[20][10]
#endif
#ifndef PROCINFO_DECL
= {
- "cell", "power5+", "power5", "power4",
+ "arch_2_05", "ic_snoop", "smt", "booke",
+ "cellbe", "power5+", "power5", "power4",
"notb", "efpdouble", "efpsingle", "spe",
"ucache", "4xxmac", "mmu", "fpu",
"altivec", "ppc601", "ppc64", "ppc32",
@@ -62,5 +63,21 @@ PROCINFO_CLASS const char _dl_powerpc_ca
,
#endif
+#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_powerpc_platforms
+#else
+PROCINFO_CLASS const char _dl_powerpc_platforms[6][12]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
--- libc/sysdeps/powerpc/dl-procinfo.h.jj 2006-09-14 13:55:06.000000000 +0200
+++ libc/sysdeps/powerpc/dl-procinfo.h 2006-09-14 19:59:08.000000000 +0200
@@ -1,5 +1,5 @@
/* Processor capability information handling macros. PowerPC version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 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
@@ -23,27 +23,33 @@
#include <ldsodefs.h>
#include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */
-/* There are 16 bits used, but they are bits 16..31. */
-#define _DL_HWCAP_FIRST 16
+/* There are 20 bits used, but they are bits 12..31. */
+#define _DL_HWCAP_FIRST 12
#define _DL_HWCAP_COUNT 32
/* These bits influence library search. */
-#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
- | PPC_FEATURE_POWER4 \
- | PPC_FEATURE_POWER5 \
- | PPC_FEATURE_POWER5_PLUS \
- | PPC_FEATURE_CELL)
-
-/* We don't use AT_PLATFORM. */
-#define _DL_HWCAP_PLATFORM 0
-#define _dl_string_platform(str) (-1)
+#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC)
+
+#define _DL_PLATFORMS_COUNT 6
+
+#define _DL_FIRST_PLATFORM 32
+/* Mask to filter out platforms. */
+#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
+ << _DL_FIRST_PLATFORM)
static inline const char *
__attribute__ ((unused))
_dl_hwcap_string (int idx)
{
return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
-};
+}
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+ return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
+}
static inline int
__attribute__ ((unused))
@@ -53,7 +59,48 @@ _dl_string_hwcap (const char *str)
if (strcmp (str, _dl_hwcap_string (i)) == 0)
return i;
return -1;
-};
+}
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+ if (str == NULL)
+ return -1;
+
+ if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
+ {
+ int ret;
+ str += 5;
+ switch (*str)
+ {
+ case '4':
+ ret = _DL_FIRST_PLATFORM + 0;
+ break;
+ case '5':
+ ret = _DL_FIRST_PLATFORM + 2;
+ if (str[1] == '+')
+ ++ret, ++str;
+ break;
+ case '6':
+ ret = _DL_FIRST_PLATFORM + 4;
+ break;
+ default:
+ return -1;
+ }
+ if (str[1] == '\0')
+ return ret;
+ }
+ else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
+ {
+ if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
+ return _DL_FIRST_PLATFORM + 1;
+ else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
+ return _DL_FIRST_PLATFORM + 5;
+ }
+
+ return -1;
+}
#ifdef IS_IN_rtld
static inline int
--- libc/sysdeps/powerpc/sysdep.h.jj 2005-11-21 12:07:50.000000000 +0100
+++ libc/sysdeps/powerpc/sysdep.h 2006-09-14 19:58:48.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 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
@@ -29,14 +29,18 @@
#define PPC_FEATURE_HAS_MMU 0x04000000 /* Memory Management Unit. */
#define PPC_FEATURE_HAS_4xxMAC 0x02000000 /* 4xx Multiply Accumulator. */
#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 /* Unified I/D cache. */
-#define PPC_FEATURE_HAS_SPE 0x00800000
-#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
-#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
+#define PPC_FEATURE_HAS_SPE 0x00800000 /* Signal Processing ext. */
+#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 /* SPE Float. */
+#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 /* SPE Double. */
#define PPC_FEATURE_NO_TB 0x00100000 /* 601/403gx have no timebase */
-#define PPC_FEATURE_POWER4 0x00080000 /* POWER4 microarch level */
-#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 microarch level */
-#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ microarch level */
-#define PPC_FEATURE_CELL 0x00010000 /* CELL PU microarch level */
+#define PPC_FEATURE_POWER4 0x00080000 /* POWER4 ISA 2.00 */
+#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.01 */
+#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.02 */
+#define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */
+#define PPC_FEATURE_BOOKE 0x00008000
+#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
+#define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */
#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
#ifdef __ASSEMBLER__
Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-09-14 18:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-14 15:23 [PATCH] Use AT_PLATFORM and limit the number of important hwcap bits on PPC Jakub Jelinek
2006-09-14 16:22 ` Steven Munroe
2006-09-14 18:03 ` Ulrich Drepper
2006-09-14 17:28 ` Steven Munroe
2006-09-14 18:14 ` Jakub Jelinek
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).