mklibs: update to version 0.1.43
authorFelix Fietkau <nbd@nbd.name>
Mon, 11 Dec 2017 09:50:00 +0000 (10:50 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 13 Dec 2017 10:28:37 +0000 (11:28 +0100)
Drop legacy uclibc patches

Signed-off-by: Felix Fietkau <nbd@nbd.name>
15 files changed:
tools/mklibs/Makefile
tools/mklibs/patches/002-disable_symbol_checks.patch
tools/mklibs/patches/003-no_copy.patch
tools/mklibs/patches/004-fix-ldlib-sysroot.patch [new file with mode: 0644]
tools/mklibs/patches/004-libpthread_link.patch [deleted file]
tools/mklibs/patches/005-duplicate_syms.patch
tools/mklibs/patches/006-fix-early-abort.patch [new file with mode: 0644]
tools/mklibs/patches/006-uclibc_init.patch [deleted file]
tools/mklibs/patches/007-gc_sections.patch
tools/mklibs/patches/008-libgcc_link.patch [new file with mode: 0644]
tools/mklibs/patches/008-uclibc_libgcc_link.patch [deleted file]
tools/mklibs/patches/009-fix-extract-soname.patch [new file with mode: 0644]
tools/mklibs/patches/009-uclibc_libpthread_symbols.patch [deleted file]
tools/mklibs/patches/011-remove_multiarch.patch
tools/mklibs/patches/012-musl-libc-link.patch [new file with mode: 0644]

index 507c2fd3949e2fc2af6c9e872393012fd914a523..e1078b91da90df63cde741101af25caa1a83068a 100644 (file)
@@ -7,11 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mklibs
-PKG_VERSION:=0.1.35
+PKG_VERSION:=0.1.43
 
-PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/m/mklibs/
-PKG_HASH:=ccb1023dc1729c5a37ca6c3eca8e4bac3491116763c8820dfce8eea4845c8567
+PKG_HASH:=6f0cf24ade13fff76e943c003413d85c3e497c984c95c1ecea1c9731ca86f13c
+TAR_OPTIONS += --transform=s/mklibs/mklibs-$(PKG_VERSION)/ --show-transformed-names
 
 HOST_FIXUP:=autoreconf
 
index 44be637609d7ff2247686cb8f1fd69b20fb6d4b5..e18dfa8e5591e8a771e0caa44e5e0a4b4b777981 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/mklibs
 +++ b/src/mklibs
-@@ -524,7 +524,7 @@ while 1:
+@@ -533,7 +533,7 @@ while 1:
          # No progress in last pass. Verify all remaining symbols are weak.
          for name in unresolved:
              if not needed_symbols[name].weak:
@@ -9,7 +9,7 @@
          break
  
      previous_pass_unresolved = unresolved
-@@ -559,7 +559,7 @@ while 1:
+@@ -568,7 +568,7 @@ while 1:
      for name in needed_symbols:
          if not name in symbol_provider:
              if not needed_symbols[name].weak:
index e0ab2ac88d198e0be480c157f6c875d3fb5fcde3..75beccf82ea7f714abe9331f39b41961f874e24c 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/mklibs
 +++ b/src/mklibs
-@@ -463,7 +463,7 @@ while 1:
+@@ -472,7 +472,7 @@ while 1:
      passnr = passnr + 1
      # Gather all already reduced libraries and treat them as objects as well
      small_libs = []
@@ -9,7 +9,7 @@
          obj = dest_path + "/" + lib
          small_libs.append(obj)
          inode = os.stat(obj)[ST_INO]
-@@ -579,12 +579,7 @@ while 1:
+@@ -588,12 +588,7 @@ while 1:
          if not so_file:
              sys.exit("File not found:" + library)
          pic_file = find_pic(library)
@@ -23,7 +23,7 @@
              # we have a pic file, recompile
              debug(DEBUG_SPAM, "extracting from:", pic_file, "so_file:", so_file)
              soname = extract_soname(so_file)
-@@ -627,22 +622,14 @@ while 1:
+@@ -636,22 +631,14 @@ while 1:
              cmd.append(library_depends_gcc_libnames(so_file))
              command(target + "gcc", *cmd)
  
@@ -47,4 +47,4 @@
 +    os.rename(dest_path + "/" + lib + "-so", dest_path + "/" + lib)
  
  # Canonicalize library names.
- for lib in regexpfilter(os.listdir(dest_path), "(.*so[.\d]*)$"):
+ for lib in sorted(regexpfilter(os.listdir(dest_path), "(.*so[.\d]*)$")):
diff --git a/tools/mklibs/patches/004-fix-ldlib-sysroot.patch b/tools/mklibs/patches/004-fix-ldlib-sysroot.patch
new file mode 100644 (file)
index 0000000..04ecbbd
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/mklibs
++++ b/src/mklibs
+@@ -506,7 +506,7 @@ while 1:
+     present_symbols = {}
+     checked_libs = small_libs
+     checked_libs.extend(available_libs)
+-    checked_libs.append(ldlib)
++    checked_libs.append(sysroot + ldlib)
+     for lib in checked_libs:
+         for symbol in provided_symbols(lib):
+             debug(DEBUG_SPAM, "present_symbols adding %s" % symbol)
diff --git a/tools/mklibs/patches/004-libpthread_link.patch b/tools/mklibs/patches/004-libpthread_link.patch
deleted file mode 100644 (file)
index 657e232..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/src/mklibs
-+++ b/src/mklibs
-@@ -106,14 +106,14 @@ def library_depends(obj):
- # Return a list of libraries the passed objects depend on. The
- # libraries are in "-lfoo" format suitable for passing to gcc.
--def library_depends_gcc_libnames(obj):
-+def library_depends_gcc_libnames(obj, soname):
-     if not os.access(obj, os.F_OK):
-         raise Exception("Cannot find lib: " + obj)
-     libs = library_depends(obj)
-     ret = []
-     for i in libs:
-         match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
--        if match:
-+        if match and not soname in ("libpthread.so.0"):
-             if match.group('ld'):
-                 ret.append(find_lib(match.group(0)))
-             elif match.group('lib'):
-@@ -619,7 +619,7 @@ while 1:
-             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))
-+            cmd.append(library_depends_gcc_libnames(so_file, soname))
-             command(target + "gcc", *cmd)
-             ## DEBUG
index 8428abfc9a07d278f92fdee168e1cc88f162cbb3..b0fdab7b10ff979b1337aab976df4b31acb2d073 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/mklibs
 +++ b/src/mklibs
