Change naming of ELF interfaces from arch_ to up_ for consistency

This commit is contained in:
Gregory Nutt
2014-08-25 06:47:14 -06:00
parent a832f97e90
commit e0a48b60b6
12 changed files with 63 additions and 61 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ CMN_CSRCS += arm_addrenv.c
endif endif
ifeq ($(CONFIG_ELF),y) ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += arm_elf.c arch_coherent_dcache.c CMN_CSRCS += arm_elf.c arm_coherent_dcache.c
endif endif
ifeq ($(CONFIG_ARCH_FPU),y) ifeq ($(CONFIG_ARCH_FPU),y)
+7 -7
View File
@@ -65,7 +65,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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 */ /* 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: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
int32_t offset; int32_t offset;
@@ -248,8 +248,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
return OK; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("RELA relocation not supported\n"); bdbg("RELA relocation not supported\n");
return -ENOSYS; return -ENOSYS;
+7 -7
View File
@@ -65,7 +65,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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 */ /* 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: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
int32_t offset; int32_t offset;
uint32_t upper_insn; uint32_t upper_insn;
@@ -441,8 +441,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
return OK; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("RELA relocation not supported\n"); bdbg("RELA relocation not supported\n");
return -ENOSYS; return -ENOSYS;
@@ -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. * Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@@ -63,7 +63,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_coherent_dcache * Name: up_coherent_dcache
* *
* Description: * Description:
* Ensure that the I and D caches are coherent within specified region * 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 */ /* Perform the operation on the L1 cache */
+7 -7
View File
@@ -65,7 +65,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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 */ /* 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: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
int32_t offset; int32_t offset;
@@ -248,8 +248,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
return OK; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("RELA relocation not supported\n"); bdbg("RELA relocation not supported\n");
return -ENOSYS; return -ENOSYS;
+7 -7
View File
@@ -65,7 +65,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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 */ /* 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: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
int32_t offset; int32_t offset;
uint32_t upper_insn; uint32_t upper_insn;
@@ -441,8 +441,8 @@ int arch_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
return OK; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("RELA relocation not supported\n"); bdbg("RELA relocation not supported\n");
return -ENOSYS; return -ENOSYS;
+1 -1
View File
@@ -89,7 +89,7 @@ CMN_CSRCS += arm_addrenv.c
endif endif
ifeq ($(CONFIG_ELF),y) ifeq ($(CONFIG_ELF),y)
CMN_CSRCS += arm_elf.c arch_coherent_dcache.c CMN_CSRCS += arm_elf.c arm_coherent_dcache.c
endif endif
ifeq ($(CONFIG_ARCH_FPU),y) ifeq ($(CONFIG_ARCH_FPU),y)
+7 -7
View File
@@ -70,7 +70,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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; return hdr->e_machine == EM_386 || hdr->e_machine == EM_486;
} }
/**************************************************************************** /****************************************************************************
* Name: arch_relocate and arch_relocateadd * Name: up_relocate and up_relocateadd
* *
* Description: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
FAR uint32_t *ptr = (FAR uint32_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; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("Not supported\n"); bdbg("Not supported\n");
return -ENOSYS; return -ENOSYS;
+7 -7
View File
@@ -70,7 +70,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_checkarch * Name: up_checkarch
* *
* Description: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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; return hdr->e_machine == EM_386 || hdr->e_machine == EM_486;
} }
/**************************************************************************** /****************************************************************************
* Name: arch_relocate and arch_relocateadd * Name: up_relocate and up_relocateadd
* *
* Description: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
FAR uint32_t *ptr = (FAR uint32_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; return OK;
} }
int arch_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
uintptr_t addr) uintptr_t addr)
{ {
bdbg("Not supported\n"); bdbg("Not supported\n");
return -ENOSYS; return -ENOSYS;
+2 -2
View File
@@ -211,7 +211,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
/* Now perform the architecture-specific relocation */ /* Now perform the architecture-specific relocation */
ret = arch_relocate(&rel, &sym, addr); ret = up_relocate(&rel, &sym, addr);
if (ret < 0) if (ret < 0)
{ {
#ifdef CONFIG_ARCH_ADDRENV #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. * contents to memory and invalidating the I cache.
*/ */
arch_coherent_dcache(loadinfo->textalloc, loadinfo->textsize); up_coherent_dcache(loadinfo->textalloc, loadinfo->textsize);
#endif #endif
return ret; return ret;
+1 -1
View File
@@ -107,7 +107,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr)
/* Verify that this file works with the currently configured architecture */ /* Verify that this file works with the currently configured architecture */
if (arch_checkarch(ehdr)) if (up_checkarch(ehdr))
{ {
bdbg("Not a supported architecture\n"); bdbg("Not a supported architecture\n");
return -ENOEXEC; return -ENOEXEC;
+13 -11
View File
@@ -150,7 +150,8 @@ struct elf_loadinfo_s
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXTERN extern "C" #define EXTERN extern "C"
extern "C" { extern "C"
{
#else #else
#define EXTERN extern #define EXTERN extern
#endif #endif
@@ -271,10 +272,11 @@ int elf_initialize(void);
void elf_uninitialize(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: * Description:
* Given the ELF header in 'hdr', verify that the ELF file is appropriate * 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: * Description:
* Perform on architecture-specific ELF relocation. Every architecture * 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, int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym,
uintptr_t addr); uintptr_t addr);
int arch_relocateadd(FAR const Elf32_Rela *rel, int up_relocateadd(FAR const Elf32_Rela *rel,
FAR const Elf32_Sym *sym, uintptr_t addr); FAR const Elf32_Sym *sym, uintptr_t addr);
/**************************************************************************** /****************************************************************************
* Name: arch_coherent_dcache * Name: up_coherent_dcache
* *
* Description: * Description:
* Ensure that the I and D caches are coherent within specified region * 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 #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 #endif
#undef EXTERN #undef EXTERN