diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 69d8e85b1e..540c1c6fc8 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -111,10 +111,6 @@ ifeq ($(CONFIG_SIM_IOEXPANDER),y) CSRCS += up_ioexpander.c endif -ifeq ($(CONFIG_ELF),y) - CSRCS += up_elf.c -endif - ifeq ($(CONFIG_FS_FAT),y) CSRCS += up_blockdevice.c up_deviceimage.c endif diff --git a/libc/machine/Kconfig b/libc/machine/Kconfig index c991d25754..7620774c44 100644 --- a/libc/machine/Kconfig +++ b/libc/machine/Kconfig @@ -120,3 +120,9 @@ config LIBM_ARCH_TRUNCF if ARCH_ARM source libc/machine/arm/Kconfig endif +if ARCH_SIM +source libc/machine/sim/Kconfig +endif +if ARCH_X86 +source libc/machine/x86/Kconfig +endif diff --git a/libc/machine/Make.defs b/libc/machine/Make.defs index 56990d866c..dee7518e5b 100644 --- a/libc/machine/Make.defs +++ b/libc/machine/Make.defs @@ -36,3 +36,9 @@ ifeq ($(CONFIG_ARCH_ARM),y) include ${TOPDIR}/libc/machine/arm/Make.defs endif +ifeq ($(CONFIG_ARCH_SIM),y) +include ${TOPDIR}/libc/machine/sim/Make.defs +endif +ifeq ($(CONFIG_ARCH_X86),y) +include ${TOPDIR}/libc/machine/x86/Make.defs +endif diff --git a/libc/machine/arm/Kconfig b/libc/machine/arm/Kconfig index 4e01900960..a4314ed8d6 100644 --- a/libc/machine/arm/Kconfig +++ b/libc/machine/arm/Kconfig @@ -3,6 +3,10 @@ # see the file kconfig-language.txt in the NuttX tools repository. # +if ARCH_ARM7TDMI || ARCH_ARM920T || ARCH_ARM926EJS +source libc/machine/arm/arm/Kconfig +endif + if ARCH_CORTEXA5 || ARCH_CORTEXA8 || ARCH_CORTEXA9 source libc/machine/arm/armv7-a/Kconfig endif diff --git a/libc/machine/arm/arm/arch_elf.c b/libc/machine/arm/arm/arch_elf.c index b92d399c4f..6e1e3cfcb6 100644 --- a/libc/machine/arm/arm/arch_elf.c +++ b/libc/machine/arm/arm/arch_elf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/arm/up_elf.c + * libc/machine/arm/arm/arch_elf.c * * Copyright (C) 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/machine/arm/armv6-m/arch_elf.c b/libc/machine/arm/armv6-m/arch_elf.c index b6479b3b2f..3f957b6fdf 100644 --- a/libc/machine/arm/armv6-m/arch_elf.c +++ b/libc/machine/arm/armv6-m/arch_elf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/armv6-m/up_elf.c + * libc/machine/arm/armv6-m/arch_elf.c * * Copyright (C) 2013-2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/machine/arm/armv7-m/arch_elf.c b/libc/machine/arm/armv7-m/arch_elf.c index 11ea2c0935..7e4238e0c9 100644 --- a/libc/machine/arm/armv7-m/arch_elf.c +++ b/libc/machine/arm/armv7-m/arch_elf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/armv7-m/up_elf.c + * libc/machine/arm/armv7-m/arch_elf.c * * Copyright (C) 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/machine/sim/Kconfig b/libc/machine/sim/Kconfig new file mode 100644 index 0000000000..f72f3c094c --- /dev/null +++ b/libc/machine/sim/Kconfig @@ -0,0 +1,4 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# diff --git a/libc/machine/sim/Make.defs b/libc/machine/sim/Make.defs new file mode 100644 index 0000000000..85a9ccda31 --- /dev/null +++ b/libc/machine/sim/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/sim/Make.defs +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_LIBC_ARCH_ELF),y) + +CSRCS += arch_elf.c + +DEPPATH += --dep-path machine/sim +VPATH += :machine/sim + +endif diff --git a/arch/sim/src/up_elf.c b/libc/machine/sim/arch_elf.c similarity index 96% rename from arch/sim/src/up_elf.c rename to libc/machine/sim/arch_elf.c index bba6010ac9..30bcd53788 100644 --- a/arch/sim/src/up_elf.c +++ b/libc/machine/sim/arch_elf.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/sim/src/up_elf.c + * machine/sim/arm_elf.c * - * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -125,7 +125,7 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, break; case R_386_PC32: - *ptr += sym->st_value - (uint32_t)ptr; + *ptr += sym->st_value - (uint32_t)((uintptr_t)ptr); break; default: diff --git a/libc/machine/x86/Kconfig b/libc/machine/x86/Kconfig new file mode 100644 index 0000000000..f72f3c094c --- /dev/null +++ b/libc/machine/x86/Kconfig @@ -0,0 +1,4 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# diff --git a/libc/machine/x86/Make.defs b/libc/machine/x86/Make.defs new file mode 100644 index 0000000000..282d7d450b --- /dev/null +++ b/libc/machine/x86/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/x86/Make.defs +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_LIBC_ARCH_ELF),y) + +CSRCS += arch_elf.c + +DEPPATH += --dep-path machine/x86 +VPATH += :machine/x86 + +endif diff --git a/arch/x86/src/common/up_elf.c b/libc/machine/x86/arch_elf.c similarity index 98% rename from arch/x86/src/common/up_elf.c rename to libc/machine/x86/arch_elf.c index 7f169dee73..ca815451fd 100644 --- a/arch/x86/src/common/up_elf.c +++ b/libc/machine/x86/arch_elf.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/x86/src/up_elf.c + * machine/x86/src/up_elf.c * - * Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014, 2016-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without