From e0a48b60b6767db3483eee638319914d86a79ce8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 25 Aug 2014 06:47:14 -0600 Subject: [PATCH] Change naming of ELF interfaces from arch_ to up_ for consistency --- arch/arm/src/a1x/Make.defs | 2 +- arch/arm/src/arm/up_elf.c | 14 +++++------ arch/arm/src/armv6-m/up_elf.c | 14 +++++------ ...oherent_dcache.c => arm_coherent_dcache.c} | 6 ++--- arch/arm/src/armv7-a/arm_elf.c | 14 +++++------ arch/arm/src/armv7-m/up_elf.c | 14 +++++------ arch/arm/src/sama5/Make.defs | 2 +- arch/sim/src/up_elf.c | 14 +++++------ arch/x86/src/common/up_elf.c | 14 +++++------ binfmt/libelf/libelf_bind.c | 4 ++-- binfmt/libelf/libelf_verify.c | 2 +- include/nuttx/binfmt/elf.h | 24 ++++++++++--------- 12 files changed, 63 insertions(+), 61 deletions(-) rename arch/arm/src/armv7-a/{arch_coherent_dcache.c => arm_coherent_dcache.c} (96%) diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 17eb916421..0f35f7249f 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -87,7 +87,7 @@ CMN_CSRCS += arm_addrenv.c endif ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += arm_elf.c arch_coherent_dcache.c +CMN_CSRCS += arm_elf.c arm_coherent_dcache.c endif ifeq ($(CONFIG_ARCH_FPU),y) diff --git a/arch/arm/src/arm/up_elf.c b/arch/arm/src/arm/up_elf.c index 2dd8366aa0..433024b849 100644 --- a/arch/arm/src/arm/up_elf.c +++ b/arch/arm/src/arm/up_elf.c @@ -65,7 +65,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -80,7 +80,7 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) +bool up_checkarch(FAR const Elf32_Ehdr *ehdr) { /* Make sure it's an ARM executable */ @@ -123,7 +123,7 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -140,8 +140,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { int32_t offset; @@ -248,8 +248,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("RELA relocation not supported\n"); return -ENOSYS; diff --git a/arch/arm/src/armv6-m/up_elf.c b/arch/arm/src/armv6-m/up_elf.c index d24641005c..7c5b76c21b 100644 --- a/arch/arm/src/armv6-m/up_elf.c +++ b/arch/arm/src/armv6-m/up_elf.c @@ -65,7 +65,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -80,7 +80,7 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) +bool up_checkarch(FAR const Elf32_Ehdr *ehdr) { /* Make sure it's an ARM executable */ @@ -115,7 +115,7 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -132,8 +132,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { int32_t offset; uint32_t upper_insn; @@ -441,8 +441,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("RELA relocation not supported\n"); return -ENOSYS; diff --git a/arch/arm/src/armv7-a/arch_coherent_dcache.c b/arch/arm/src/armv7-a/arm_coherent_dcache.c similarity index 96% rename from arch/arm/src/armv7-a/arch_coherent_dcache.c rename to arch/arm/src/armv7-a/arm_coherent_dcache.c index 4ab5acf494..6c0d4d7ceb 100644 --- a/arch/arm/src/armv7-a/arch_coherent_dcache.c +++ b/arch/arm/src/armv7-a/arm_coherent_dcache.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7/arch_undefinedinsn.c + * arch/arm/src/armv7/up_coherent_dcache.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -63,7 +63,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_coherent_dcache + * Name: up_coherent_dcache * * Description: * Ensure that the I and D caches are coherent within specified region @@ -80,7 +80,7 @@ * ****************************************************************************/ -void arch_coherent_dcache(uintptr_t addr, size_t len) +void up_coherent_dcache(uintptr_t addr, size_t len) { /* Perform the operation on the L1 cache */ diff --git a/arch/arm/src/armv7-a/arm_elf.c b/arch/arm/src/armv7-a/arm_elf.c index 887b2ebb85..0075f2e2a0 100644 --- a/arch/arm/src/armv7-a/arm_elf.c +++ b/arch/arm/src/armv7-a/arm_elf.c @@ -65,7 +65,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -80,7 +80,7 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) +bool up_checkarch(FAR const Elf32_Ehdr *ehdr) { /* Make sure it's an ARM executable */ @@ -123,7 +123,7 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -140,8 +140,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { int32_t offset; @@ -248,8 +248,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("RELA relocation not supported\n"); return -ENOSYS; diff --git a/arch/arm/src/armv7-m/up_elf.c b/arch/arm/src/armv7-m/up_elf.c index 539873d45e..c4d30d936b 100644 --- a/arch/arm/src/armv7-m/up_elf.c +++ b/arch/arm/src/armv7-m/up_elf.c @@ -65,7 +65,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -80,7 +80,7 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) +bool up_checkarch(FAR const Elf32_Ehdr *ehdr) { /* Make sure it's an ARM executable */ @@ -115,7 +115,7 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -132,8 +132,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *ehdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { int32_t offset; uint32_t upper_insn; @@ -441,8 +441,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("RELA relocation not supported\n"); return -ENOSYS; diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index 4adc5bdd3e..a3cfe80e00 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -89,7 +89,7 @@ CMN_CSRCS += arm_addrenv.c endif ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += arm_elf.c arch_coherent_dcache.c +CMN_CSRCS += arm_elf.c arm_coherent_dcache.c endif ifeq ($(CONFIG_ARCH_FPU),y) diff --git a/arch/sim/src/up_elf.c b/arch/sim/src/up_elf.c index 80443d4d5a..02b4ce7105 100644 --- a/arch/sim/src/up_elf.c +++ b/arch/sim/src/up_elf.c @@ -70,7 +70,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -85,13 +85,13 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *hdr) +bool up_checkarch(FAR const Elf32_Ehdr *hdr) { return hdr->e_machine == EM_386 || hdr->e_machine == EM_486; } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -108,8 +108,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *hdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { FAR uint32_t *ptr = (FAR uint32_t *)addr; @@ -130,8 +130,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("Not supported\n"); return -ENOSYS; diff --git a/arch/x86/src/common/up_elf.c b/arch/x86/src/common/up_elf.c index fd80960bb9..7c5772a9bb 100644 --- a/arch/x86/src/common/up_elf.c +++ b/arch/x86/src/common/up_elf.c @@ -70,7 +70,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -85,13 +85,13 @@ * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *hdr) +bool up_checkarch(FAR const Elf32_Ehdr *hdr) { return hdr->e_machine == EM_386 || hdr->e_machine == EM_486; } /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -108,8 +108,8 @@ bool arch_checkarch(FAR const Elf32_Ehdr *hdr) * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { FAR uint32_t *ptr = (FAR uint32_t *)addr; @@ -130,8 +130,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, return OK; } -int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, - uintptr_t addr) +int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, + uintptr_t addr) { bdbg("Not supported\n"); return -ENOSYS; diff --git a/binfmt/libelf/libelf_bind.c b/binfmt/libelf/libelf_bind.c index 6ce660ef5b..4b54bd01dc 100644 --- a/binfmt/libelf/libelf_bind.c +++ b/binfmt/libelf/libelf_bind.c @@ -211,7 +211,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx, /* Now perform the architecture-specific relocation */ - ret = arch_relocate(&rel, &sym, addr); + ret = up_relocate(&rel, &sym, addr); if (ret < 0) { #ifdef CONFIG_ARCH_ADDRENV @@ -329,7 +329,7 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo, * contents to memory and invalidating the I cache. */ - arch_coherent_dcache(loadinfo->textalloc, loadinfo->textsize); + up_coherent_dcache(loadinfo->textalloc, loadinfo->textsize); #endif return ret; diff --git a/binfmt/libelf/libelf_verify.c b/binfmt/libelf/libelf_verify.c index c5f185ec3f..ee6c880f67 100644 --- a/binfmt/libelf/libelf_verify.c +++ b/binfmt/libelf/libelf_verify.c @@ -107,7 +107,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr) /* Verify that this file works with the currently configured architecture */ - if (arch_checkarch(ehdr)) + if (up_checkarch(ehdr)) { bdbg("Not a supported architecture\n"); return -ENOEXEC; diff --git a/include/nuttx/binfmt/elf.h b/include/nuttx/binfmt/elf.h index 9561135dcf..eb3f100c28 100644 --- a/include/nuttx/binfmt/elf.h +++ b/include/nuttx/binfmt/elf.h @@ -150,7 +150,8 @@ struct elf_loadinfo_s #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -271,10 +272,11 @@ int elf_initialize(void); void elf_uninitialize(void); /**************************************************************************** - * These are APIs must be provided by architecture-specific logic: + * These are APIs must be provided by architecture-specific logic. + * (These really belong in include/nuttx/arch.h): ****************************************************************************/ /**************************************************************************** - * Name: arch_checkarch + * Name: up_checkarch * * Description: * Given the ELF header in 'hdr', verify that the ELF file is appropriate @@ -289,10 +291,10 @@ void elf_uninitialize(void); * ****************************************************************************/ -bool arch_checkarch(FAR const Elf32_Ehdr *hdr); +bool up_checkarch(FAR const Elf32_Ehdr *hdr); /**************************************************************************** - * Name: arch_relocate and arch_relocateadd + * Name: up_relocate and up_relocateadd * * Description: * Perform on architecture-specific ELF relocation. Every architecture @@ -309,13 +311,13 @@ bool arch_checkarch(FAR const Elf32_Ehdr *hdr); * ****************************************************************************/ -int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, - uintptr_t addr); -int arch_relocateadd(FAR const Elf32_Rela *rel, - FAR const Elf32_Sym *sym, uintptr_t addr); +int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, + uintptr_t addr); +int up_relocateadd(FAR const Elf32_Rela *rel, + FAR const Elf32_Sym *sym, uintptr_t addr); /**************************************************************************** - * Name: arch_coherent_dcache + * Name: up_coherent_dcache * * Description: * Ensure that the I and D caches are coherent within specified region @@ -333,7 +335,7 @@ int arch_relocateadd(FAR const Elf32_Rela *rel, ****************************************************************************/ #ifdef CONFIG_ARCH_HAVE_COHERENT_DCACHE -void arch_coherent_dcache(uintptr_t addr, size_t len); +void up_coherent_dcache(uintptr_t addr, size_t len); #endif #undef EXTERN