[PATCH 24/27] Add support for AT_ARM64_MIDR.

From: Yury Norov
Date: Tue Jun 21 2016 - 01:49:35 EST


From: Andrew Pinski <apinski@xxxxxxxxxx>

Signed-off-by: Yury Norov <ynorov@xxxxxxxxxxxxxxxxxx>
---
elf/dl-sysdep.c | 1 +
elf/elf.h | 3 +++
sysdeps/unix/sysv/linux/aarch64/dl-auxv.h | 25 +++++++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c | 5 +++++
4 files changed, 34 insertions(+)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c

diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index eaa7155..88b7dd7 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -307,6 +307,7 @@ _dl_show_auxv (void)
[AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex },
[AT_RANDOM - 2] = { "RANDOM: 0x", hex },
[AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex },
+ [AT_ARM64_MIDR - 2] = { "MIDR: 0x", hex },
};
unsigned int idx = (unsigned int) (av->a_type - 2);

diff --git a/elf/elf.h b/elf/elf.h
index 15f5a75..c05bc23 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1058,6 +1058,9 @@ typedef struct
#define AT_L2_CACHESHAPE 36
#define AT_L3_CACHESHAPE 37

+/* AARCH64 MIDR system register. */
+#define AT_ARM64_MIDR 38
+
/* Note section contents. Each entry in the note section begins with
a header of a fixed form. */

diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
new file mode 100644
index 0000000..290753d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
@@ -0,0 +1,25 @@
+/* Auxiliary vector processing for Linux/AARCH64.
+ Copyright (C) 2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+
+extern int __libc_arm64_midr;
+
+#define DL_PLATFORM_AUXV \
+ case AT_ARM64_MIDR: \
+ __libc_arm64_midr = av->a_un.a_val; \
+ break;
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
new file mode 100644
index 0000000..ca3ec28
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
@@ -0,0 +1,5 @@
+#include "dl-auxv.h"
+
+int __libc_arm64_midr = -1;
+
+#include <sysdeps/unix/sysv/linux/dl-sysdep.c>
--
2.7.4