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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
From dcb45256970b15b672d0004533826c94083356e5 Mon Sep 17 00:00:00 2001
From: Yuanjie Huang <yuanjie.huang@windriver.com>
Date: Fri, 17 Apr 2015 14:48:20 +0800
Subject: [PATCH 4/6] avoid failure on symbol provided by application
Upstream-Status: Pending
Undefined symbols in a library can be provided by the application
that links to the library, such as `logsink' in libmultipath.so.0.
This fix checks the type of object in which the symbol is needed
and the existence of the symbol in application, when a symbol
cannot be provided by libraries. It prevents false alarm on absence
of symbols.
Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
---
src/mklibs | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/mklibs b/src/mklibs
index a3533c0..66b7a09 100755
--- a/src/mklibs
+++ b/src/mklibs
@@ -133,9 +133,9 @@ class Symbol(object):
return '@'.join(ret)
class UndefinedSymbol(Symbol):
- def __init__(self, name, weak, version, library):
+ def __init__(self, name, weak, version, library, object):
super(UndefinedSymbol, self).__init__(name, version, library)
- self.weak, self.library = weak, library
+ self.weak, self.library, self.object = weak, library, object
def symbol_is_blacklisted(name):
# The ARM Embedded ABI spec states symbols under this namespace as
@@ -152,6 +152,11 @@ def undefined_symbols(obj):
output = command("mklibs-readelf", "--print-symbols-undefined", obj)
+ if len(obj) > len(dest_path) and obj[:len(dest_path)] == dest_path:
+ object = obj[len(dest_path) + 1:-len('-so-stripped')]
+ else:
+ object = obj
+
result = []
for line in output:
name, weak_string, version_string, library_string = line.split()[:4]
@@ -171,7 +176,7 @@ def undefined_symbols(obj):
if library_string.lower() != 'none':
library = library_string
- result.append(UndefinedSymbol(name, weak, version, library))
+ result.append(UndefinedSymbol(name, weak, version, library, object))
return result
@@ -498,12 +503,13 @@ while 1:
and re.search("^ps_", str(symbol)))
and not (re.search("ld-linux.so.3$", str(symbol)))
and not (re.search("^__gnu_local_gp", str(symbol)))):
- debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s" % (symbol, symbol.weak))
+ debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s, for %s" % (symbol, symbol.weak, obj))
needed_symbols[str(symbol)] = symbol
libraries.update(library_depends(obj))
# calculate what symbols are present in small_libs and available_libs
present_symbols = {}
+ present_symbol_progs = {}
checked_libs = small_libs
checked_libs.extend(available_libs)
checked_libs.append(sysroot + ldlib)
@@ -513,6 +519,12 @@ while 1:
names = symbol.base_names()
for name in names:
present_symbols[name] = symbol
+ if not so_pattern.match(lib):
+ debug(DEBUG_SPAM, "present_symbol_progs adding %s, from executable %s" % (' '.join(names), lib))
+ for name in names:
+ progs = present_symbol_progs.get(name, set())
+ progs.add(lib)
+ present_symbol_progs[name] = progs
# are we finished?
num_unresolved = 0
@@ -568,6 +580,14 @@ while 1:
for name in needed_symbols:
if not name in symbol_provider:
if not needed_symbols[name].weak:
+ # WORKAROUND: Undefined symbols in a library can be provided by the application
+ # that links to the library. So if the object which requires the symbol is a library
+ # and some application can provide the symbol, the undefined symbol is skipped.
+ symbol = needed_symbols[name]
+ if so_pattern.match(symbol.object) and present_symbol_progs.get(name, None):
+ debug(DEBUG_SPAM, "symbol %s in library %s is provided by executable %s" \
+ % (name, symbol.object, ' '.join(present_symbol_progs[name])))
+ continue
raise Exception("No library provides non-weak %s" % name)
else:
lib = symbol_provider[name]
--
2.16.1
|