Merged in ccondurache/nuttx/fix_elf_arm_checkarch (pull request #422)

Fix ELF loader up_checkarch on ARM arch

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Cristian Condurache
2017-06-28 16:19:51 +00:00
committed by Gregory Nutt
6 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *ehdr)
/* Verify that this file works with the currently configured architecture */
if (up_checkarch(ehdr))
if (!up_checkarch(ehdr))
{
berr("Not a supported architecture\n");
return -ENOEXEC;
+5 -5
View File
@@ -87,7 +87,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_machine != EM_ARM)
{
berr("ERROR: Not for ARM: e_machine=%04x\n", ehdr->e_machine);
return -ENOEXEC;
return false;
}
/* Make sure that 32-bit objects are supported */
@@ -95,7 +95,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
{
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
return -ENOEXEC;
return false;
}
/* Verify endian-ness */
@@ -107,7 +107,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
#endif
{
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
return -ENOEXEC;
return false;
}
/* Make sure the entry point address is properly aligned */
@@ -115,11 +115,11 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if ((ehdr->e_entry & 3) != 0)
{
berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry);
return -ENOEXEC;
return false;
}
/* TODO: Check ABI here. */
return OK;
return true;
}
/****************************************************************************
+4 -4
View File
@@ -87,7 +87,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_machine != EM_ARM)
{
berr("ERROR: Not for ARM: e_machine=%04x\n", ehdr->e_machine);
return -ENOEXEC;
return false;
}
/* Make sure that 32-bit objects are supported */
@@ -95,7 +95,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
{
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
return -ENOEXEC;
return false;
}
/* Verify endian-ness */
@@ -107,11 +107,11 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
#endif
{
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
return -ENOEXEC;
return false;
}
/* TODO: Check ABI here. */
return OK;
return true;
}
/****************************************************************************
+5 -5
View File
@@ -75,7 +75,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_machine != EM_ARM)
{
berr("ERROR: Not for ARM: e_machine=%04x\n", ehdr->e_machine);
return -ENOEXEC;
return false;
}
/* Make sure that 32-bit objects are supported */
@@ -83,7 +83,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
{
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
return -ENOEXEC;
return false;
}
/* Verify endian-ness */
@@ -95,7 +95,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
#endif
{
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
return -ENOEXEC;
return false;
}
/* Make sure the entry point address is properly aligned */
@@ -103,11 +103,11 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if ((ehdr->e_entry & 3) != 0)
{
berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry);
return -ENOEXEC;
return false;
}
/* TODO: Check ABI here. */
return OK;
return true;
}
/****************************************************************************
+4 -4
View File
@@ -83,7 +83,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_machine != EM_ARM)
{
berr("ERROR: Not for ARM: e_machine=%04x\n", ehdr->e_machine);
return -ENOEXEC;
return false;
}
/* Make sure that 32-bit objects are supported */
@@ -91,7 +91,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
{
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
return -ENOEXEC;
return false;
}
/* Verify endian-ness */
@@ -103,11 +103,11 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
#endif
{
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
return -ENOEXEC;
return false;
}
/* TODO: Check ABI here. */
return OK;
return true;
}
/****************************************************************************
+5 -5
View File
@@ -87,7 +87,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_machine != EM_ARM)
{
berr("ERROR: Not for ARM: e_machine=%04x\n", ehdr->e_machine);
return -ENOEXEC;
return false;
}
/* Make sure that 32-bit objects are supported */
@@ -95,7 +95,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
{
berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]);
return -ENOEXEC;
return false;
}
/* Verify endian-ness */
@@ -107,7 +107,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
#endif
{
berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]);
return -ENOEXEC;
return false;
}
/* Make sure the entry point address is properly aligned */
@@ -115,11 +115,11 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr)
if ((ehdr->e_entry & 3) != 0)
{
berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry);
return -ENOEXEC;
return false;
}
/* TODO: Check ABI here. */
return OK;
return true;
}
/****************************************************************************