diff --git a/libc-test/src/math/test_src_math.gni b/libc-test/src/math/test_src_math.gni index 055c63f154fca79b898b7d28f94d1e7220dd59f1..5e5e58d7d24d0f5f11a3cdc9ef23dbd021fe200d 100644 --- a/libc-test/src/math/test_src_math.gni +++ b/libc-test/src/math/test_src_math.gni @@ -91,7 +91,6 @@ math_list = [ "j0", "j0f", "j1", - "j1f", "jn", "jnf", "ldexp", diff --git a/musl_template.gni b/musl_template.gni index 53fef9b40a901fafb2dd739dff0c35cd9ac118f6..6eb6305448857f0545120462a801958ed55113d9 100644 --- a/musl_template.gni +++ b/musl_template.gni @@ -134,8 +134,6 @@ template("musl_libs") { cflags_c99fse = [ "-std=c99", "-nostdinc", - "-ffreestanding", - "-frounding-math", "-Wa,--noexecstack", ] @@ -292,6 +290,7 @@ template("musl_libs") { configs += [ ":soft_musl_config" ] cflags = [ "-fPIC", + "-ffreestanding", "-fno-stack-protector", ] @@ -341,6 +340,8 @@ template("musl_libs") { "src/math/pow.c", "src/math/powf.c", "src/math/powl.c", + "src/math/sinf.c", + "src/math/cosf.c", ] } else if (musl_arch == "aarch64") { sources_orig -= [ @@ -358,6 +359,23 @@ template("musl_libs") { "src/string/strnlen.c", "src/string/strncmp.c", "src/math/sincosf.c", + "src/math/sinf.c", + "src/math/cosf.c", + "src/math/cos.c", + "src/math/exp.c", + "src/math/exp2.c", + "src/math/exp2f.c", + "src/math/expf.c", + "src/math/log.c", + "src/math/log10.c", + "src/math/log2.c", + "src/math/log2f.c", + "src/math/logb.c", + "src/math/logf.c", + "src/math/sin.c", + "src/math/sincos.c", + "src/math/pow.c", + "src/math/powf.c", ] } else if (musl_arch == "x86_64") { sources_orig -= [ "src/thread/${musl_arch}/__set_thread_area.s" ] @@ -382,6 +400,7 @@ template("musl_libs") { } if (musl_arch == "arm") { sources += [ + "$OPTRTDIR/math/cosf.c", "$OPTRTDIR/math/exp2.c", "$OPTRTDIR/math/exp2f.c", "$OPTRTDIR/math/exp2f_data.c", @@ -398,6 +417,7 @@ template("musl_libs") { "$OPTRTDIR/math/powf.c", "$OPTRTDIR/math/sincosf.c", "$OPTRTDIR/math/sincosf_data.c", + "$OPTRTDIR/math/sinf.c", "$OPTRTDIR/string/arm/memchr.S", "$OPTRTDIR/string/arm/memcpy.S", "$OPTRTDIR/string/arm/memset.S", @@ -412,10 +432,6 @@ template("musl_libs") { "-D__strlen_armv6t2 = strlen", ] } else if (musl_arch == "aarch64") { - sources += [ - "$OPTRTDIR/math/sincosf.c", - "$OPTRTDIR/math/sincosf_data.c", - ] if (defined(ARM_FEATURE_SVE)) { sources += [ "$OPTRTDIR/string/aarch64/memchr-sve.S", @@ -510,6 +526,7 @@ template("musl_libs") { cflags = [ "-O3", "-fPIC", + "-ffreestanding", "-fstack-protector-strong", ] @@ -543,6 +560,57 @@ template("musl_libs") { } } + source_set("soft_musl_src_optimize") { + sources = [] + sources_orig = [] + + if (musl_arch == "aarch64") { + sources_orig += [ + "src/math/cos.c", + "src/math/exp.c", + "src/math/exp2.c", + "src/math/exp2f.c", + "src/math/expf.c", + "src/math/log.c", + "src/math/log10.c", + "src/math/log2.c", + "src/math/log2f.c", + "src/math/logb.c", + "src/math/logf.c", + "src/math/sin.c", + "src/math/sincos.c", + "src/math/pow.c", + "src/math/powf.c", + ] + } + + foreach(s, sources_orig) { + sources += [ "${target_out_dir}/${musl_ported_dir}/${s}" ] + } + + if (musl_arch == "aarch64") { + sources += [ + "$OPTRTDIR/math/cosf.c", + "$OPTRTDIR/math/sincosf.c", + "$OPTRTDIR/math/sincosf_data.c", + "$OPTRTDIR/math/sinf.c", + ] + } + + configs -= musl_inherited_configs + configs += [ ":soft_musl_config" ] + cflags = [ + "-mllvm", + "-instcombine-max-iterations=0", + "-ffp-contract=fast", + "-O3", + "-fPIC", + "-fstack-protector-strong", + ] + + deps = porting_deps + } + source_set("soft_musl_src_nossp") { sources = [] sources_orig = [ @@ -572,6 +640,7 @@ template("musl_libs") { cflags = [ "-O3", "-fPIC", + "-ffreestanding", "-fno-stack-protector", ] @@ -590,6 +659,7 @@ template("musl_libs") { configs += [ ":soft_musl_config" ] cflags = [ "-fPIC", + "-ffreestanding", "-fno-stack-protector", ] if (is_asan) { @@ -673,6 +743,7 @@ template("musl_libs") { ":soft_musl_ldso", ":soft_musl_src", ":soft_musl_src_nossp", + ":soft_musl_src_optimize", ] deps += dfx_deps if (!startup_init_with_param_base) { @@ -773,6 +844,7 @@ template("musl_libs") { ":soft_musl_ldso", ":soft_musl_src", ":soft_musl_src_nossp", + ":soft_musl_src_optimize", ] deps += dfx_deps if (!startup_init_with_param_base) {