mklibs: update to 0.1.34 (v2)

SVN-Revision: 32165
This commit is contained in:
Luka Perkov 2012-06-10 17:07:46 +00:00
parent d8bea7da9a
commit 33dadd70ab
14 changed files with 81 additions and 106 deletions

View file

@ -38,7 +38,7 @@ ifdef CONFIG_USE_MKLIBS
file -r -N -F '' {} + | \ file -r -N -F '' {} + | \
awk ' /shared object/ { print $$1 }' >> $(TMP_DIR)/mklibs-progs awk ' /shared object/ { print $$1 }' >> $(TMP_DIR)/mklibs-progs
mkdir -p $(TMP_DIR)/mklibs-out mkdir -p $(TMP_DIR)/mklibs-out
$(STAGING_DIR_HOST)/bin/mklibs.py -D \ $(STAGING_DIR_HOST)/bin/mklibs -D \
-d $(TMP_DIR)/mklibs-out \ -d $(TMP_DIR)/mklibs-out \
--sysroot $(STAGING_DIR_ROOT) \ --sysroot $(STAGING_DIR_ROOT) \
-L /lib \ -L /lib \

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2009 OpenWrt.org # Copyright (C) 2009-2012 OpenWrt.org
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -7,13 +7,11 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mklibs PKG_NAME:=mklibs
PKG_VERSION:=0.1.29 PKG_VERSION:=0.1.34
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/m/mklibs/ PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/m/mklibs/
PKG_MD5SUM:=7f35dfdbde249a090199829c1a1222d8 PKG_MD5SUM:=afe0ed527ba96b8a882b5de350603007
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/mklibs
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
@ -21,8 +19,8 @@ HOST_CFLAGS += -I$(CURDIR)/include
define Host/Install define Host/Install
$(INSTALL_BIN) \ $(INSTALL_BIN) \
$(HOST_BUILD_DIR)/src/mklibs.py \ $(HOST_BUILD_DIR)/src/mklibs \
$(HOST_BUILD_DIR)/src/mklibs-copy.py \ $(HOST_BUILD_DIR)/src/mklibs-copy \
$(HOST_BUILD_DIR)/src/mklibs-readelf/mklibs-readelf \ $(HOST_BUILD_DIR)/src/mklibs-readelf/mklibs-readelf \
$(STAGING_DIR_HOST)/bin/ $(STAGING_DIR_HOST)/bin/
endef endef

View file

@ -1,20 +0,0 @@
--- a/src/mklibs-readelf/elf.cpp
+++ b/src/mklibs-readelf/elf.cpp
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <unistd.h>
using namespace Elf;
--- a/src/mklibs-readelf/main.cpp
+++ b/src/mklibs-readelf/main.cpp
@@ -7,6 +7,7 @@
#include <elf.h>
#include <getopt.h>
+#include <stdio.h>
#include "elf.hpp"

View file

@ -1,23 +1,20 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -500,7 +500,7 @@ while 1: @@ -524,7 +524,7 @@ while 1:
# No progress in last pass. Verify all remaining symbols are weak. # No progress in last pass. Verify all remaining symbols are weak.
for name in unresolved: for name in unresolved:
if not needed_symbols[name].weak: if not needed_symbols[name].weak:
- raise "Unresolvable symbol %s" % name - raise Exception("Unresolvable symbol %s" % name)
+ print "WARNING: Unresolvable symbol %s" % name + print "WARNING: Unresolvable symbol %s" % name
break break
previous_pass_unresolved = unresolved previous_pass_unresolved = unresolved
@@ -533,10 +533,7 @@ while 1: @@ -559,7 +559,7 @@ while 1:
# which symbols are actually used from each lib
for name in needed_symbols: for name in needed_symbols:
- if not name in symbol_provider: if not name in symbol_provider:
- if not needed_symbols[name].weak: if not needed_symbols[name].weak:
- raise "No library provides non-weak %s" % name - raise Exception("No library provides non-weak %s" % name)
- else: + print "WARNING: Unresolvable symbol %s" % name
+ if name in symbol_provider: else:
lib = symbol_provider[name] lib = symbol_provider[name]
library_symbols_used[lib].add(library_symbols[lib][name]) library_symbols_used[lib].add(library_symbols[lib][name])

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -440,7 +440,7 @@ while 1: @@ -463,7 +463,7 @@ while 1:
passnr = passnr + 1 passnr = passnr + 1
# Gather all already reduced libraries and treat them as objects as well # Gather all already reduced libraries and treat them as objects as well
small_libs = [] small_libs = []
@ -9,7 +9,7 @@
obj = dest_path + "/" + lib obj = dest_path + "/" + lib
small_libs.append(obj) small_libs.append(obj)
inode = os.stat(obj)[ST_INO] inode = os.stat(obj)[ST_INO]
@@ -552,12 +552,7 @@ while 1: @@ -579,12 +579,7 @@ while 1:
if not so_file: if not so_file:
sys.exit("File not found:" + library) sys.exit("File not found:" + library)
pic_file = find_pic(library) pic_file = find_pic(library)
@ -23,7 +23,7 @@
# we have a pic file, recompile # we have a pic file, recompile
debug(DEBUG_SPAM, "extracting from:", pic_file, "so_file:", so_file) debug(DEBUG_SPAM, "extracting from:", pic_file, "so_file:", so_file)
soname = extract_soname(so_file) soname = extract_soname(so_file)
@@ -600,22 +595,14 @@ while 1: @@ -627,22 +622,14 @@ while 1:
cmd.append(library_depends_gcc_libnames(so_file)) cmd.append(library_depends_gcc_libnames(so_file))
command(target + "gcc", *cmd) command(target + "gcc", *cmd)

