009-uclibc_libpthread_symbols.patch 2.7 KB

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