summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch')
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch144
1 files changed, 144 insertions, 0 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch b/meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch
new file mode 100644
index 0000000000..9afa7f6a55
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-gcc10-arm64-build-needs-__getauxval-for-linking-with.patch
@@ -0,0 +1,144 @@
1From abbc0761fa0349d49b10dc8c0f10af6bc0578c40 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Tue, 12 May 2020 16:58:36 +0200
4Subject: [PATCH 1/2] gcc10 arm64 build needs __getauxval for linking with
5 libgcc
6
7Provide a new library libgcc-sup-<platform>.a that contains symbols
8needed by libgcc. This needs to be linked after -lgcc to provide
9any symbols missing which would normally be provided by glibc.
10At the moment this only provides __getauxval on arm64 linux.
11
12https://bugs.kde.org/show_bug.cgi?id=421321
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=abbc0761fa0349d49b10dc8c0f10af6bc0578c40]
16
17---
18 Makefile.tool.am | 3 +-
19 coregrind/Makefile.am | 26 +++++++++++++++++
20 coregrind/m_libgcc_sup.c | 61 ++++++++++++++++++++++++++++++++++++++++
21 3 files changed, 89 insertions(+), 1 deletion(-)
22 create mode 100644 coregrind/m_libgcc_sup.c
23
24diff --git a/Makefile.tool.am b/Makefile.tool.am
25index cc2fa0ee6..2bf90de5d 100644
26--- a/Makefile.tool.am
27+++ b/Makefile.tool.am
28@@ -17,7 +17,8 @@ TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@ = \
29 endif
30
31
32-TOOL_LDADD_COMMON = -lgcc
33+TOOL_LDADD_COMMON = -lgcc \
34+ $(top_builddir)/coregrind/libgcc-sup-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
35 TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \
36 $(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) $(TOOL_LDADD_COMMON)
37 if VGCONF_HAVE_PLATFORM_SEC
38diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
39index 6a1a925fb..1753fb633 100644
40--- a/coregrind/Makefile.am
41+++ b/coregrind/Makefile.am
42@@ -542,6 +542,32 @@ libcoregrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_DEPENDENCIES = \
43 libnolto_coregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
44 endif
45
46+#----------------------------------------------------------------------------
47+# libgcc-sup-<platform>.a
48+# Special supplemental library for functions normally supplied by glibc
49+# used by libgcc.
50+#----------------------------------------------------------------------------
51+
52+pkglib_LIBRARIES += libgcc-sup-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
53+if VGCONF_HAVE_PLATFORM_SEC
54+pkglib_LIBRARIES += libgcc-sup-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
55+endif
56+
57+libgcc_sup_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_SOURCES = \
58+ m_libgcc_sup.c
59+libgcc_sup_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CPPFLAGS = \
60+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
61+libgcc_sup_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CFLAGS = \
62+ $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@)
63+if VGCONF_HAVE_PLATFORM_SEC
64+libgcc_sup_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_SOURCES = \
65+ m_libgcc_sup.c
66+libgcc_sup_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_CPPFLAGS = \
67+ $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
68+libgcc_sup_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_CFLAGS = \
69+ $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_SEC_CAPS@)
70+endif
71+
72 #----------------------------------------------------------------------------
73 # libreplacemalloc_toolpreload-<platform>.a
74 #----------------------------------------------------------------------------
75diff --git a/coregrind/m_libgcc_sup.c b/coregrind/m_libgcc_sup.c
76new file mode 100644
77index 000000000..e29325459
78--- /dev/null
79+++ b/coregrind/m_libgcc_sup.c
80@@ -0,0 +1,61 @@
81+/* -*- mode: C; c-basic-offset: 3; -*- */
82+
83+/*--------------------------------------------------------------------*/
84+/*--- Supplemental functions for libgcc normally provided by glibc ---*/
85+/*--------------------------------------------------------------------*/
86+
87+/*
88+ This file is part of Valgrind, a dynamic binary instrumentation
89+ framework.
90+
91+ Copyright (C) 2020 Mark Wielaard
92+ mark@klomp.org
93+
94+ This program is free software; you can redistribute it and/or
95+ modify it under the terms of the GNU General Public License as
96+ published by the Free Software Foundation; either version 2 of the
97+ License, or (at your option) any later version.
98+
99+ This program is distributed in the hope that it will be useful, but
100+ WITHOUT ANY WARRANTY; without even the implied warranty of
101+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
102+ General Public License for more details.
103+
104+ You should have received a copy of the GNU General Public License
105+ along with this program; if not, see <http://www.gnu.org/licenses/>.
106+
107+ The GNU General Public License is contained in the file COPYING.
108+*/
109+
110+#include "config.h"
111+#include "pub_core_basics.h"
112+#include "pub_core_clientstate.h"
113+
114+/*====================================================================*/
115+/*=== arm64 libgcc support function for init_have_lse_atomics ===*/
116+/*====================================================================*/
117+
118+#if defined(VGP_arm64_linux)
119+struct auxv
120+{
121+ Word a_type;
122+ union {
123+ void *a_ptr;
124+ Word a_val;
125+ } u;
126+};
127+#define AT_NULL 0
128+
129+unsigned long int __getauxval (unsigned long int type);
130+unsigned long int __getauxval (unsigned long int type)
131+{
132+ struct auxv *p;
133+ for (p = (struct auxv *) VG_(client_auxv);
134+ p != NULL && p->a_type != AT_NULL;
135+ p++)
136+ if (p->a_type == type)
137+ return p->u.a_val;
138+
139+ return 0;
140+}
141+#endif
142--
1432.26.2
144