[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#469070: marked as done (mklibs patches for cross environment)



Your message dated Wed, 06 May 2009 12:02:05 +0000
with message-id <E1M1fp7-0008Gt-HD@ries.debian.org>
and subject line Bug#469070: fixed in mklibs 0.1.27
has caused the Debian Bug report #469070,
regarding mklibs patches for cross environment
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
469070: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469070
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: mklibs
Severity: wishlist
Tags: patch

This patch series was sent to the mailing list. Create a BR for them
to prevent them being forgotten.

-----
Subject: Re: mklibs patches for cross environment
Date: Monday 25 February 2008
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: debian-boot@lists.debian.org

Here is an updated version of the patch 
<http://lists.debian.org/debian-boot/2008/02/msg00208.html>, with 
additional fixes and split into pieces as requested.  I do not believe 
there are any dependencies between these pieces.

Part 1: Uninitialized data fix, as in previous patch:

Index: src/mklibs-readelf/elf.cpp
===================================================================
--- src/mklibs-readelf/elf.cpp	(revision 51573)
+++ src/mklibs-readelf/elf.cpp	(working copy)
@@ -114,6 +114,9 @@
 
   this->sections.resize (this->shnum);
 
+  section_GNU_VERDEF = NULL;
+  section_GNU_VERNEED = NULL;
+  section_GNU_VERSYM = NULL;
   for (unsigned int i = 0; i < this->shnum; i++)
   {
     section *temp;
@@ -149,6 +152,7 @@
 
   this->segments.resize (this->phnum);
 
+  segment_INTERP = NULL;
   for (unsigned int i = 0; i < this->phnum; i++)
   {
     segment *temp;




Part 2: Endian fix, as in previous patch:

Index: src/mklibs-readelf/elf.cpp
===================================================================
--- src/mklibs-readelf/elf.cpp	(revision 51573)
+++ src/mklibs-readelf/elf.cpp	(working copy)
@@ -376,7 +380,7 @@
   this->versyms.reserve (max);
 
   for (unsigned int i = 0; i < max; i++)
-    this->versyms.push_back (versyms[i]);
+    this->versyms.push_back (convert<_data, typeof (versyms[i])> () (versyms[i]));
 }
 
 template <typename _class, typename _data>




Part 3: Correct diagnostic text when symbol cannot be found, new:

Index: src/mklibs.py
===================================================================
--- src/mklibs.py	(revision 51573)
+++ src/mklibs.py	(working copy)
@@ -469,7 +493,7 @@
     for name in needed_symbols:
         if not name in symbol_provider:
             if not needed_symbols[name].weak:
-                raise "No library provides non-weak %s" % symbol
+                raise "No library provides non-weak %s" % name
         else:
             lib = symbol_provider[name]
             library_symbols_used[lib].add(library_symbols[lib][name])




Part 4: Support running mklibs for a set of binaries including gdbserver 
(which defines symbols left unresolved in libthread_db), new:

Index: src/mklibs.py
===================================================================
--- src/mklibs.py	(revision 51573)
+++ src/mklibs.py	(working copy)
@@ -394,8 +414,12 @@
     libraries = set(force_libs)
     for obj in objects.values():
         for symbol in undefined_symbols(obj):
-            debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s" % (symbol, symbol.weak))
-            needed_symbols[str(symbol)] = symbol
+            # Some undefined symbols in libthread_db are defined in
+            # gdbserver, not in any library.
+            if (not (re.search("libthread_db\.so", obj)
+                     and re.search("^ps_", str(symbol)))):
+                debug(DEBUG_SPAM, "needed_symbols adding %s, weak: %s" % (symbol, symbol.weak))
+                needed_symbols[str(symbol)] = symbol
         libraries.update(library_depends(obj))
 
     # calculate what symbols are present in small_libs and available_libs




Part 5: Sysroot and multilib support, as in the previous patch but with an 
additional fix (-L options pointing to sysroot directories that would be 
searched anyway are bad since they can cause the linker to treat the 
directories as non-sysroot directories):

Index: src/mklibs.1
===================================================================
--- src/mklibs.1	(revision 51573)
+++ src/mklibs.1	(working copy)
@@ -28,6 +28,16 @@
 \fB\-\-target \fITARGET
 Prepend \fITARGET\fB\-\fR to the gcc and binutils calls.
 .TP
+\fB\-\-sysroot \fISYSROOT
+Locate libraries and associated files relative to \fISYSROOT\fR.
+.TP
+\fB\-\-gcc\-options \fIOPTIONS
+Pass \fIOPTIONS\fR to the compiler when relinking.
+.TP
+\fB\-\-libdir \fIDIR
+Use \fIDIR\fR (for example, \fBlib64\fR) in place of \fBlib\fR in
+default library paths.
+.TP
 \fB\-v\fR, \fB\-\-verbose
 Explain what is being done.
 .TP
Index: src/mklibs.py
===================================================================
--- src/mklibs.py	(revision 51573)
+++ src/mklibs.py	(working copy)
@@ -185,8 +185,8 @@
 # Find complete path of a library, by searching in lib_path
 def find_lib(lib):
     for path in lib_path:
-        if os.access(path + "/" + lib, os.F_OK):
-            return path + "/" + lib
+        if os.access(sysroot + path + "/" + lib, os.F_OK):
+            return sysroot + path + "/" + lib
 
     return ""
 
@@ -194,7 +194,7 @@
 def find_pic(lib):
     base_name = so_pattern.match(lib).group(1)
     for path in lib_path:
-        for file in glob.glob(path + "/" + base_name + "_pic.a"):
+        for file in glob.glob(sysroot + path + "/" + base_name + "_pic.a"):
             if os.access(file, os.F_OK):
                 return resolve_link(file)
     return ""
@@ -203,7 +203,7 @@
 def find_pic_map(lib):
     base_name = so_pattern.match(lib).group(1)
     for path in lib_path:
-        for file in glob.glob(path + "/" + base_name + "_pic.map"):
+        for file in glob.glob(sysroot + path + "/" + base_name + "_pic.map"):
             if os.access(file, os.F_OK):
                 return resolve_link(file)
     return ""
@@ -230,6 +230,9 @@
     print >> outfd, "      --libc-extras-dir DIRECTORY  look for libc extra files in DIRECTORY"
     print >> outfd, "      --target TARGET          prepend TARGET- to the gcc and binutils calls"
     print >> outfd, "      --root ROOT              search in ROOT for library rpaths"
+    print >> outfd, "      --sysroot ROOT           prepend ROOT to all paths for libraries"
+    print >> outfd, "      --gcc-options OPTIONS    pass OPTIONS to gcc"
+    print >> outfd, "      --libdir DIR             use DIR (e.g. lib64) in place of lib in default paths"
     print >> outfd, "  -v, --verbose                explain what is being done"
     print >> outfd, "  -h, --help                   display this help and exit"
     sys.exit(was_err)
@@ -264,7 +267,8 @@
 # Argument parsing
 opts = "L:DnvVhd:r:l:"
 longopts = ["no-default-lib", "dry-run", "verbose", "version", "help",
-            "dest-dir=", "ldlib=", "libc-extras-dir=", "target=", "root="]
+            "dest-dir=", "ldlib=", "libc-extras-dir=", "target=", "root=",
+            "sysroot=", "gcc-options=", "libdir="]
 
 # some global variables
 lib_rpath = []
@@ -274,9 +278,13 @@
 include_default_lib_path = "yes"
 default_lib_path = ["/lib/", "/usr/lib/", "/usr/X11R6/lib/"]
 libc_extras_dir = "/usr/lib/libc_pic"
+libc_extras_dir_default = True
+libdir = "lib"
 target = ""
 root = ""
+sysroot = ""
 force_libs = []
+gcc_options = []
 so_pattern = re.compile("((lib|ld).*)\.so(\..+)*")
 script_pattern = re.compile("^#!\s*/")
 
@@ -300,12 +308,19 @@
         ldlib = arg
     elif opt == "--libc-extras-dir":
         libc_extras_dir = arg
+        libc_extras_dir_default = False
     elif opt == "--target":
         target = arg + "-"
     elif opt in ("-r", "--root"):
         root = arg
+    elif opt == "--sysroot":
+        sysroot = arg
     elif opt in ("-l",):
         force_libs.append(arg)
+    elif opt == "--gcc-options":
+        gcc_options.extend(string.split(arg, " "))
+    elif opt == "--libdir":
+        libdir = arg
     elif opt in ("--help", "-h"):
 	usage(0)
         sys.exit(0)
@@ -316,8 +331,11 @@
         print "WARNING: unknown option: " + opt + "\targ: " + arg
 
 if include_default_lib_path == "yes":
-    lib_path.extend(default_lib_path)
+    lib_path.extend([a.replace("/lib/", "/" + libdir + "/") for a in default_lib_path])
 
+if libc_extras_dir_default:
+    libc_extras_dir = libc_extras_dir.replace("/lib/", "/" + libdir + "/")
+
 if ldlib == "LDLIB":
     ldlib = os.getenv("ldlib")
 
@@ -344,6 +362,8 @@
 if not ldlib:
     sys.exit("E: Dynamic linker not found, aborting.")
 
+ldlib = sysroot + ldlib
+
 debug(DEBUG_NORMAL, "I: Using", ldlib, "as dynamic linker.")
 
 # Check for rpaths
@@ -514,8 +538,8 @@
             if soname in ("libc.so.6", "libc.so.6.1"):
                 # force dso_handle.os to be included, otherwise reduced libc
                 # may segfault in ptmalloc_init due to undefined weak reference
-                extra_pre_obj.append(libc_extras_dir + "/soinit.o")
-                extra_post_obj.append(libc_extras_dir + "/sofini.o")
+                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', 'Base', True))
 
             map_file = find_pic_map(library)
@@ -524,6 +548,7 @@
 
             # compile in only used symbols
             cmd = []
+            cmd.extend(gcc_options)
             cmd.append("-nostdlib -nostartfiles -shared -Wl,-soname=" + soname)
             cmd.extend(["-u%s" % a.linker_name() for a in symbols])
             cmd.extend(["-o", dest_path + "/" + so_file_name + "-so"])
@@ -532,7 +557,7 @@
             cmd.extend(extra_post_obj)
             cmd.extend(extra_flags)
             cmd.append("-lgcc")
-            cmd.extend(["-L%s" % a for a in [dest_path] + lib_path])
+            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))
             command(target + "gcc", *cmd)
 

