forked from nuttx/nuttx-update
libm/newlib: Add arch-specific source code first to CSRCS
Source code under `newlib/newlib/newlib/libm/machine/$(ARCH)/*.c` should be added before common source code from `../../common/*.c`. Take `newlib/newlib/newlib/libm/machine/riscv/s_fma.c` as an example: ``` double fma (double x, double y, double z) { double result; asm ("fmadd.d %0, %1, %2, %3" : "=f" (result) : "f" (x), "f" (y), "f" (z)); return result; } ``` Note that the common `s_fma.c` will be included by the source file directly. The order of adding the files to CSRCS matters here. Although the CMake-based build system does not have the same build problem of including the a source-file with the same in the wrong order, this commit also changes the order of inclusion for CMake too to keep it consistent.
This commit is contained in:
parent
80dd961f23
commit
5456668ae8
2 changed files with 10 additions and 10 deletions
|
@ -87,11 +87,12 @@ if(CONFIG_LIBM_NEWLIB)
|
||||||
set(ARCH_DIR ${CONFIG_ARCH})
|
set(ARCH_DIR ${CONFIG_ARCH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE COMMON_CSRCS ${NEWLIB_DIR}/newlib/libm/common/*.c)
|
|
||||||
file(GLOB_RECURSE COMPLEX_CSRCS ${NEWLIB_DIR}/newlib/libm/complex/*.c)
|
|
||||||
file(GLOB_RECURSE ARCH_CSRCS
|
file(GLOB_RECURSE ARCH_CSRCS
|
||||||
${NEWLIB_DIR}/newlib/libm/machine/${ARCH_DIR}/*.c)
|
${NEWLIB_DIR}/newlib/libm/machine/${ARCH_DIR}/*.c)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE COMMON_CSRCS ${NEWLIB_DIR}/newlib/libm/common/*.c)
|
||||||
|
file(GLOB_RECURSE COMPLEX_CSRCS ${NEWLIB_DIR}/newlib/libm/complex/*.c)
|
||||||
|
|
||||||
if(CONFIG_ARCH_X86_64)
|
if(CONFIG_ARCH_X86_64)
|
||||||
file(GLOB_RECURSE ARCH_CSRCS ${NEWLIB_DIR}/newlib/libm/fenv/*.c)
|
file(GLOB_RECURSE ARCH_CSRCS ${NEWLIB_DIR}/newlib/libm/fenv/*.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -58,14 +58,6 @@ $(TOPDIR)/include/newlib: newlib/newlib
|
||||||
|
|
||||||
context:: $(TOPDIR)/include/newlib
|
context:: $(TOPDIR)/include/newlib
|
||||||
|
|
||||||
CSRCS += $(wildcard newlib/newlib/newlib/libm/common/*.c)
|
|
||||||
CSRCS += $(wildcard newlib/newlib/newlib/libm/complex/*.c)
|
|
||||||
|
|
||||||
VPATH += :newlib/newlib/newlib/libm/common
|
|
||||||
VPATH += :newlib/newlib/newlib/libm/complex
|
|
||||||
DEPPATH += --dep-path newlib/newlib/newlib/libm/common
|
|
||||||
DEPPATH += --dep-path newlib/newlib/newlib/libm/complex
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_ARM),y)
|
ifeq ($(CONFIG_ARCH_ARM),y)
|
||||||
ARCH = arm
|
ARCH = arm
|
||||||
else ifeq ($(CONFIG_ARCH_ARM64),y)
|
else ifeq ($(CONFIG_ARCH_ARM64),y)
|
||||||
|
@ -88,6 +80,13 @@ CSRCS += $(wildcard newlib/newlib/newlib/libm/machine/$(ARCH)/*.c)
|
||||||
VPATH += :newlib/newlib/newlib/libm/machine/$(ARCH)
|
VPATH += :newlib/newlib/newlib/libm/machine/$(ARCH)
|
||||||
DEPPATH += --dep-path newlib/newlib/newlib/libm/machine/$(ARCH)
|
DEPPATH += --dep-path newlib/newlib/newlib/libm/machine/$(ARCH)
|
||||||
|
|
||||||
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/common/*.c)
|
||||||
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/complex/*.c)
|
||||||
|
|
||||||
|
VPATH += :newlib/newlib/newlib/libm/common
|
||||||
|
VPATH += :newlib/newlib/newlib/libm/complex
|
||||||
|
DEPPATH += --dep-path newlib/newlib/newlib/libm/common
|
||||||
|
DEPPATH += --dep-path newlib/newlib/newlib/libm/complex
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_X86_64),y)
|
ifeq ($(CONFIG_ARCH_X86_64),y)
|
||||||
CSRCS += $(wildcard newlib/newlib/newlib/libm/fenv/*.c)
|
CSRCS += $(wildcard newlib/newlib/newlib/libm/fenv/*.c)
|
||||||
|
|
Loading…
Reference in a new issue