View file

@ -1,13 +1,13 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -105,14 +105,14 @@ def library_depends(obj): @@ -106,14 +106,14 @@ def library_depends(obj):
# Return a list of libraries the passed objects depend on. The # Return a list of libraries the passed objects depend on. The
# libraries are in "-lfoo" format suitable for passing to gcc. # libraries are in "-lfoo" format suitable for passing to gcc.
-def library_depends_gcc_libnames(obj): -def library_depends_gcc_libnames(obj):
+def library_depends_gcc_libnames(obj, soname): +def library_depends_gcc_libnames(obj, soname):
if not os.access(obj, os.F_OK): if not os.access(obj, os.F_OK):
raise "Cannot find lib: " + obj raise Exception("Cannot find lib: " + obj)
libs = library_depends(obj) libs = library_depends(obj)
ret = [] ret = []
for i in libs: for i in libs:
@ -17,7 +17,7 @@
if match.group('ld'): if match.group('ld'):
ret.append(find_lib(match.group(0))) ret.append(find_lib(match.group(0)))
elif match.group('lib'): elif match.group('lib'):
@@ -592,7 +592,7 @@ while 1: @@ -619,7 +619,7 @@ while 1:
cmd.extend(extra_flags) cmd.extend(extra_flags)
cmd.append("-lgcc") 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.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 + "/")]])

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -507,7 +507,6 @@ while 1: @@ -531,7 +531,6 @@ while 1:
library_symbols = {} library_symbols = {}
library_symbols_used = {} library_symbols_used = {}
@ -8,7 +8,7 @@
# WORKAROUND: Always add libgcc on old-abi arm # WORKAROUND: Always add libgcc on old-abi arm
header = elf_header(find_lib(libraries.copy().pop())) header = elf_header(find_lib(libraries.copy().pop()))
@@ -525,17 +524,13 @@ while 1: @@ -549,20 +548,13 @@ while 1:
library_symbols_used[library] = set() library_symbols_used[library] = set()
for symbol in symbols: for symbol in symbols:
for name in symbol.base_names(): for name in symbol.base_names():
@ -21,7 +21,10 @@
# which symbols are actually used from each lib # which symbols are actually used from each lib
for name in needed_symbols: for name in needed_symbols:
- if name in symbol_provider: - if not name in symbol_provider:
- if not needed_symbols[name].weak:
- print "WARNING: Unresolvable symbol %s" % name
- else:
- lib = symbol_provider[name] - lib = symbol_provider[name]
- library_symbols_used[lib].add(library_symbols[lib][name]) - library_symbols_used[lib].add(library_symbols[lib][name])
+ for lib in libraries: + for lib in libraries:

View file