-@@ -531,7 +531,6 @@ while 1:
+@@ -540,7 +540,6 @@ while 1:
  
      library_symbols = {}
      library_symbols_used = {}
@@ -8,7 +8,7 @@
  
      # WORKAROUND: Always add libgcc on old-abi arm
      header = elf_header(find_lib(libraries.copy().pop()))
-@@ -549,20 +548,13 @@ while 1:
+@@ -558,20 +557,13 @@ while 1:
          library_symbols_used[library] = set()
          for symbol in symbols:
              for name in symbol.base_names():
@@ -32,4 +32,4 @@
 +                library_symbols_used[lib].add(library_symbols[lib][name])
  
      # reduce libraries
-     for library in libraries:
+     for library in sorted(libraries):
diff --git a/tools/mklibs/patches/006-fix-early-abort.patch b/tools/mklibs/patches/006-fix-early-abort.patch
new file mode 100644 (file)
index 0000000..a72a1d4
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/src/mklibs
++++ b/src/mklibs
+@@ -526,10 +526,10 @@ while 1:
+     debug (DEBUG_NORMAL, `len(needed_symbols)`, "symbols,",
+            `num_unresolved`, "unresolved")
+-    if num_unresolved == 0:
++    if num_unresolved == 0 and passnr > 2:
+         break
+-    if unresolved == previous_pass_unresolved:
++    if unresolved == previous_pass_unresolved and passnr > 2:
+         # No progress in last pass. Verify all remaining symbols are weak.
+         for name in unresolved:
+             if not needed_symbols[name].weak:
diff --git a/tools/mklibs/patches/006-uclibc_init.patch b/tools/mklibs/patches/006-uclibc_init.patch
deleted file mode 100644 (file)
index 2df7fe4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/src/mklibs
-+++ b/src/mklibs
-@@ -595,6 +595,11 @@ while 1:
-                 extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")
-                 symbols.add(ProvidedSymbol('__dso_handle', None, None, 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")
-+
-             map_file = find_pic_map(library)
-             if map_file:
-                 extra_flags.append("-Wl,--version-script=" + map_file)
index 068d88a532aac67eb5832417021f8c85b1f5002c..3d098ae42674f6ab091fc57037bb7492b452bddf 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/mklibs
 +++ b/src/mklibs
-@@ -607,7 +607,7 @@ while 1:
+@@ -611,7 +611,7 @@ while 1:
              # compile in only used symbols
              cmd = []
              cmd.extend(gcc_options)
diff --git a/tools/mklibs/patches/008-libgcc_link.patch b/tools/mklibs/patches/008-libgcc_link.patch
new file mode 100644 (file)
index 0000000..703af65
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/src/mklibs
++++ b/src/mklibs
+@@ -114,10 +114,7 @@ def library_depends_gcc_libnames(obj):
+     for i in libs:
+         match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
+         if match:
+-            if match.group('ld'):
+-                ret.append(find_lib(match.group(0)))
+-            elif match.group('lib'):
+-                ret.append('-l%s' % match.group('lib'))
++            ret.append(find_lib(match.group(0)))
+     return ' '.join(ret)
+ class Symbol(object):
+@@ -593,6 +590,7 @@ while 1:
+             extra_flags = []
+             extra_pre_obj = []
+             extra_post_obj = []
++            libgcc_link = find_lib("libgcc_s.so.1")
+             symbols.update(library_symbols_used[library])
+@@ -618,9 +616,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))
++            if soname != "libgcc_s.so.1":
++                cmd.append(library_depends_gcc_libnames(so_file))
++                cmd.append(libgcc_link)
+             command(target + "gcc", *cmd)
+             ## DEBUG
diff --git a/tools/mklibs/patches/008-uclibc_libgcc_link.patch b/tools/mklibs/patches/008-uclibc_libgcc_link.patch
deleted file mode 100644 (file)
index 432a313..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---- a/src/mklibs
-+++ b/src/mklibs
-@@ -113,11 +113,8 @@ def library_depends_gcc_libnames(obj, so
-     ret = []
-     for i in libs:
-         match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
--        if match and not soname in ("libpthread.so.0"):
--            if match.group('ld'):
--                ret.append(find_lib(match.group(0)))
--            elif match.group('lib'):
--                ret.append('-l%s' % match.group('lib'))
-+        if match:
-+            ret.append(find_lib(match.group(0)))
-     return ' '.join(ret)
- class Symbol(object):
-@@ -584,6 +581,7 @@ while 1:
-             extra_flags = []
-             extra_pre_obj = []
-             extra_post_obj = []
-+            libgcc_link = find_lib("libgcc_s.so.1")
-             symbols.update(library_symbols_used[library])
-@@ -614,9 +612,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":
-+                cmd.append(library_depends_gcc_libnames(so_file, soname))
-+                cmd.append(libgcc_link)
-             command(target + "gcc", *cmd)
-             ## DEBUG
diff --git a/tools/mklibs/patches/009-fix-extract-soname.patch b/tools/mklibs/patches/009-fix-extract-soname.patch
new file mode 100644 (file)
index 0000000..8c36a1c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/mklibs
++++ b/src/mklibs
+@@ -266,6 +266,8 @@ def extract_soname(so_file):
+     soname_data = command("mklibs-readelf", "--print-soname", so_file)
+     if soname_data:
+         return soname_data.pop()
++    else:
++        return os.path.basename(so_file)
+     return ""
+ def multiarch(paths):
diff --git a/tools/mklibs/patches/009-uclibc_libpthread_symbols.patch b/tools/mklibs/patches/009-uclibc_libpthread_symbols.patch
deleted file mode 100644 (file)
index 34866f7..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
---- 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?
-@@ -591,12 +599,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:
index a32d8ee17a81842561081e01b13d5c76aa434893..d47774e9ed631a977c4bd08967c81f1c15073b0e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/mklibs
 +++ b/src/mklibs
-@@ -263,6 +263,7 @@ def extract_soname(so_file):
+@@ -271,6 +271,7 @@ def extract_soname(so_file):
      return ""
  
  def multiarch(paths):
diff --git a/tools/mklibs/patches/012-musl-libc-link.patch b/tools/mklibs/patches/012-musl-libc-link.patch
new file mode 100644 (file)
index 0000000..f1e6506
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/src/mklibs
++++ b/src/mklibs
+@@ -605,6 +605,10 @@ while 1:
+                 extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")
+                 symbols.add(ProvidedSymbol('__dso_handle', None, None, True))
++            if soname in ("libc.so.1"):
++                extra_pre_obj.append("-Wl,-Bsymbolic-functions -Wl,-e,_dlstart -Wl,--exclude-libs=ALL -Wl,--no-undefined  -Wl,--sort-section,alignment -Wl,--sort-common")
++                pic_file = "-Wl,--whole-archive " + pic_file + " -Wl,--no-whole-archive"
++
+             map_file = find_pic_map(library)
+             if map_file:
+                 extra_flags.append("-Wl,--version-script=" + map_file)
+@@ -619,8 +623,9 @@ while 1:
+             cmd.append(pic_file)
+             cmd.extend(extra_post_obj)
+             cmd.extend(extra_flags)
+-            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 + "/")]])
+-            if soname != "libgcc_s.so.1":
++            if soname in ("libc.so.1"):
++                cmd.append("-lgcc_initial")
++            elif soname != "libgcc_s.so.1":
+                 cmd.append(library_depends_gcc_libnames(so_file))
+                 cmd.append(libgcc_link)
+             command(target + "gcc", *cmd)