aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Millan <rmh@gnu.org>2012-02-15 22:20:07 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-02-15 22:20:07 +0000
commit87ae60cc22347daab652864dd01c966f774f7729 (patch)
tree05d5dd88d39dc5ca83e87aeeb1700943fcb8605b
parent3fdf1316ac44fb22cc1ffca1bcc1c9e722504445 (diff)
downloadglibc-87ae60cc22347daab652864dd01c966f774f7729.tar
glibc-87ae60cc22347daab652864dd01c966f774f7729.tar.gz
glibc-87ae60cc22347daab652864dd01c966f774f7729.tar.bz2
glibc-87ae60cc22347daab652864dd01c966f774f7729.zip
Add dl-procinfo support for MIPS.
-rw-r--r--ChangeLog.mips7
-rw-r--r--sysdeps/mips/dl-machine.h15
-rw-r--r--sysdeps/mips/dl-procinfo.c64
-rw-r--r--sysdeps/mips/dl-procinfo.h68
4 files changed, 152 insertions, 2 deletions
diff --git a/ChangeLog.mips b/ChangeLog.mips
index 0453f36ed5..da5b93e84f 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,10 @@
+2012-02-15 Robert Millan <rmh@gnu.org>
+
+ * sysdeps/mips/dl-machine.h (DL_PLATFORM_INIT, dl_platform_init):
+ Define.
+ * sysdeps/mips/dl-procinfo.c: New file.
+ * sysdeps/mips/dl-procinfo.h: Likewise.
+
2012-02-15 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/bits/signalfd.h: New file.
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 3e1d402cf2..38470d1d0a 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -1,6 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS version.
- Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
@@ -296,6 +295,18 @@ do { \
# define ARCH_LA_PLTEXIT mips_n64_gnu_pltexit
# endif
+/* We define an initialization function. This is called very early in
+ _dl_sysdep_start. */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+ if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
+ /* Avoid an empty string which would disturb us. */
+ GLRO(dl_platform) = NULL;
+}
+
/* For a non-writable PLT, rewrite the .got.plt entry at RELOC_ADDR to
point at the symbol with address VALUE. For a writable PLT, rewrite
the corresponding PLT entry instead. */
diff --git a/sysdeps/mips/dl-procinfo.c b/sysdeps/mips/dl-procinfo.c
new file mode 100644
index 0000000000..3e8a4fb591
--- /dev/null
+++ b/sysdeps/mips/dl-procinfo.c
@@ -0,0 +1,64 @@
+/* Data for Mips version of processor capability information.
+ Copyright (C) 2007-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Robert Millan <rmh@gnu.org>.
+
+ 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. */
+
+/* This information must be kept in sync with the _DL_PLATFORM_COUNT
+ definitions in procinfo.h.
+
+ If anything should be added here check whether the size of each string
+ is still ok with the given array size.
+
+ All the #ifdefs in the definitions are quite irritating but
+ necessary if we want to avoid duplicating the information. There
+ are three different modes:
+
+ - PROCINFO_DECL is defined. This means we are only interested in
+ declarations.
+
+ - PROCINFO_DECL is not defined:
+
+ + if SHARED is defined the file is included in an array
+ initializer. The .element = { ... } syntax is needed.
+
+ + if SHARED is not defined a normal array initialization is
+ needed.
+ */
+
+#ifndef PROCINFO_CLASS
+#define PROCINFO_CLASS
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_mips_platforms
+#else
+PROCINFO_CLASS const char _dl_mips_platforms[4][11]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "loongson2e", "loongson2f", "octeon", "octeon2"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
new file mode 100644
index 0000000000..35f7fb759b
--- /dev/null
+++ b/sysdeps/mips/dl-procinfo.h
@@ -0,0 +1,68 @@
+/* Mips version of processor capability information handling macros.
+ Copyright (C) 2007-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Robert Millan <rmh@gnu.org>.
+
+ 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. */
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H 1
+
+#include <ldsodefs.h>
+
+
+/* Mask to filter out platforms. */
+#define _DL_HWCAP_PLATFORM (-1ULL)
+
+#define _DL_PLATFORMS_COUNT 1
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+ return GLRO(dl_mips_platforms)[idx];
+};
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+ int i;
+
+ if (str != NULL)
+ for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
+ {
+ if (strcmp (str, _dl_platform_string (i)) == 0)
+ return i;
+ }
+ return -1;
+};
+
+/* We cannot provide a general printing function. */
+#define _dl_procinfo(word) -1
+
+/* There are no hardware capabilities defined. */
+#define _dl_hwcap_string(idx) ""
+
+/* By default there is no important hardware capability. */
+#define HWCAP_IMPORTANT (0)
+
+/* We don't have any hardware capabilities. */
+#define _DL_HWCAP_COUNT 0
+
+#define _dl_string_hwcap(str) (-1)
+
+#endif /* dl-procinfo.h */