ELF: Move sim and x86 ARM versions of ELF relocation logic to libc/machine
This commit is contained in:
parent
4a8c6a6d2d
commit
b656e371d3
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
@ -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.
|
||||
#
|
|
@ -0,0 +1,43 @@
|
|||
############################################################################
|
||||
# libc/machine/sim/Make.defs
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
* 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:
|
|
@ -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.
|
||||
#
|
|
@ -0,0 +1,43 @@
|
|||
############################################################################
|
||||
# libc/machine/x86/Make.defs
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
Loading…
Reference in New Issue