summaryrefslogtreecommitdiff
blob: 6ede22f8b5ec7138d4d32eaed265425fda0edf99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
https://bugs.kde.org/show_bug.cgi?id=435441

From 460d0c9a6c27edfffed8ced623cecf64466619f2 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Thu, 4 Nov 2021 14:26:40 -0700
Subject: [PATCH] Bug 435441 - Handle weak symbols as global for redirection

Weak symbols are global but with lower precedence, so they should
be handled the same way as global symbols during malloc replacement.

This fixes valgrind on musl 1.2.2 when it is not patched with a
soname (as is done on Alpine Linux).

https://bugs.kde.org/show_bug.cgi?id=435441
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -429,7 +429,8 @@ Bool get_elf_symbol_info (
    }
 #  endif
 
-   if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) {
+   if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL
+       || ELFXX_ST_BIND(sym->st_info) == STB_WEAK) {
       *is_global_out = True;
    }
 
-- 
2.32.0