diff --git a/headers/os/support/Errors.h b/headers/os/support/Errors.h
index 48f5699..19a0032 100644
a
|
b
|
|
74 | 74 | |
75 | 75 | #define B_DEBUGGER_ALREADY_INSTALLED (B_OS_ERROR_BASE + 0x400) |
76 | 76 | |
| 77 | #define B_BAD_IMAGE_ARCHITECTURE (B_OS_ERROR_BASE + 0x410) |
| 78 | #define B_BAD_IMAGE_PLATFORM (B_OS_ERROR_BASE + 0x411) |
| 79 | |
77 | 80 | /* Application Kit Errors */ |
78 | 81 | #define B_BAD_REPLY (B_APP_ERROR_BASE + 0) |
79 | 82 | #define B_DUPLICATE_REPLY (B_APP_ERROR_BASE + 1) |
diff --git a/src/system/runtime_loader/runtime_loader.cpp b/src/system/runtime_loader/runtime_loader.cpp
index bbc9c45..37de472 100644
a
|
b
|
search_executable_in_path_list(const char *name, const char *pathList,
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
| 218 | static status_t |
| 219 | test_architecture(uint16 elfMachine) |
| 220 | { |
| 221 | char name[128]; |
| 222 | switch (elfMachine) { |
| 223 | case EM_386: |
| 224 | case EM_486: |
| 225 | name = "x86"; |
| 226 | #if defined(__i386__) |
| 227 | return B_OK; |
| 228 | #endif |
| 229 | // TODO: Multilib check for i386 on x86_64? |
| 230 | break; |
| 231 | case EM_X86_64: |
| 232 | name = "x86_64"; |
| 233 | #if defined(__x86_64__) |
| 234 | return B_OK; |
| 235 | #endif |
| 236 | break; |
| 237 | case EM_PPC: |
| 238 | case EM_PPC64: |
| 239 | name = "PowerPC"; |
| 240 | #if defined(__powerpc__) |
| 241 | return B_OK; |
| 242 | #endif |
| 243 | break; |
| 244 | case EM_ARM: |
| 245 | name = "ARM"; |
| 246 | #if defined(__arm__) |
| 247 | return B_OK; |
| 248 | #endif |
| 249 | break; |
| 250 | case EM_MIPS: |
| 251 | name = "MIPS"; |
| 252 | #if defined(__mips__) |
| 253 | return B_OK; |
| 254 | #endif |
| 255 | break; |
| 256 | default: |
| 257 | name = "Unknown"; |
| 258 | } |
| 259 | TRACE("runtime_loader: %s not correct architecture\n", name); |
| 260 | return B_BAD_IMAGE_ARCHITECTURE; |
| 261 | } |
| 262 | |
| 263 | |
218 | 264 | int |
219 | 265 | open_executable(char *name, image_type type, const char *rpath, |
220 | 266 | const char *programPath, const char *compatibilitySubDir) |
… |
… |
test_executable(const char *name, char *invoker)
|
349 | 395 | } |
350 | 396 | } else if (status == B_OK) { |
351 | 397 | struct Elf32_Ehdr *elfHeader = (struct Elf32_Ehdr *)buffer; |
| 398 | |
| 399 | status = test_architecture(elfHeader->e_machine); |
| 400 | |
352 | 401 | if (elfHeader->e_entry == 0) { |
353 | 402 | // we don't like to open shared libraries |
354 | 403 | status = B_NOT_AN_EXECUTABLE; |