@ -1,33 +0,0 @@
--- a/src/mklibs-readelf/main.cpp
+++ b/src/mklibs-readelf/main.cpp
@@ -57,6 +57,10 @@ static void process_elf_header (Elf::fil
static void process_dynamics (Elf::file *file, int64_t tag)
{
const Elf::section_type<Elf::section_type_DYNAMIC> *section = file->get_section_DYNAMIC ();
+
+ if (!section)
+ return;
+
for (std::vector<Elf::dynamic *>::const_iterator it = section->get_dynamics ().begin (); it != section->get_dynamics ().end (); ++it)
{
Elf::dynamic *dynamic = *it;
@@ -67,6 +71,9 @@ static void process_dynamics (Elf::file
static void process_symbols_provided (const Elf::section_type<Elf::section_type_DYNSYM> *section)
{
+ if (!section)
+ return;
+
for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
{
const Elf::symbol *symbol = *it;
@@ -95,6 +102,9 @@ static void process_symbols_provided (co
static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section)
{
+ if (!section)
+ return;
+
for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
{
const Elf::symbol *symbol = *it;

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -571,6 +571,11 @@ while 1: @@ -595,6 +595,11 @@ while 1:
extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.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))

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -583,7 +583,7 @@ while 1: @@ -607,7 +607,7 @@ while 1:
# compile in only used symbols # compile in only used symbols
cmd = [] cmd = []
cmd.extend(gcc_options) cmd.extend(gcc_options)

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -112,11 +112,8 @@ def library_depends_gcc_libnames(obj, so @@ -113,11 +113,8 @@ def library_depends_gcc_libnames(obj, so
ret = [] ret = []
for i in libs: for i in libs:
match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i) match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
@ -14,7 +14,7 @@
return ' '.join(ret) return ' '.join(ret)
class Symbol(object): class Symbol(object):
@@ -560,6 +557,7 @@ while 1: @@ -584,6 +581,7 @@ while 1:
extra_flags = [] extra_flags = []
extra_pre_obj = [] extra_pre_obj = []
extra_post_obj = [] extra_post_obj = []
@ -22,7 +22,7 @@
symbols.update(library_symbols_used[library]) symbols.update(library_symbols_used[library])
@@ -590,9 +588,10 @@ while 1: @@ -614,9 +612,10 @@ while 1:
cmd.append(pic_file) cmd.append(pic_file)
cmd.extend(extra_post_obj) cmd.extend(extra_post_obj)
cmd.extend(extra_flags) cmd.extend(extra_flags)

View file

@ -1,6 +1,6 @@
--- a/src/mklibs.py --- a/src/mklibs
+++ b/src/mklibs.py +++ b/src/mklibs
@@ -161,9 +161,10 @@ def undefined_symbols(obj): @@ -162,9 +162,10 @@ def undefined_symbols(obj):
return result return result
class ProvidedSymbol(Symbol): class ProvidedSymbol(Symbol):
@ -12,7 +12,7 @@
def base_names(self): def base_names(self):
ret = [] ret = []
@@ -204,11 +205,15 @@ def provided_symbols(obj): @@ -205,11 +206,15 @@ def provided_symbols(obj):
if version_string.lower() not in ('base', 'none'): if version_string.lower() not in ('base', 'none'):
version = version_string version = version_string
@ -29,7 +29,7 @@
return result return result
@@ -476,6 +481,9 @@ while 1: @@ -500,6 +505,9 @@ while 1:
debug(DEBUG_SPAM, "present_symbols adding %s" % symbol) debug(DEBUG_SPAM, "present_symbols adding %s" % symbol)
names = symbol.base_names() names = symbol.base_names()
for name in names: for name in names:
@ -39,7 +39,7 @@
present_symbols[name] = symbol present_symbols[name] = symbol
# are we finished? # are we finished?
@@ -567,12 +575,16 @@ while 1: @@ -591,12 +599,16 @@ while 1:
# may segfault in ptmalloc_init due to undefined weak reference # may segfault in ptmalloc_init due to undefined weak reference
extra_pre_obj.append(sysroot + libc_extras_dir + "/soinit.o") extra_pre_obj.append(sysroot + libc_extras_dir + "/soinit.o")
extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o") extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")

View file

@ -0,0 +1,20 @@
--- a/src/mklibs-readelf/main.cpp
+++ b/src/mklibs-readelf/main.cpp
@@ -84,7 +84,7 @@ static void process_symbols_provided (co
continue;
if (shndx == SHN_UNDEF || shndx == SHN_ABS)
continue;
- if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_GNU_IFUNC && type != STT_COMMON && type != STT_TLS)
+ if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_COMMON && type != STT_TLS)
continue;
if (!name.size())
continue;
@@ -115,7 +115,7 @@ static void process_symbols_undefined (c
continue;
if (shndx != SHN_UNDEF)
continue;
- if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_GNU_IFUNC && type != STT_COMMON && type != STT_TLS)
+ if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_COMMON && type != STT_TLS)
continue;
if (!name.size())
continue;

View file

@ -0,0 +1,10 @@
--- a/src/mklibs
+++ b/src/mklibs
@@ -263,6 +263,7 @@ def extract_soname(so_file):
return ""
def multiarch(paths):
+ return paths
devnull = open('/dev/null', 'w')
dpkg_architecture = subprocess.Popen(
['dpkg-architecture', '-qDEB_HOST_MULTIARCH'],