diff options
| -rw-r--r-- | meta/recipes-devtools/mklibs/files/avoid-failure-on-symbol-provided-by-application.patch | 102 | ||||
| -rw-r--r-- | meta/recipes-devtools/mklibs/mklibs-native_0.1.40.bb | 1 |
2 files changed, 103 insertions, 0 deletions
diff --git a/meta/recipes-devtools/mklibs/files/avoid-failure-on-symbol-provided-by-application.patch b/meta/recipes-devtools/mklibs/files/avoid-failure-on-symbol-provided-by-application.patch new file mode 100644 index 0000000000..7d6d62e773 --- /dev/null +++ b/meta/recipes-devtools/mklibs/files/avoid-failure-on-symbol-provided-by-application.patch | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | From f172101130604e4a9efa5746f4d8d30de99a0fdc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuanjie Huang <yuanjie.huang@windriver.com> | ||
| 3 | Date: Fri, 17 Apr 2015 14:48:20 +0800 | ||
| 4 | Subject: [PATCH] avoid failure on symbol provided by application | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Undefined symbols in a library can be provided by the application | ||
| 9 | that links to the library, such as `logsink' in libmultipath.so.0. | ||
| 10 | This fix checks the type of object in which the symbol is needed | ||
| 11 | and the existence of the symbol in application, when a symbol | ||
| 12 | cannot be provided by libraries. It prevents false alarm on absence | ||
| 13 | of symbols. | ||
| 14 | |||
| 15 | Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com> | ||
| 16 | --- | ||
| 17 | src/mklibs | 28 ++++++++++++++++++++++++---- | ||
| 18 | 1 file changed, 24 insertions(+), 4 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/src/mklibs b/src/mklibs | ||
| 21 | index c5614ea..b0d9034 100755 | ||
| 22 | --- a/src/mklibs | ||
| 23 | +++ b/src/mklibs | ||
| 24 | @@ -133,9 +133,9 @@ class Symbol(object): | ||
| 25 | return '@'.join(ret) | ||
| 26 | |||
| 27 | class UndefinedSymbol(Symbol): | ||
| 28 | - def __init__(self, name, weak, version, library): | ||
| 29 | + def __init__(self, name, weak, version, library, object): | ||
| 30 | super(UndefinedSymbol, self).__init__(name, version, library) | ||
| 31 | - self.weak, self.library = weak, library | ||
| 32 | + self.weak, self.library, self.object = weak, library, object | ||
| 33 | |||
| 34 | # Return undefined symbols in an object as a set of tuples (name, weakness) | ||
| 35 | def undefined_symbols(obj): | ||
| 36 | @@ -144,6 +144,11 @@ def undefined_symbols(obj): | ||
| 37 | |||
| 38 | output = command("mklibs-readelf", "--print-symbols-undefined", obj) | ||
| 39 | |||
| 40 | + if len(obj) > len(dest_path) and obj[:len(dest_path)] == dest_path: | ||
| 41 | + object = obj[len(dest_path) + 1:-len('-so-stripped')] | ||
| 42 | + else: | ||
| 43 | + object = obj | ||
| 44 | + | ||
| 45 | result = [] | ||
| 46 | for line in output: | ||
| 47 | name, weak_string, version_string, library_string = line.split()[:4] | ||
| 48 | @@ -160,7 +165,7 @@ def undefined_symbols(obj): | ||
| 49 | if library_string.lower() != 'none': | ||
| 50 | library = library_string | ||
| 51 | |||
| 52 | - result.append(UndefinedSymbol(name, weak, version, library)) | ||
| 53 | + result.append(UndefinedSymbol(name, weak, version, library, object)) | ||
| 54 | |||
| 55 | return result | ||
| 56 | |||
| 57 | @@ -495,12 +500,13 @@ while 1: | ||
| 58 | and re.search("^ps_", str(symbol))) | ||
| 59 | and not (re.search("ld-linux.so.3$", str(symbol))) | ||
| 60 | and not (re.search("^__gnu_local_gp", str(symbol)))): | ||
| 61 | - debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s" % (symbol, symbol.weak)) | ||
| 62 | + debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s, for %s" % (symbol, symbol.weak, obj)) | ||
| 63 | needed_symbols[str(symbol)] = symbol | ||
| 64 | libraries.update(library_depends(obj)) | ||
| 65 | |||
| 66 | # calculate what symbols are present in small_libs and available_libs | ||
| 67 | present_symbols = {} | ||
| 68 | + present_symbol_progs = {} | ||
| 69 | checked_libs = small_libs | ||
| 70 | checked_libs.extend(available_libs) | ||
| 71 | checked_libs.append(ldlib) | ||
| 72 | @@ -510,6 +516,12 @@ while 1: | ||
| 73 | names = symbol.base_names() | ||
| 74 | for name in names: | ||
| 75 | present_symbols[name] = symbol | ||
| 76 | + if not so_pattern.match(lib): | ||
| 77 | + debug(DEBUG_SPAM, "present_symbol_progs adding %s, from executable %s" % (' '.join(names), lib)) | ||
| 78 | + for name in names: | ||
| 79 | + progs = present_symbol_progs.get(name, set()) | ||
| 80 | + progs.add(lib) | ||
| 81 | + present_symbol_progs[name] = progs | ||
| 82 | |||
| 83 | # are we finished? | ||
| 84 | num_unresolved = 0 | ||
| 85 | @@ -565,6 +577,14 @@ while 1: | ||
| 86 | for name in needed_symbols: | ||
| 87 | if not name in symbol_provider: | ||
| 88 | if not needed_symbols[name].weak: | ||
| 89 | + # WORKAROUND: Undefined symbols in a library can be provided by the application | ||
| 90 | + # that links to the library. So if the object which requires the symbol is a library | ||
| 91 | + # and some application can provide the symbol, the undefined symbol is skipped. | ||
| 92 | + symbol = needed_symbols[name] | ||
| 93 | + if so_pattern.match(symbol.object) and present_symbol_progs.get(name, None): | ||
| 94 | + debug(DEBUG_SPAM, "symbol %s in library %s is provided by executable %s" \ | ||
| 95 | + % (name, symbol.object, ' '.join(present_symbol_progs[name]))) | ||
| 96 | + continue | ||
| 97 | raise Exception("No library provides non-weak %s" % name) | ||
| 98 | else: | ||
| 99 | lib = symbol_provider[name] | ||
| 100 | -- | ||
| 101 | 1.8.5.2.233.g932f7e4 | ||
| 102 | |||
diff --git a/meta/recipes-devtools/mklibs/mklibs-native_0.1.40.bb b/meta/recipes-devtools/mklibs/mklibs-native_0.1.40.bb index b2fcae576a..0bb5f2191c 100644 --- a/meta/recipes-devtools/mklibs/mklibs-native_0.1.40.bb +++ b/meta/recipes-devtools/mklibs/mklibs-native_0.1.40.bb | |||
| @@ -10,6 +10,7 @@ SRC_URI = "http://ftp.de.debian.org/debian/pool/main/m/mklibs/${BPN}_${PV}.tar.x | |||
| 10 | file://ac_init_fix.patch\ | 10 | file://ac_init_fix.patch\ |
| 11 | file://fix_STT_GNU_IFUNC.patch\ | 11 | file://fix_STT_GNU_IFUNC.patch\ |
| 12 | file://sysrooted-ldso.patch \ | 12 | file://sysrooted-ldso.patch \ |
| 13 | file://avoid-failure-on-symbol-provided-by-application.patch \ | ||
| 13 | " | 14 | " |
| 14 | 15 | ||
| 15 | SRC_URI[md5sum] = "e1dafe5f962caa9dc5f2651c0723812a" | 16 | SRC_URI[md5sum] = "e1dafe5f962caa9dc5f2651c0723812a" |