-- 
Joseph S. Myers
joseph@codesourcery.com



--- End Message ---
--- Begin Message ---
Source: mklibs
Source-Version: 0.1.27

We believe that the bug you reported is fixed in the latest version of
mklibs, which is due to be installed in the Debian FTP archive:

mklibs-copy_0.1.27_i386.deb
  to pool/main/m/mklibs/mklibs-copy_0.1.27_i386.deb
mklibs_0.1.27.dsc
  to pool/main/m/mklibs/mklibs_0.1.27.dsc
mklibs_0.1.27.tar.gz
  to pool/main/m/mklibs/mklibs_0.1.27.tar.gz
mklibs_0.1.27_all.deb
  to pool/main/m/mklibs/mklibs_0.1.27_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 469070@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Bastian Blank <waldi@debian.org> (supplier of updated mklibs package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 06 May 2009 13:56:04 +0200
Source: mklibs
Binary: mklibs mklibs-copy
Architecture: source all i386
Version: 0.1.27
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Bastian Blank <waldi@debian.org>
Description: 
 mklibs     - Shared library reduction script
 mklibs-copy - Shared library reduction script
Closes: 469070 499744 505025 508929 518088
Changes: 
 mklibs (0.1.27) unstable; urgency=low
 .
   [ Joey Hess ]
   * Apply patches from Joseph S. Myers (closes: #469070):
     - mklibs-readelf: Uninitialized data fix
     - mklibs-readelf: Endian fix
     - mklibs: Add --sysroot, to locate all libraries and other related input
       files relative to a specified root directory rather than /.
     - mklibs: Add --gcc-options and --libdir options as well.
     - mklibs: Correct diagnostic text when symbol cannot be found.
     - mklibs: Ignore missing symbols from libthread_db, which are defined
       in the application that uses it.
   * Document --root in the man page.
 .
   [ Frans Pop ]
   * Apply patches from Joseph S. Myers:
     - Ignore the fact that symbol __gnu_local_gp is undefined for mips as it
       is defined by the linker. Thanks to Joseph S. Myers. Closes: #499744.
   * Remove myself as uploader.
 .
   [ Martin Michlmayr ]
   * mklibs-readelf: add missing header to avoid build error with GCC 4.4.
     Closes: #505025.
 .
   [ Bastian Blank ]
   * Support file definitions in version requirements. Based on patch by Andrew
     Stubbs <ams@codesourcery.com>. (closes: #508929)
   * Various cleanups.
   * Ignore symbols with empty names. (closes: #518088)
Checksums-Sha1: 
 e7b3c9c88e570c512290cf905745d1b6e4821fb1 969 mklibs_0.1.27.dsc
 bbf12828d09af12df501b5a748ff544c2bf3e25a 113602 mklibs_0.1.27.tar.gz
 d0b6804b85de9a532a839edc717f5e590f8a31bc 12988 mklibs_0.1.27_all.deb
 c7106ccb17e136d678a9d677d9b3da16bdb89bc5 44700 mklibs-copy_0.1.27_i386.deb
Checksums-Sha256: 
 1d6722106dd092c22e9839b668ae1a7dfb29036a3322f61b993d7e6944041f93 969 mklibs_0.1.27.dsc
 9eb44b5106f4c0d243c3c28e9c7f0d21667a6207ea32b2508936591cbed2519d 113602 mklibs_0.1.27.tar.gz
 9827873656f4bc7f7e74857e9b8c8fee94d0a0c7ed1b460114c94b2ad0631d24 12988 mklibs_0.1.27_all.deb
 f4e91935144cff23f1e53e77562f0e85b795b42d0d38b3da24ed0701a21a28a0 44700 mklibs-copy_0.1.27_i386.deb
Files: 
 c0bfa4e721e2c755ec3bf37d884c146e 969 devel optional mklibs_0.1.27.dsc
 ce906873efcf84c401479e9c10279660 113602 devel optional mklibs_0.1.27.tar.gz
 c55b104408f866f03dde78c1f98cfc38 12988 devel optional mklibs_0.1.27_all.deb
 5769bcf8e7eb2e61d148f250d4affaa7 44700 devel optional mklibs-copy_0.1.27_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoBevAACgkQLkAIIn9ODhHgRwCgwtG5By62ROiWiQlqHgLYPFX2
Qm4AoLIkyC1t1Q5C+ARLI81OMgk4ldEb
=L9ab
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: