d201821fc6bfa2b3fe8608b81c5e6ec6e20c1b4b
[openwrt.git] / tools / mklibs / patches / 009-uclibc_libgcc_link.patch
1 --- a/src/mklibs.py
2 +++ b/src/mklibs.py
3 @@ -112,11 +112,8 @@ def library_depends_gcc_libnames(obj, so
4      ret = []
5      for i in libs:
6          match = re.match("^(((?P<ld>ld\S*)|(lib(?P<lib>\S+))))\.so.*$", i)
7 -        if match and not soname in ("libpthread.so.0"):
8 -            if match.group('ld'):
9 -                ret.append(find_lib(match.group(0)))
10 -            elif match.group('lib'):
11 -                ret.append('-l%s' % match.group('lib'))
12 +        if match:
13 +            ret.append(find_lib(match.group(0)))
14      return ' '.join(ret)
15  
16  class Symbol(object):
17 @@ -560,6 +557,7 @@ while 1:
18              extra_flags = []
19              extra_pre_obj = []
20              extra_post_obj = []
21 +            libgcc_link = find_lib("libgcc_s.so.1")
22  
23              symbols.update(library_symbols_used[library])
24  
25 @@ -590,9 +588,11 @@ while 1:
26              cmd.append(pic_file)
27              cmd.extend(extra_post_obj)
28              cmd.extend(extra_flags)
29 -            cmd.append("-lgcc")
30              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 + "/")]])
31 -            cmd.append(library_depends_gcc_libnames(so_file, soname))
32 +            if soname != "libgcc_s.so.1" and soname != "libc.so.0":
33 +                cmd.append(library_depends_gcc_libnames(so_file, soname))
34 +            if soname != "libgcc_s.so.1":
35 +                cmd.append(libgcc_link)
36              command(target + "gcc", *cmd)
37  
38              ## DEBUG