summaryrefslogtreecommitdiff
path: root/tools/mklibs/patches
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-02-28 18:17:02 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-02-28 18:17:02 +0000
commit9c26cd0e621418d3b12022f91bbc10d95841d629 (patch)
treed1f12dec5fbe2fcaa2269a710036027b0ed5177d /tools/mklibs/patches
parent14e8d0ae0f3f777ccf90c87571c0a7b75e0cec7c (diff)
mklibs: fix some long standing libpthread symbol link issues, mostly related to weak function overrides between libgcc, libc and libpthread
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25795 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/mklibs/patches')
-rw-r--r--tools/mklibs/patches/009-uclibc_libgcc_link.patch5
-rw-r--r--tools/mklibs/patches/010-uclibc_libpthread_symbols.patch63
2 files changed, 65 insertions, 3 deletions
diff --git a/tools/mklibs/patches/009-uclibc_libgcc_link.patch b/tools/mklibs/patches/009-uclibc_libgcc_link.patch
index d201821fc6..36f2067193 100644
--- a/tools/mklibs/patches/009-uclibc_libgcc_link.patch
+++ b/tools/mklibs/patches/009-uclibc_libgcc_link.patch
@@ -22,16 +22,15 @@
symbols.update(library_symbols_used[library])
-@@ -590,9 +588,11 @@ while 1:
+@@ -590,9 +588,10 @@ while 1:
cmd.append(pic_file)
cmd.extend(extra_post_obj)
cmd.extend(extra_flags)
- cmd.append("-lgcc")
cmd.extend(["-L%s" % a for a in [dest_path] + [sysroot + b for b in lib_path if sysroot == "" or b not in ("/" + libdir + "/", "/usr/" + libdir + "/")]])
- cmd.append(library_depends_gcc_libnames(so_file, soname))
-+ if soname != "libgcc_s.so.1" and soname != "libc.so.0":
-+ cmd.append(library_depends_gcc_libnames(so_file, soname))
+ if soname != "libgcc_s.so.1":
++ cmd.append(library_depends_gcc_libnames(so_file, soname))
+ cmd.append(libgcc_link)
command(target + "gcc", *cmd)
diff --git a/tools/mklibs/patches/010-uclibc_libpthread_symbols.patch b/tools/mklibs/patches/010-uclibc_libpthread_symbols.patch
new file mode 100644
index 0000000000..0c97216d1a
--- /dev/null
+++ b/tools/mklibs/patches/010-uclibc_libpthread_symbols.patch
@@ -0,0 +1,63 @@
+--- a/src/mklibs.py
++++ b/src/mklibs.py
+@@ -161,9 +161,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 = []
+@@ -204,11 +205,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
+
+@@ -476,6 +481,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?
+@@ -567,12 +575,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: