diff --git a/binfmt/libelf/libelf_verify.c b/binfmt/libelf/libelf_verify.c index 26cb51ae7c..1db1e99371 100644 --- a/binfmt/libelf/libelf_verify.c +++ b/binfmt/libelf/libelf_verify.c @@ -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; diff --git a/libc/machine/arm/arm/arch_elf.c b/libc/machine/arm/arm/arch_elf.c index 6e1e3cfcb6..8611207a76 100644 --- a/libc/machine/arm/arm/arch_elf.c +++ b/libc/machine/arm/arm/arch_elf.c @@ -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; } /**************************************************************************** diff --git a/libc/machine/arm/armv6-m/arch_elf.c b/libc/machine/arm/armv6-m/arch_elf.c index 3f957b6fdf..b746d34c86 100644 --- a/libc/machine/arm/armv6-m/arch_elf.c +++ b/libc/machine/arm/armv6-m/arch_elf.c @@ -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; } /**************************************************************************** diff --git a/libc/machine/arm/armv7-a/arch_elf.c b/libc/machine/arm/armv7-a/arch_elf.c index be4801af89..4fa30f1049 100644 --- a/libc/machine/arm/armv7-a/arch_elf.c +++ b/libc/machine/arm/armv7-a/arch_elf.c @@ -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; } /**************************************************************************** diff --git a/libc/machine/arm/armv7-m/arch_elf.c b/libc/machine/arm/armv7-m/arch_elf.c index 7e4238e0c9..db6a6010a0 100644 --- a/libc/machine/arm/armv7-m/arch_elf.c +++ b/libc/machine/arm/armv7-m/arch_elf.c @@ -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; } /**************************************************************************** diff --git a/libc/machine/arm/armv7-r/arch_elf.c b/libc/machine/arm/armv7-r/arch_elf.c index 36f65fae1f..8985336620 100644 --- a/libc/machine/arm/armv7-r/arch_elf.c +++ b/libc/machine/arm/armv7-r/arch_elf.c @@ -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; } /****************************************************************************