[tools] mklibs: import missing symbol workaround from Freetz project (#7590)
[openwrt/svn-archive/archive.git] / tools / mklibs / patches / 009-uclibc_libgcc_link.patch
1 --- a/src/mklibs.py
2 +++ b/src/mklibs.py
3 @@ -560,6 +560,7 @@ while 1:
4 extra_flags = []
5 extra_pre_obj = []
6 extra_post_obj = []
7 + libgcc_link = "-lgcc"
8
9 symbols.update(library_symbols_used[library])
10
11 @@ -575,6 +576,10 @@ while 1:
12 symbols.add(ProvidedSymbol('__uClibc_init', None, None, True))
13 symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True))
14 extra_flags.append("-Wl,-init,__uClibc_init")
15 + libgcc_link = "-lgcc_s_pic"
16 +
17 + if soname in ("libm.so.0"):
18 + libgcc_link = "-lgcc_s_pic"
19
20 map_file = find_pic_map(library)
21 if map_file:
22 @@ -590,7 +595,7 @@ while 1:
23 cmd.append(pic_file)
24 cmd.extend(extra_post_obj)
25 cmd.extend(extra_flags)
26 - cmd.append("-lgcc")
27 + cmd.append(libgcc_link)
28 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 + "/")]])
29 cmd.append(library_depends_gcc_libnames(so_file, soname))
30 command(target + "gcc", *cmd)