imgact_elf.c (9ed346bab02c967ac656a58bc024f9505d8e3d7a) | imgact_elf.c (21a3ee0ead09ec1e927c460c89606818bddf667d) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2000 David O'Brien |
|
2 * Copyright (c) 1995-1996 S�ren Schmidt 3 * Copyright (c) 1996 Peter Wemm 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 91 unchanged lines hidden (view full) --- 101 "FreeBSD ELF", 102 elf_coredump, 103 NULL, 104 MINSIGSTKSZ 105}; 106 107static Elf_Brandinfo freebsd_brand_info = { 108 ELFOSABI_FREEBSD, | 3 * Copyright (c) 1995-1996 S�ren Schmidt 4 * Copyright (c) 1996 Peter Wemm 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright --- 91 unchanged lines hidden (view full) --- 102 "FreeBSD ELF", 103 elf_coredump, 104 NULL, 105 MINSIGSTKSZ 106}; 107 108static Elf_Brandinfo freebsd_brand_info = { 109 ELFOSABI_FREEBSD, |
110 "FreeBSD", |
|
109 "", 110 "/usr/libexec/ld-elf.so.1", 111 &elf_freebsd_sysvec 112 }; 113static Elf_Brandinfo *elf_brand_list[MAX_BRANDS] = { 114 &freebsd_brand_info, 115 NULL, NULL, NULL, 116 NULL, NULL, NULL, NULL --- 440 unchanged lines hidden (view full) --- 557 vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr; 558 559 addr = ELF_RTLD_ADDR(vmspace); 560 561 imgp->entry_addr = entry; 562 563 brand_info = NULL; 564 | 111 "", 112 "/usr/libexec/ld-elf.so.1", 113 &elf_freebsd_sysvec 114 }; 115static Elf_Brandinfo *elf_brand_list[MAX_BRANDS] = { 116 &freebsd_brand_info, 117 NULL, NULL, NULL, 118 NULL, NULL, NULL, NULL --- 440 unchanged lines hidden (view full) --- 559 vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr; 560 561 addr = ELF_RTLD_ADDR(vmspace); 562 563 imgp->entry_addr = entry; 564 565 brand_info = NULL; 566 |
565 /* XXX For now we look for the magic "FreeBSD" that we used to put 566 * into the ELF header at the EI_ABIVERSION location. If found use 567 * that information rather than figuring out the ABI from proper 568 * branding. This should be removed for 5.0-RELEASE. The Linux caes 569 * can be figured out from the `interp_path' field. | 567 /* We support three types of branding -- (1) the ELF EI_OSABI field 568 * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string 569 * branding w/in the ELF header, and (3) path of the `interp_path' 570 * field. We should also look for an ".note.ABI-tag" ELF section now 571 * in all Linux ELF binaries, FreeBSD 4.1+, and some NetBSD ones. |
570 */ | 572 */ |
571 if (strcmp("FreeBSD", (const char *)&hdr->e_ident[OLD_EI_BRAND]) == 0) 572 brand_info = &freebsd_brand_info; | |
573 574 /* If the executable has a brand, search for it in the brand list. */ 575 if (brand_info == NULL) { 576 for (i = 0; i < MAX_BRANDS; i++) { 577 Elf_Brandinfo *bi = elf_brand_list[i]; 578 | 573 574 /* If the executable has a brand, search for it in the brand list. */ 575 if (brand_info == NULL) { 576 for (i = 0; i < MAX_BRANDS; i++) { 577 Elf_Brandinfo *bi = elf_brand_list[i]; 578 |
579 if (bi != NULL && hdr->e_ident[EI_OSABI] == bi->brand) { | 579 if (bi != NULL && 580 (hdr->e_ident[EI_OSABI] == bi->brand 581 || 0 == 582 strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], 583 bi->compat_3_brand, strlen(bi->compat_3_brand)))) { |
580 brand_info = bi; 581 break; 582 } 583 } 584 } 585 586 /* Lacking a known brand, search for a recognized interpreter. */ 587 if (brand_info == NULL && interp != NULL) { --- 444 unchanged lines hidden --- | 584 brand_info = bi; 585 break; 586 } 587 } 588 } 589 590 /* Lacking a known brand, search for a recognized interpreter. */ 591 if (brand_info == NULL && interp != NULL) { --- 444 unchanged lines hidden --- |