Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/imgact_elf.c
Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) | ||||
continue; | continue; | ||||
if (hdr->e_machine == bi->machine && | if (hdr->e_machine == bi->machine && | ||||
(hdr->e_ident[EI_OSABI] == bi->brand || | (hdr->e_ident[EI_OSABI] == bi->brand || | ||||
strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], | strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], | ||||
bi->compat_3_brand, strlen(bi->compat_3_brand)) == 0)) | bi->compat_3_brand, strlen(bi->compat_3_brand)) == 0)) | ||||
return (bi); | return (bi); | ||||
} | } | ||||
/* No known brand, see if the header is recognized by any brand */ | |||||
for (i = 0; i < MAX_BRANDS; i++) { | |||||
bi = elf_brand_list[i]; | |||||
if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY || | |||||
bi->check_header == NULL) | |||||
continue; | |||||
if (hdr->e_machine == bi->machine) { | |||||
ret = bi->check_header(imgp, hdr); | |||||
if (ret) | |||||
return (bi); | |||||
} | |||||
} | |||||
/* Lacking a known brand, search for a recognized interpreter. */ | /* Lacking a known brand, search for a recognized interpreter. */ | ||||
if (interp != NULL) { | if (interp != NULL) { | ||||
for (i = 0; i < MAX_BRANDS; i++) { | for (i = 0; i < MAX_BRANDS; i++) { | ||||
bi = elf_brand_list[i]; | bi = elf_brand_list[i]; | ||||
if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) | if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) | ||||
continue; | continue; | ||||
if (hdr->e_machine == bi->machine && | if (hdr->e_machine == bi->machine && | ||||
/* ELF image p_filesz includes terminating zero */ | /* ELF image p_filesz includes terminating zero */ | ||||
▲ Show 20 Lines • Show All 1,832 Lines • Show Last 20 Lines |