patches/glibc/ports-2.10.1/480-alpha-add-dl-procinfo-support.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
yann@1625
     1
 ports/sysdeps/alpha/dl-machine.h  |   12 ++++++
yann@1625
     2
 ports/sysdeps/alpha/dl-procinfo.c |   64 +++++++++++++++++++++++++++++++++++
yann@1625
     3
 ports/sysdeps/alpha/dl-procinfo.h |   68 ++++++++++++++++++++++++++++++++++++++
yann@1625
     4
 3 files changed, 144 insertions(+)
yann@1625
     5
yann@1625
     6
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h
yann@1625
     7
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h	2009-05-16 10:36:20.000000000 +0200
yann@1625
     8
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h	2009-11-13 00:51:02.000000000 +0100
yann@1625
     9
@@ -249,6 +249,18 @@
yann@1625
    10
 /* The alpha never uses Elf64_Rel relocations.  */
yann@1625
    11
 #define ELF_MACHINE_NO_REL 1
yann@1625
    12
 
yann@1625
    13
+/* We define an initialization functions.  This is called very early in
yann@1625
    14
+ *    _dl_sysdep_start.  */
yann@1625
    15
+#define DL_PLATFORM_INIT dl_platform_init ()
yann@1625
    16
+
yann@1625
    17
+static inline void __attribute__ ((unused))
yann@1625
    18
+dl_platform_init (void)
yann@1625
    19
+{
yann@1625
    20
+	if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
yann@1625
    21
+	/* Avoid an empty string which would disturb us.  */
yann@1625
    22
+		GLRO(dl_platform) = NULL;
yann@1625
    23
+}
yann@1625
    24
+	
yann@1625
    25
 /* Fix up the instructions of a PLT entry to invoke the function
yann@1625
    26
    rather than the dynamic linker.  */
yann@1625
    27
 static inline Elf64_Addr
yann@1625
    28
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c
yann@1625
    29
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c	1970-01-01 01:00:00.000000000 +0100
yann@1625
    30
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c	2009-11-13 00:51:02.000000000 +0100
yann@1625
    31
@@ -0,0 +1,64 @@
yann@1625
    32
+/* Data for Alpha version of processor capability information.
yann@1625
    33
+   Copyright (C) 2007 Free Software Foundation, Inc.
yann@1625
    34
+   This file is part of the GNU C Library.
yann@1625
    35
+   Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
yann@1625
    36
+
yann@1625
    37
+   The GNU C Library is free software; you can redistribute it and/or
yann@1625
    38
+   modify it under the terms of the GNU Lesser General Public
yann@1625
    39
+   License as published by the Free Software Foundation; either
yann@1625
    40
+   version 2.1 of the License, or (at your option) any later version.
yann@1625
    41
+
yann@1625
    42
+   The GNU C Library is distributed in the hope that it will be useful,
yann@1625
    43
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
yann@1625
    44
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
yann@1625
    45
+   Lesser General Public License for more details.
yann@1625
    46
+
yann@1625
    47
+   You should have received a copy of the GNU Lesser General Public
yann@1625
    48
+   License along with the GNU C Library; if not, write to the Free
yann@1625
    49
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1625
    50
+   02111-1307 USA.  */
yann@1625
    51
+
yann@1625
    52
+/* This information must be kept in sync with the _DL_PLATFORM_COUNT 
yann@1625
    53
+   definitions in procinfo.h.
yann@1625
    54
+
yann@1625
    55
+   If anything should be added here check whether the size of each string
yann@1625
    56
+   is still ok with the given array size.
yann@1625
    57
+
yann@1625
    58
+   All the #ifdefs in the definitions are quite irritating but
yann@1625
    59
+   necessary if we want to avoid duplicating the information.  There
yann@1625
    60
+   are three different modes:
yann@1625
    61
+
yann@1625
    62
+   - PROCINFO_DECL is defined.  This means we are only interested in
yann@1625
    63
+     declarations.
yann@1625
    64
+
yann@1625
    65
+   - PROCINFO_DECL is not defined:
yann@1625
    66
+
yann@1625
    67
+     + if SHARED is defined the file is included in an array
yann@1625
    68
+       initializer.  The .element = { ... } syntax is needed.
yann@1625
    69
+
yann@1625
    70
+     + if SHARED is not defined a normal array initialization is
yann@1625
    71
+       needed.
yann@1625
    72
+  */
yann@1625
    73
+
yann@1625
    74
+#ifndef PROCINFO_CLASS
yann@1625
    75
+#define PROCINFO_CLASS
yann@1625
    76
+#endif
yann@1625
    77
+
yann@1625
    78
+#if !defined PROCINFO_DECL && defined SHARED
yann@1625
    79
