glibc: Fix scope resolution in glibc to be breadth first.
The ELF specification indicates symbol resolution should be breadth first, not depth first. The dl-deps.c: dl_build_locale_scope function is processing in a depth first mode. This is causes certain symbols to be incorrectly reported when LD_TRACE_PRELINKING=1 is enabled. See glibc BZ #20488 for more information. (From OE-Core rev: fb72263eaa94e64ddeee457b5b1bc999f0e647da) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
1bb1200a93
commit
63ac3520b4
|
@ -0,0 +1,56 @@
|
|||
From 6e4ec5a3c5fe63b6458036f18d43124de4a7e724 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Hatle <mark.hatle@windriver.com>
|
||||
Date: Thu, 18 Aug 2016 14:07:58 -0500
|
||||
Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
|
||||
|
||||
According to the ELF specification:
|
||||
|
||||
When resolving symbolic references, the dynamic linker examines the symbol
|
||||
tables with a breadth-first search.
|
||||
|
||||
This function was using a depth first search. By doing so the conflict
|
||||
resolution reported to the prelinker (when LD_TRACE_PRELINKING=1 is set)
|
||||
was incorrect. This caused problems when their were various circular
|
||||
dependencies between libraries. The problem usually manifested itself by
|
||||
the wrong IFUNC being executed.
|
||||
|
||||
[BZ# 20488]
|
||||
|
||||
Upstream-Status: Submitted [libc-alpha]
|
||||
|
||||
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
||||
---
|
||||
elf/dl-deps.c | 14 ++++++++++----
|
||||
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
|
||||
index 6a82987..fc37c87 100644
|
||||
--- a/elf/dl-deps.c
|
||||
+++ b/elf/dl-deps.c
|
||||
@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map)
|
||||
{
|
||||
struct link_map **p = list;
|
||||
struct link_map **q;
|
||||
+ struct link_map **r;
|
||||
|
||||
*p++ = map;
|
||||
map->l_reserved = 1;
|
||||
- if (map->l_initfini)
|
||||
- for (q = map->l_initfini + 1; *q; ++q)
|
||||
- if (! (*q)->l_reserved)
|
||||
- p += _dl_build_local_scope (p, *q);
|
||||
+
|
||||
+ for (r = list; r < p; ++r)
|
||||
+ if ((*r)->l_initfini)
|
||||
+ for (q = (*r)->l_initfini + 1; *q; ++q)
|
||||
+ if (! (*q)->l_reserved)
|
||||
+ {
|
||||
+ *p++ = *q;
|
||||
+ (*q)->l_reserved = 1;
|
||||
+ }
|
||||
return p - list;
|
||||
}
|
||||
|
||||
--
|
||||
2.5.5
|
||||
|
|
@ -36,6 +36,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
|
|||
file://0023-eglibc-Install-PIC-archives.patch \
|
||||
file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
|
||||
file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
|
||||
file://0026-build_local_scope.patch \
|
||||
"
|
||||
|
||||
SRC_URI += "\
|
||||
|
|
Loading…
Reference in New Issue