Revert "[tools] mklibs: update to 0.1.34"
[openwrt/svn-archive/archive.git] / tools / mklibs / patches / 010-uclibc_libpthread_symbols.patch
1 --- a/src/mklibs.py
2 +++ b/src/mklibs.py
3 @@ -161,9 +161,10 @@ def undefined_symbols(obj):
4 return result
5
6 class ProvidedSymbol(Symbol):
7 - def __init__(self, name, version, library, default_version):
8 + def __init__(self, name, version, library, default_version, weak):
9 super(ProvidedSymbol, self).__init__(name, version, library)
10 self.default_version = default_version
11 + self.weak = weak
12
13 def base_names(self):
14 ret = []
15 @@ -204,11 +205,15 @@ def provided_symbols(obj):
16 if version_string.lower() not in ('base', 'none'):
17 version = version_string
18
19 + weak = False
20 + if weak_string.lower() == 'true':
21 + weak = True
22 +
23 default_version = False
24 if default_version_string.lower() == 'true':
25 default_version = True
26
27 - result.append(ProvidedSymbol(name, version, library, default_version))
28 + result.append(ProvidedSymbol(name, version, library, default_version, weak))
29
30 return result
31
32 @@ -476,6 +481,9 @@ while 1:
33 debug(DEBUG_SPAM, "present_symbols adding %s" % symbol)
34 names = symbol.base_names()
35 for name in names:
36 + if name in present_symbols:
37 + if symbol.library != present_symbols[name].library:
38 + needed_symbols[name] = UndefinedSymbol(name, True, symbol.version, symbol.library)
39 present_symbols[name] = symbol
40
41 # are we finished?
42 @@ -567,12 +575,16 @@ while 1:
43 # may segfault in ptmalloc_init due to undefined weak reference
44 extra_pre_obj.append(sysroot + libc_extras_dir + "/soinit.o")
45 extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")
46 - symbols.add(ProvidedSymbol('__dso_handle', None, None, True))
47 + symbols.add(ProvidedSymbol('__dso_handle', None, None, True, True))
48
49 - if soname in ("libc.so.0"):
50 - symbols.add(ProvidedSymbol('__uClibc_init', None, None, True))
51 - symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True))
52 - extra_flags.append("-Wl,-init,__uClibc_init")
53 + if soname == "libc.so.0":
54 + symbols.add(ProvidedSymbol('__uClibc_init', None, None, True, True))
55 + symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True, True))
56 + extra_pre_obj.append("-Wl,-init,__uClibc_init")
57 +
58 + if soname == "libpthread.so.0":
59 + symbols.add(ProvidedSymbol('__pthread_initialize_minimal_internal', None, None, True, True))
60 + extra_flags.append("-Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal")
61
62 map_file = find_pic_map(library)
63 if map_file: