b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/src/mklibs |
| 2 | +++ b/src/mklibs |
| 3 | @@ -472,7 +472,7 @@ while 1: |
| 4 | passnr = passnr + 1 |
| 5 | # Gather all already reduced libraries and treat them as objects as well |
| 6 | small_libs = [] |
| 7 | - for lib in regexpfilter(os.listdir(dest_path), "(.*-so-stripped)$"): |
| 8 | + for lib in regexpfilter(os.listdir(dest_path), "(.*-so)$"): |
| 9 | obj = dest_path + "/" + lib |
| 10 | small_libs.append(obj) |
| 11 | inode = os.stat(obj)[ST_INO] |
| 12 | @@ -588,12 +588,7 @@ while 1: |
| 13 | if not so_file: |
| 14 | sys.exit("File not found:" + library) |
| 15 | pic_file = find_pic(library) |
| 16 | - if not pic_file: |
| 17 | - # No pic file, so we have to use the .so file, no reduction |
| 18 | - debug(DEBUG_VERBOSE, "No pic file found for", so_file, "; copying") |
| 19 | - command(target + "objcopy", "--strip-unneeded -R .note -R .comment", |
| 20 | - so_file, dest_path + "/" + so_file_name + "-so-stripped") |
| 21 | - else: |
| 22 | + if pic_file: |
| 23 | # we have a pic file, recompile |
| 24 | debug(DEBUG_SPAM, "extracting from:", pic_file, "so_file:", so_file) |
| 25 | soname = extract_soname(so_file) |
| 26 | @@ -636,22 +631,14 @@ while 1: |
| 27 | cmd.append(library_depends_gcc_libnames(so_file)) |
| 28 | command(target + "gcc", *cmd) |
| 29 | |
| 30 | - # strip result |
| 31 | - command(target + "objcopy", "--strip-unneeded -R .note -R .comment", |
| 32 | - dest_path + "/" + so_file_name + "-so", |
| 33 | - dest_path + "/" + so_file_name + "-so-stripped") |
| 34 | ## DEBUG |
| 35 | debug(DEBUG_VERBOSE, so_file, "\t", str(os.stat(so_file)[ST_SIZE])) |
| 36 | debug(DEBUG_VERBOSE, dest_path + "/" + so_file_name + "-so", "\t", |
| 37 | str(os.stat(dest_path + "/" + so_file_name + "-so")[ST_SIZE])) |
| 38 | - debug(DEBUG_VERBOSE, dest_path + "/" + so_file_name + "-so-stripped", |
| 39 | - "\t", str(os.stat(dest_path + "/" + so_file_name + "-so-stripped")[ST_SIZE])) |
| 40 | |
| 41 | # Finalising libs and cleaning up |
| 42 | -for lib in regexpfilter(os.listdir(dest_path), "(.*)-so-stripped$"): |
| 43 | - os.rename(dest_path + "/" + lib + "-so-stripped", dest_path + "/" + lib) |
| 44 | -for lib in regexpfilter(os.listdir(dest_path), "(.*-so)$"): |
| 45 | - os.remove(dest_path + "/" + lib) |
| 46 | +for lib in regexpfilter(os.listdir(dest_path), "(.*)-so$"): |
| 47 | + os.rename(dest_path + "/" + lib + "-so", dest_path + "/" + lib) |
| 48 | |
| 49 | # Canonicalize library names. |
| 50 | for lib in sorted(regexpfilter(os.listdir(dest_path), "(.*so[.\d]*)$")): |