summaryrefslogtreecommitdiffstats
path: root/libc/tools
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2014-04-18 16:03:03 -0700
committerDmitriy Ivanov <dimitry@google.com>2014-04-18 17:34:20 -0700
commit6a45fe98727f9ee39386d39fa18eea69c706bc9e (patch)
tree8e675712429d1b78d47fd905d81ab051eb5650b0 /libc/tools
parent0e351e4011bc98cacc3e37292bfb0e86c3a3bb5b (diff)
downloadbionic-6a45fe98727f9ee39386d39fa18eea69c706bc9e.zip
bionic-6a45fe98727f9ee39386d39fa18eea69c706bc9e.tar.gz
bionic-6a45fe98727f9ee39386d39fa18eea69c706bc9e.tar.bz2
Fix for libgcc compat generation script.
Taking into account possibility that external symbol could have been an OBJECT instead of function. b/14090368 Change-Id: Iac173d2dd1309ed53024306578137c26b1dbbf15
Diffstat (limited to 'libc/tools')
-rwxr-xr-xlibc/tools/genlibgcc_compat.py43
1 files changed, 17 insertions, 26 deletions
diff --git a/libc/tools/genlibgcc_compat.py b/libc/tools/genlibgcc_compat.py
index f2ff7b0..cb5c3b3 100755
--- a/libc/tools/genlibgcc_compat.py
+++ b/libc/tools/genlibgcc_compat.py
@@ -71,23 +71,7 @@ import subprocess
import tempfile
import re
-libgcc_compat_header = "/* Generated by genlibgcc_compat.py */\n" + \
-"""
-#define COMPAT_FUNCTIONS_LIST \\
-"""
-
-libgcc_compat_footer = """
-
-#define XX(f) extern void f(void);
-COMPAT_FUNCTIONS_LIST
-#undef XX
-
-void __bionic_libgcc_compat_hooks(void) {
-#define XX(f) f();
-COMPAT_FUNCTIONS_LIST
-#undef XX
-}
-"""
+libgcc_compat_header = "/* Generated by genlibgcc_compat.py */\n\n"
class Generator:
def process(self):
@@ -114,29 +98,36 @@ class Generator:
print "* Build complete, logfile: " + build_output_file_path
- func_set = set()
+ symbol_set = set()
prog=re.compile("(?<=undefined reference to ')\w+")
fd = open(build_output_file_path, 'r')
for line in fd:
m = prog.search(line)
if m:
- func_set.add(m.group(0))
+ symbol_set.add(m.group(0))
fd.close()
- func_list = sorted(func_set)
+ symbol_list = sorted(symbol_set)
- print "* Found " + repr(len(func_list)) + " referenced functions: " + repr(func_list)
+ print "* Found " + repr(len(symbol_list)) + " referenced symbols: " + repr(symbol_list)
- if 0 == len(func_list):
- sys.exit("Error: function list is empty, please check the build log: " + build_output_file_path)
+ if 0 == len(symbol_list):
+ sys.exit("Error: symbol list is empty, please check the build log: " + build_output_file_path)
print "* Generating " + file_path
fres = open(file_path, 'w')
fres.write(libgcc_compat_header)
- for func_name in func_list:
- fres.write(" XX("+func_name+") \\\n")
- fres.write(libgcc_compat_footer)
+
+ for sym_name in symbol_list:
+ fres.write("extern char "+sym_name+";\n")
+ fres.write("\n");
+
+ fres.write("void* __bionic_libgcc_compat_symbols[] = {\n");
+ for sym_name in symbol_list:
+ fres.write(" &"+sym_name+",\n")
+ fres.write("};\n");
+
fres.close()
generator = Generator()