aboutsummaryrefslogtreecommitdiffstats
path: root/tools/mklibs/patches/009-uclibc_libpthread_symbols.patch
blob: 50eb31ab77a4e93e064b98a3ee3eef187ee91b84 (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
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
--- a/src/mklibs
+++ b/src/mklibs
@@ -162,9 +162,10 @@ def undefined_symbols(obj):
     return result
 
 class ProvidedSymbol(Symbol):
-    def __init__(self, name, version, library, default_version):
+    def __init__(self, name, version, library, default_version, weak):
         super(ProvidedSymbol, self).__init__(name, version, library)
         self.default_version = default_version
+        self.weak = weak
 
     def base_names(self):
         ret = []
@@ -205,11 +206,15 @@ def provided_symbols(obj):
         if version_string.lower() not in ('base', 'none'):
             version = version_string
 
+        weak = False
+        if weak_string.lower() == 'true':
+            weak = True
+
         default_version = False
         if default_version_string.lower() == 'true':
             default_version = True
 
-        result.append(ProvidedSymbol(name, version, library, default_version))
+        result.append(ProvidedSymbol(name, version, library, default_version, weak))
 
     return result
     
@@ -500,6 +505,9 @@ while 1:
             debug(DEBUG_SPAM, "present_symbols adding %s" % symbol)
             names = symbol.base_names()
             for name in names:
+                if name in present_symbols:
+                    if symbol.library != present_symbols[name].library:
+                        needed_symbols[name] = UndefinedSymbol(name, True, symbol.version, symbol.library)
                 present_symbols[name] = symbol
 
     # are we finished?
@@ -593,12 +601,16 @@ while 1:
                 # may segfault in ptmalloc_init due to undefined weak reference
                 extra_pre_obj.append(sysroot + libc_extras_dir + "/soinit.o")
                 extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")
-                symbols.add(ProvidedSymbol('__dso_handle', None, None, True))
+                symbols.add(ProvidedSymbol('__dso_handle', None, None, True, True))
 
-            if soname in ("libc.so.0"):
-                symbols.add(ProvidedSymbol('__uClibc_init', None, None, True))
-                symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True))
-                extra_flags.append("-Wl,-init,__uClibc_init")
+            if soname == "libc.so.0":
+                symbols.add(ProvidedSymbol('__uClibc_init', None, None, True, True))
+                symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True, True))
+                extra_pre_obj.append("-Wl,-init,__uClibc_init")
+
+            if soname == "libpthread.so.0":
+                symbols.add(ProvidedSymbol('__pthread_initialize_minimal_internal', None, None, True, True))
+                extra_flags.append("-Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal")
 
             map_file = find_pic_map(library)
             if map_file: