未验证 提交 4d7af9b6 编写于 作者: O openharmony_ci 提交者: Gitee

!267 M核C库性能优化

Merge pull request !267 from Zhaotianyu/0314libc_opt
......@@ -27,6 +27,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//kernel/liteos_m/liteos.gni")
import("//third_party/optimized-routines/optimized-routines.gni")
import("musl.gni")
libc = "musl-c"
libm = "musl-m"
......@@ -37,133 +41,7 @@ config("include") {
}
static_library(libc) {
sources = [
"src/ctype/__ctype_get_mb_cur_max.c",
"src/ctype/isalnum.c",
"src/ctype/isascii.c",
"src/ctype/isdigit.c",
"src/ctype/islower.c",
"src/ctype/isprint.c",
"src/ctype/isspace.c",
"src/ctype/isupper.c",
"src/ctype/isxdigit.c",
"src/ctype/tolower.c",
"src/ctype/toupper.c",
"src/env/__stack_chk_fail.c",
"src/errno/strerror.c",
"src/exit/abort.c",
"src/exit/assert.c",
"src/exit/atexit.c",
"src/internal/floatscan.c",
"src/internal/intscan.c",
"src/internal/shgetc.c",
"src/locale/__lctrans.c",
"src/locale/c_locale.c",
"src/locale/iconv.c",
"src/locale/langinfo.c",
"src/misc/dirname.c",
"src/misc/realpath.c",
"src/multibyte/internal.c",
"src/multibyte/mbtowc.c",
"src/multibyte/wcrtomb.c",
"src/multibyte/wctomb.c",
"src/network/h_errno.c",
"src/network/htonl.c",
"src/network/htons.c",
"src/network/ntohl.c",
"src/network/ntohs.c",
"src/prng/rand.c",
"src/prng/random.c",
"src/regex/regcomp.c",
"src/regex/regexec.c",
"src/regex/tre-mem.c",
"src/stdio/__fdopen.c",
"src/stdio/__fmodeflags.c",
"src/stdio/__lockfile.c",
"src/stdio/__overflow.c",
"src/stdio/__stdio_close.c",
"src/stdio/__stdio_read.c",
"src/stdio/__stdio_seek.c",
"src/stdio/__stdio_write.c",
"src/stdio/__stdout_write.c",
"src/stdio/__toread.c",
"src/stdio/__towrite.c",
"src/stdio/__uflow.c",
"src/stdio/clearerr.c",
"src/stdio/fclose.c",
"src/stdio/feof.c",
"src/stdio/fflush.c",
"src/stdio/fgetc.c",
"src/stdio/fgets.c",
"src/stdio/fileno.c",
"src/stdio/fopen.c",
"src/stdio/fputc.c",
"src/stdio/fputs.c",
"src/stdio/fread.c",
"src/stdio/fseek.c",
"src/stdio/ftell.c",
"src/stdio/fwrite.c",
"src/stdio/ofl.c",
"src/stdio/ofl_add.c",
"src/stdio/perror.c",
"src/stdio/remove.c",
"src/stdio/rewind.c",
"src/stdio/snprintf.c",
"src/stdio/stderr.c",
"src/stdio/stdin.c",
"src/stdio/stdout.c",
"src/stdio/ungetc.c",
"src/stdio/vfprintf.c",
"src/stdio/vsnprintf.c",
"src/stdio/vsprintf.c",
"src/stdlib/abs.c",
"src/stdlib/atof.c",
"src/stdlib/atoi.c",
"src/stdlib/atol.c",
"src/stdlib/atoll.c",
"src/stdlib/bsearch.c",
"src/stdlib/llabs.c",
"src/stdlib/strtod.c",
"src/stdlib/strtol.c",
"src/string/memchr.c",
"src/string/memcmp.c",
"src/string/memcpy.c",
"src/string/memmove.c",
"src/string/memrchr.c",
"src/string/memset.c",
"src/string/stpcpy.c",
"src/string/stpncpy.c",
"src/string/strcasecmp.c",
"src/string/strcat.c",
"src/string/strchr.c",
"src/string/strchrnul.c",
"src/string/strcmp.c",
"src/string/strcpy.c",
"src/string/strcspn.c",
"src/string/strdup.c",
"src/string/strlen.c",
"src/string/strncasecmp.c",
"src/string/strncat.c",
"src/string/strncmp.c",
"src/string/strncpy.c",
"src/string/strnlen.c",
"src/string/strrchr.c",
"src/string/strspn.c",
"src/string/strstr.c",
"src/string/strtok.c",
"src/string/wcschr.c",
"src/string/wcslen.c",
"src/time/__month_to_secs.c",
"src/time/__secs_to_tm.c",
"src/time/__tm_to_secs.c",
"src/time/__tz.c",
"src/time/__year_to_secs.c",
"src/time/asctime.c",
"src/time/asctime_r.c",
"src/time/ctime.c",
"src/time/strftime.c",
"src/time/strptime.c",
]
sources = MUSL_LIBC_SRC
include_dirs = [
"src/include",
......@@ -181,44 +59,28 @@ static_library(libc) {
"$LITEOS_MENUCONFIG_H",
]
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
if (LOSCFG_ARCH_ARM_VER == "armv7-m" || LOSCFG_ARCH_ARM_VER == "armv8-m") {
sources -= [
"$MUSLPORTINGDIR/src/string/strcpy.c",
"$MUSLPORTINGDIR/src/string/strlen.c",
]
sources += OPTRT_STRING_ARM_SRC_FILES_FOR_ARMV7_M
asmflags = [ "-D__strlen_armv6t2=strlen" ]
if (defined(LOSCFG_KERNEL_LMS)) {
asmflags += [ "-D__strcpy_arm=__strcpy" ]
} else {
asmflags += [ "-D__strcpy_arm=strcpy" ]
}
cflags += asmflags
}
}
public_configs = [ ":include" ]
}
static_library(libm) {
sources = [
"src/math/__fpclassify.c",
"src/math/__fpclassifyl.c",
"src/math/__math_divzero.c",
"src/math/__math_divzerof.c",
"src/math/__math_invalid.c",
"src/math/__math_invalidf.c",
"src/math/__math_oflow.c",
"src/math/__math_oflowf.c",
"src/math/__math_uflow.c",
"src/math/__math_uflowf.c",
"src/math/__math_xflow.c",
"src/math/__math_xflowf.c",
"src/math/__signbit.c",
"src/math/__signbitl.c",
"src/math/arm/fabs.c",
"src/math/copysign.c",
"src/math/copysignl.c",
"src/math/exp_data.c",
"src/math/fabsl.c",
"src/math/floor.c",
"src/math/fmod.c",
"src/math/fmodl.c",
"src/math/frexp.c",
"src/math/frexpl.c",
"src/math/log.c",
"src/math/log_data.c",
"src/math/pow.c",
"src/math/pow_data.c",
"src/math/round.c",
"src/math/scalbn.c",
"src/math/scalbnl.c",
"src/math/sqrt.c",
]
sources = MUSL_LIBM_SRC
include_dirs = [
"src/include",
......
......@@ -26,4 +26,169 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MUSL_INCLUDE_DIRS = [ "//third_party/musl/porting/liteos_m/kernel/include" ]
MUSLPORTINGDIR = get_path_info(".", "abspath")
MUSL_INCLUDE_DIRS = [ "$MUSLPORTINGDIR/include" ]
MUSL_LIBC_SRC = [
"$MUSLPORTINGDIR/src/ctype/__ctype_get_mb_cur_max.c",
"$MUSLPORTINGDIR/src/ctype/isalnum.c",
"$MUSLPORTINGDIR/src/ctype/isascii.c",
"$MUSLPORTINGDIR/src/ctype/isdigit.c",
"$MUSLPORTINGDIR/src/ctype/islower.c",
"$MUSLPORTINGDIR/src/ctype/isprint.c",
"$MUSLPORTINGDIR/src/ctype/isspace.c",
"$MUSLPORTINGDIR/src/ctype/isupper.c",
"$MUSLPORTINGDIR/src/ctype/isxdigit.c",
"$MUSLPORTINGDIR/src/ctype/tolower.c",
"$MUSLPORTINGDIR/src/ctype/toupper.c",
"$MUSLPORTINGDIR/src/env/__stack_chk_fail.c",
"$MUSLPORTINGDIR/src/errno/strerror.c",
"$MUSLPORTINGDIR/src/exit/abort.c",
"$MUSLPORTINGDIR/src/exit/assert.c",
"$MUSLPORTINGDIR/src/exit/atexit.c",
"$MUSLPORTINGDIR/src/internal/floatscan.c",
"$MUSLPORTINGDIR/src/internal/intscan.c",
"$MUSLPORTINGDIR/src/internal/shgetc.c",
"$MUSLPORTINGDIR/src/locale/__lctrans.c",
"$MUSLPORTINGDIR/src/locale/c_locale.c",
"$MUSLPORTINGDIR/src/locale/iconv.c",
"$MUSLPORTINGDIR/src/locale/langinfo.c",
"$MUSLPORTINGDIR/src/misc/dirname.c",
"$MUSLPORTINGDIR/src/misc/realpath.c",
"$MUSLPORTINGDIR/src/multibyte/internal.c",
"$MUSLPORTINGDIR/src/multibyte/mbtowc.c",
"$MUSLPORTINGDIR/src/multibyte/wcrtomb.c",
"$MUSLPORTINGDIR/src/multibyte/wctomb.c",
"$MUSLPORTINGDIR/src/network/h_errno.c",
"$MUSLPORTINGDIR/src/network/htonl.c",
"$MUSLPORTINGDIR/src/network/htons.c",
"$MUSLPORTINGDIR/src/network/ntohl.c",
"$MUSLPORTINGDIR/src/network/ntohs.c",
"$MUSLPORTINGDIR/src/prng/rand.c",
"$MUSLPORTINGDIR/src/prng/random.c",
"$MUSLPORTINGDIR/src/regex/regcomp.c",
"$MUSLPORTINGDIR/src/regex/regexec.c",
"$MUSLPORTINGDIR/src/regex/tre-mem.c",
"$MUSLPORTINGDIR/src/stdio/__fdopen.c",
"$MUSLPORTINGDIR/src/stdio/__fmodeflags.c",
"$MUSLPORTINGDIR/src/stdio/__lockfile.c",
"$MUSLPORTINGDIR/src/stdio/__overflow.c",
"$MUSLPORTINGDIR/src/stdio/__stdio_close.c",
"$MUSLPORTINGDIR/src/stdio/__stdio_read.c",
"$MUSLPORTINGDIR/src/stdio/__stdio_seek.c",
"$MUSLPORTINGDIR/src/stdio/__stdio_write.c",
"$MUSLPORTINGDIR/src/stdio/__stdout_write.c",
"$MUSLPORTINGDIR/src/stdio/__toread.c",
"$MUSLPORTINGDIR/src/stdio/__towrite.c",
"$MUSLPORTINGDIR/src/stdio/__uflow.c",
"$MUSLPORTINGDIR/src/stdio/clearerr.c",
"$MUSLPORTINGDIR/src/stdio/fclose.c",
"$MUSLPORTINGDIR/src/stdio/feof.c",
"$MUSLPORTINGDIR/src/stdio/fflush.c",
"$MUSLPORTINGDIR/src/stdio/fgetc.c",
"$MUSLPORTINGDIR/src/stdio/fgets.c",
"$MUSLPORTINGDIR/src/stdio/fileno.c",
"$MUSLPORTINGDIR/src/stdio/fopen.c",
"$MUSLPORTINGDIR/src/stdio/fputc.c",
"$MUSLPORTINGDIR/src/stdio/fputs.c",
"$MUSLPORTINGDIR/src/stdio/fread.c",
"$MUSLPORTINGDIR/src/stdio/fseek.c",
"$MUSLPORTINGDIR/src/stdio/ftell.c",
"$MUSLPORTINGDIR/src/stdio/fwrite.c",
"$MUSLPORTINGDIR/src/stdio/ofl.c",
"$MUSLPORTINGDIR/src/stdio/ofl_add.c",
"$MUSLPORTINGDIR/src/stdio/perror.c",
"$MUSLPORTINGDIR/src/stdio/remove.c",
"$MUSLPORTINGDIR/src/stdio/rewind.c",
"$MUSLPORTINGDIR/src/stdio/snprintf.c",
"$MUSLPORTINGDIR/src/stdio/stderr.c",
"$MUSLPORTINGDIR/src/stdio/stdin.c",
"$MUSLPORTINGDIR/src/stdio/stdout.c",
"$MUSLPORTINGDIR/src/stdio/ungetc.c",
"$MUSLPORTINGDIR/src/stdio/vfprintf.c",
"$MUSLPORTINGDIR/src/stdio/vsnprintf.c",
"$MUSLPORTINGDIR/src/stdio/vsprintf.c",
"$MUSLPORTINGDIR/src/stdlib/abs.c",
"$MUSLPORTINGDIR/src/stdlib/atof.c",
"$MUSLPORTINGDIR/src/stdlib/atoi.c",
"$MUSLPORTINGDIR/src/stdlib/atol.c",
"$MUSLPORTINGDIR/src/stdlib/atoll.c",
"$MUSLPORTINGDIR/src/stdlib/bsearch.c",
"$MUSLPORTINGDIR/src/stdlib/llabs.c",
"$MUSLPORTINGDIR/src/stdlib/strtod.c",
"$MUSLPORTINGDIR/src/stdlib/strtol.c",
"$MUSLPORTINGDIR/src/string/memchr.c",
"$MUSLPORTINGDIR/src/string/memcmp.c",
"$MUSLPORTINGDIR/src/string/memcpy.c",
"$MUSLPORTINGDIR/src/string/memmove.c",
"$MUSLPORTINGDIR/src/string/memrchr.c",
"$MUSLPORTINGDIR/src/string/memset.c",
"$MUSLPORTINGDIR/src/string/stpcpy.c",
"$MUSLPORTINGDIR/src/string/stpncpy.c",
"$MUSLPORTINGDIR/src/string/strcasecmp.c",
"$MUSLPORTINGDIR/src/string/strcat.c",
"$MUSLPORTINGDIR/src/string/strchr.c",
"$MUSLPORTINGDIR/src/string/strchrnul.c",
"$MUSLPORTINGDIR/src/string/strcmp.c",
"$MUSLPORTINGDIR/src/string/strcpy.c",
"$MUSLPORTINGDIR/src/string/strcspn.c",
"$MUSLPORTINGDIR/src/string/strdup.c",
"$MUSLPORTINGDIR/src/string/strlen.c",
"$MUSLPORTINGDIR/src/string/strncasecmp.c",
"$MUSLPORTINGDIR/src/string/strncat.c",
"$MUSLPORTINGDIR/src/string/strncmp.c",
"$MUSLPORTINGDIR/src/string/strncpy.c",
"$MUSLPORTINGDIR/src/string/strnlen.c",
"$MUSLPORTINGDIR/src/string/strrchr.c",
"$MUSLPORTINGDIR/src/string/strspn.c",
"$MUSLPORTINGDIR/src/string/strstr.c",
"$MUSLPORTINGDIR/src/string/strtok.c",
"$MUSLPORTINGDIR/src/string/wcschr.c",
"$MUSLPORTINGDIR/src/string/wcslen.c",
"$MUSLPORTINGDIR/src/time/__month_to_secs.c",
"$MUSLPORTINGDIR/src/time/__secs_to_tm.c",
"$MUSLPORTINGDIR/src/time/__tm_to_secs.c",
"$MUSLPORTINGDIR/src/time/__tz.c",
"$MUSLPORTINGDIR/src/time/__year_to_secs.c",
"$MUSLPORTINGDIR/src/time/asctime.c",
"$MUSLPORTINGDIR/src/time/asctime_r.c",
"$MUSLPORTINGDIR/src/time/ctime.c",
"$MUSLPORTINGDIR/src/time/strftime.c",
"$MUSLPORTINGDIR/src/time/strptime.c",
]
MUSL_LIBM_SRC = [
"$MUSLPORTINGDIR/src/math/__fpclassify.c",
"$MUSLPORTINGDIR/src/math/__fpclassifyl.c",
"$MUSLPORTINGDIR/src/math/__math_divzero.c",
"$MUSLPORTINGDIR/src/math/__math_divzerof.c",
"$MUSLPORTINGDIR/src/math/__math_invalid.c",
"$MUSLPORTINGDIR/src/math/__math_invalidf.c",
"$MUSLPORTINGDIR/src/math/__math_oflow.c",
"$MUSLPORTINGDIR/src/math/__math_oflowf.c",
"$MUSLPORTINGDIR/src/math/__math_uflow.c",
"$MUSLPORTINGDIR/src/math/__math_uflowf.c",
"$MUSLPORTINGDIR/src/math/__math_xflow.c",
"$MUSLPORTINGDIR/src/math/__math_xflowf.c",
"$MUSLPORTINGDIR/src/math/__signbit.c",
"$MUSLPORTINGDIR/src/math/__signbitl.c",
"$MUSLPORTINGDIR/src/math/arm/fabs.c",
"$MUSLPORTINGDIR/src/math/copysign.c",
"$MUSLPORTINGDIR/src/math/copysignl.c",
"$MUSLPORTINGDIR/src/math/exp_data.c",
"$MUSLPORTINGDIR/src/math/fabsl.c",
"$MUSLPORTINGDIR/src/math/floor.c",
"$MUSLPORTINGDIR/src/math/fmod.c",
"$MUSLPORTINGDIR/src/math/fmodl.c",
"$MUSLPORTINGDIR/src/math/frexp.c",
"$MUSLPORTINGDIR/src/math/frexpl.c",
"$MUSLPORTINGDIR/src/math/log.c",
"$MUSLPORTINGDIR/src/math/log_data.c",
"$MUSLPORTINGDIR/src/math/pow.c",
"$MUSLPORTINGDIR/src/math/pow_data.c",
"$MUSLPORTINGDIR/src/math/round.c",
"$MUSLPORTINGDIR/src/math/scalbn.c",
"$MUSLPORTINGDIR/src/math/scalbnl.c",
"$MUSLPORTINGDIR/src/math/sqrt.c",
]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册