Merge "Fix for libgcc compat generation script."

This commit is contained in:
Dmitriy Ivanov 2014-04-19 01:12:58 +00:00 committed by Gerrit Code Review
commit 6d09ec3c2f
3 changed files with 173 additions and 115 deletions

View file

@ -724,7 +724,6 @@ LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_ARM_MODE := arm # Work around arm linker bug http://b/14090368.
LOCAL_MODULE := libc_common
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_WHOLE_STATIC_LIBRARIES := \

View file

@ -1,91 +1,159 @@
/* Generated by genlibgcc_compat.py */
#define COMPAT_FUNCTIONS_LIST \
XX(__adddf3) \
XX(__addsf3) \
XX(__aeabi_cdcmpeq) \
XX(__aeabi_cdcmple) \
XX(__aeabi_cdrcmple) \
XX(__aeabi_d2f) \
XX(__aeabi_d2iz) \
XX(__aeabi_dadd) \
XX(__aeabi_dcmpeq) \
XX(__aeabi_dcmpge) \
XX(__aeabi_dcmpgt) \
XX(__aeabi_dcmple) \
XX(__aeabi_dcmplt) \
XX(__aeabi_dcmpun) \
XX(__aeabi_ddiv) \
XX(__aeabi_dmul) \
XX(__aeabi_drsub) \
XX(__aeabi_dsub) \
XX(__aeabi_f2d) \
XX(__aeabi_f2iz) \
XX(__aeabi_f2uiz) \
XX(__aeabi_fadd) \
XX(__aeabi_fcmpun) \
XX(__aeabi_fdiv) \
XX(__aeabi_fmul) \
XX(__aeabi_frsub) \
XX(__aeabi_fsub) \
XX(__aeabi_i2d) \
XX(__aeabi_i2f) \
XX(__aeabi_idiv) \
XX(__aeabi_idivmod) \
XX(__aeabi_l2d) \
XX(__aeabi_l2f) \
XX(__aeabi_lasr) \
XX(__aeabi_ldivmod) \
XX(__aeabi_llsl) \
XX(__aeabi_llsr) \
XX(__aeabi_lmul) \
XX(__aeabi_ui2d) \
XX(__aeabi_ui2f) \
XX(__aeabi_uidiv) \
XX(__aeabi_uidivmod) \
XX(__aeabi_ul2d) \
XX(__aeabi_ul2f) \
XX(__aeabi_uldivmod) \
XX(__aeabi_unwind_cpp_pr0) \
XX(__aeabi_unwind_cpp_pr1) \
XX(__cmpdf2) \
XX(__divdf3) \
XX(__divsf3) \
XX(__eqdf2) \
XX(__extendsfdf2) \
XX(__fixdfsi) \
XX(__fixsfsi) \
XX(__floatdidf) \
XX(__floatdisf) \
XX(__floatsidf) \
XX(__floatsisf) \
XX(__floatundidf) \
XX(__floatundisf) \
XX(__floatunsidf) \
XX(__floatunsisf) \
XX(__gedf2) \
XX(__gtdf2) \
XX(__ledf2) \
XX(__ltdf2) \
XX(__muldf3) \
XX(__muldi3) \
XX(__mulsf3) \
XX(__nedf2) \
XX(__popcount_tab) \
XX(__popcountsi2) \
XX(__subdf3) \
XX(__subsf3) \
XX(__truncdfsf2) \
XX(__unorddf2) \
XX(__unordsf2) \
extern char __adddf3;
extern char __addsf3;
extern char __aeabi_cdcmpeq;
extern char __aeabi_cdcmple;
extern char __aeabi_cdrcmple;
extern char __aeabi_d2f;
extern char __aeabi_d2iz;
extern char __aeabi_dadd;
extern char __aeabi_dcmpeq;
extern char __aeabi_dcmpge;
extern char __aeabi_dcmpgt;
extern char __aeabi_dcmple;
extern char __aeabi_dcmplt;
extern char __aeabi_dcmpun;
extern char __aeabi_ddiv;
extern char __aeabi_dmul;
extern char __aeabi_drsub;
extern char __aeabi_dsub;
extern char __aeabi_f2d;
extern char __aeabi_f2iz;
extern char __aeabi_f2uiz;
extern char __aeabi_fadd;
extern char __aeabi_fcmpun;
extern char __aeabi_fdiv;
extern char __aeabi_fmul;
extern char __aeabi_frsub;
extern char __aeabi_fsub;
extern char __aeabi_i2d;
extern char __aeabi_i2f;
extern char __aeabi_idiv;
extern char __aeabi_idivmod;
extern char __aeabi_l2d;
extern char __aeabi_l2f;
extern char __aeabi_lasr;
extern char __aeabi_ldivmod;
extern char __aeabi_llsl;
extern char __aeabi_llsr;
extern char __aeabi_lmul;
extern char __aeabi_ui2d;
extern char __aeabi_ui2f;
extern char __aeabi_uidiv;
extern char __aeabi_uidivmod;
extern char __aeabi_ul2d;
extern char __aeabi_ul2f;
extern char __aeabi_uldivmod;
extern char __aeabi_unwind_cpp_pr0;
extern char __aeabi_unwind_cpp_pr1;
extern char __cmpdf2;
extern char __divdf3;
extern char __divsf3;
extern char __eqdf2;
extern char __extendsfdf2;
extern char __fixdfsi;
extern char __fixsfsi;
extern char __floatdidf;
extern char __floatdisf;
extern char __floatsidf;
extern char __floatsisf;
extern char __floatundidf;
extern char __floatundisf;
extern char __floatunsidf;
extern char __floatunsisf;
extern char __gedf2;
extern char __gtdf2;
extern char __ledf2;
extern char __ltdf2;
extern char __muldf3;
extern char __muldi3;
extern char __mulsf3;
extern char __nedf2;
extern char __popcount_tab;
extern char __popcountsi2;
extern char __subdf3;
extern char __subsf3;
extern char __truncdfsf2;
extern char __unorddf2;
extern char __unordsf2;
#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
}
void* __bionic_libgcc_compat_symbols[] = {
&__adddf3,
&__addsf3,
&__aeabi_cdcmpeq,
&__aeabi_cdcmple,
&__aeabi_cdrcmple,
&__aeabi_d2f,
&__aeabi_d2iz,
&__aeabi_dadd,
&__aeabi_dcmpeq,
&__aeabi_dcmpge,
&__aeabi_dcmpgt,
&__aeabi_dcmple,
&__aeabi_dcmplt,
&__aeabi_dcmpun,
&__aeabi_ddiv,
&__aeabi_dmul,
&__aeabi_drsub,
&__aeabi_dsub,
&__aeabi_f2d,
&__aeabi_f2iz,
&__aeabi_f2uiz,
&__aeabi_fadd,
&__aeabi_fcmpun,
&__aeabi_fdiv,
&__aeabi_fmul,
&__aeabi_frsub,
&__aeabi_fsub,
&__aeabi_i2d,
&__aeabi_i2f,
&__aeabi_idiv,
&__aeabi_idivmod,
&__aeabi_l2d,
&__aeabi_l2f,
&__aeabi_lasr,
&__aeabi_ldivmod,
&__aeabi_llsl,
&__aeabi_llsr,
&__aeabi_lmul,
&__aeabi_ui2d,
&__aeabi_ui2f,
&__aeabi_uidiv,
&__aeabi_uidivmod,
&__aeabi_ul2d,
&__aeabi_ul2f,
&__aeabi_uldivmod,
&__aeabi_unwind_cpp_pr0,
&__aeabi_unwind_cpp_pr1,
&__cmpdf2,
&__divdf3,
&__divsf3,
&__eqdf2,
&__extendsfdf2,
&__fixdfsi,
&__fixsfsi,
&__floatdidf,
&__floatdisf,
&__floatsidf,
&__floatsisf,
&__floatundidf,
&__floatundisf,
&__floatunsidf,
&__floatunsisf,
&__gedf2,
&__gtdf2,
&__ledf2,
&__ltdf2,
&__muldf3,
&__muldi3,
&__mulsf3,
&__nedf2,
&__popcount_tab,
&__popcountsi2,
&__subdf3,
&__subsf3,
&__truncdfsf2,
&__unorddf2,
&__unordsf2,
};

View file

@ -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()