+  ._dl_alpha_platforms
yann@1625
    80
+#else
yann@1625
    81
+PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
yann@1625
    82
+#endif
yann@1625
    83
+#ifndef PROCINFO_DECL
yann@1625
    84
+= {
yann@1625
    85
+    "ev4", "ev5", "ev56", "ev6", "ev67"
yann@1625
    86
+  }
yann@1625
    87
+#endif
yann@1625
    88
+#if !defined SHARED || defined PROCINFO_DECL
yann@1625
    89
+;
yann@1625
    90
+#else
yann@1625
    91
+,
yann@1625
    92
+#endif
yann@1625
    93
+
yann@1625
    94
+#undef PROCINFO_DECL
yann@1625
    95
+#undef PROCINFO_CLASS
yann@1625
    96
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h
yann@1625
    97
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h	1970-01-01 01:00:00.000000000 +0100
yann@1625
    98
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h	2009-11-13 00:51:02.000000000 +0100
yann@1625
    99
@@ -0,0 +1,68 @@
yann@1625
   100
+/* Alpha version of processor capability information handling macros.
yann@1625
   101
+   Copyright (C) 2007 Free Software Foundation, Inc.
yann@1625
   102
+   This file is part of the GNU C Library.
yann@1625
   103
+   Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
yann@1625
   104
+
yann@1625
   105
+   The GNU C Library is free software; you can redistribute it and/or
yann@1625
   106
+   modify it under the terms of the GNU Lesser General Public
yann@1625
   107
+   License as published by the Free Software Foundation; either
yann@1625
   108
+   version 2.1 of the License, or (at your option) any later version.
yann@1625
   109
+
yann@1625
   110
+   The GNU C Library is distributed in the hope that it will be useful,
yann@1625
   111
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
yann@1625
   112
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
yann@1625
   113
+   Lesser General Public License for more details.
yann@1625
   114
+
yann@1625
   115
+   You should have received a copy of the GNU Lesser General Public
yann@1625
   116
+   License along with the GNU C Library; if not, write to the Free
yann@1625
   117
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1625
   118
+   02111-1307 USA.  */
yann@1625
   119
+
yann@1625
   120
+#ifndef _DL_PROCINFO_H
yann@1625
   121
+#define _DL_PROCINFO_H	1
yann@1625
   122
+
yann@1625
   123
+#include <ldsodefs.h>
yann@1625
   124
+
yann@1625
   125
+
yann@1625
   126
+/* Mask to filter out platforms.  */
yann@1625
   127
+#define _DL_HWCAP_PLATFORM    (-1ULL)
yann@1625
   128
+
yann@1625
   129
+#define _DL_PLATFORMS_COUNT   5
yann@1625
   130
+
yann@1625
   131
+static inline const char *
yann@1625
   132
+__attribute__ ((unused))
yann@1625
   133
+_dl_platform_string (int idx)
yann@1625
   134
+{
yann@1625
   135
+  return GLRO(dl_alpha_platforms)[idx];
yann@1625
   136
+};
yann@1625
   137
+
yann@1625
   138
+static inline int
yann@1625
   139
+__attribute__ ((unused, always_inline))
yann@1625
   140
+_dl_string_platform (const char *str)
yann@1625
   141
+{
yann@1625
   142
+  int i;
yann@1625
   143
+
yann@1625
   144
+  if (str != NULL)
yann@1625
   145
+    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
yann@1625
   146
+      {
yann@1625
   147
+        if (strcmp (str, _dl_platform_string (i)) == 0)
yann@1625
   148
+          return i;
yann@1625
   149
+      }
yann@1625
   150
+  return -1;
yann@1625
   151
+};
yann@1625
   152
+
yann@1625
   153
+/* We cannot provide a general printing function.  */
yann@1625
   154
+#define _dl_procinfo(word) -1
yann@1625
   155
+
yann@1625
   156
+/* There are no hardware capabilities defined.  */
yann@1625
   157
+#define _dl_hwcap_string(idx) ""
yann@1625
   158
+
yann@1625
   159
+/* By default there is no important hardware capability.  */
yann@1625
   160
+#define HWCAP_IMPORTANT (0)
yann@1625
   161
+
yann@1625
   162
+/* We don't have any hardware capabilities.  */
yann@1625
   163
+#define _DL_HWCAP_COUNT	0
yann@1625
   164
+
yann@1625
   165
+#define _dl_string_hwcap(str) (-1)
yann@1625
   166
+
yann@1625
   167
+#endif /* dl-procinfo.h */
yann@1625
   168
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-machine.h glibc-2.10.1/ports/sysdeps/alpha/dl-machine.h
yann@1625
   169
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.c
yann@1625
   170
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.h