link_elf.c (42200) | link_elf.c (43185) |
---|---|
1/*- 2 * Copyright (c) 1998 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: link_elf.c,v 1.10 1998/11/06 15:16:07 peter Exp $ | 26 * $Id: link_elf.c,v 1.11 1998/12/31 09:17:20 peter Exp $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/kernel.h> 31#include <sys/systm.h> 32#include <sys/malloc.h> 33#include <sys/proc.h> 34#include <sys/namei.h> --- 135 unchanged lines hidden (view full) --- 170 if (baseptr) 171 linker_kernel_file->address = *(caddr_t *)baseptr; 172 sizeptr = preload_search_info(modptr, MODINFO_SIZE); 173 if (sizeptr) 174 linker_kernel_file->size = *(size_t *)sizeptr; 175 } 176 (void)parse_module_symbols(linker_kernel_file); 177 linker_current_file = linker_kernel_file; | 27 */ 28 29#include <sys/param.h> 30#include <sys/kernel.h> 31#include <sys/systm.h> 32#include <sys/malloc.h> 33#include <sys/proc.h> 34#include <sys/namei.h> --- 135 unchanged lines hidden (view full) --- 170 if (baseptr) 171 linker_kernel_file->address = *(caddr_t *)baseptr; 172 sizeptr = preload_search_info(modptr, MODINFO_SIZE); 173 if (sizeptr) 174 linker_kernel_file->size = *(size_t *)sizeptr; 175 } 176 (void)parse_module_symbols(linker_kernel_file); 177 linker_current_file = linker_kernel_file; |
178 linker_kernel_file->flags |= LINKER_FILE_LINKED; |
|
178 } 179#endif 180} 181 182SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, 0); 183 184static int 185parse_module_symbols(linker_file_t lf) --- 193 unchanged lines hidden (view full) --- 379 return error; 380 } 381 error = relocate_file(lf); 382 if (error) { 383 linker_file_unload(lf); 384 return error; 385 } 386 (void)parse_module_symbols(lf); | 179 } 180#endif 181} 182 183SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, 0); 184 185static int 186parse_module_symbols(linker_file_t lf) --- 193 unchanged lines hidden (view full) --- 380 return error; 381 } 382 error = relocate_file(lf); 383 if (error) { 384 linker_file_unload(lf); 385 return error; 386 } 387 (void)parse_module_symbols(lf); |
388 lf->flags |= LINKER_FILE_LINKED; |
|
387 *result = lf; 388 return (0); 389} 390 391static int 392link_elf_load_file(const char* filename, linker_file_t* result) 393{ 394 struct nameidata nd; --- 273 unchanged lines hidden (view full) --- 668 if (error) 669 goto out; 670 671 ef->ddbsymcnt = symcnt / sizeof(Elf_Sym); 672 ef->ddbsymtab = (const Elf_Sym *)ef->symbase; 673 ef->ddbstrcnt = strcnt; 674 ef->ddbstrtab = ef->strbase; 675 | 389 *result = lf; 390 return (0); 391} 392 393static int 394link_elf_load_file(const char* filename, linker_file_t* result) 395{ 396 struct nameidata nd; --- 273 unchanged lines hidden (view full) --- 670 if (error) 671 goto out; 672 673 ef->ddbsymcnt = symcnt / sizeof(Elf_Sym); 674 ef->ddbsymtab = (const Elf_Sym *)ef->symbase; 675 ef->ddbstrcnt = strcnt; 676 ef->ddbstrtab = ef->strbase; 677 |
678 lf->flags |= LINKER_FILE_LINKED; 679 |
|
676nosyms: 677 678 *result = lf; 679 680out: 681 if (error && lf) 682 linker_file_unload(lf); 683 if (shdr) --- 298 unchanged lines hidden --- | 680nosyms: 681 682 *result = lf; 683 684out: 685 if (error && lf) 686 linker_file_unload(lf); 687 if (shdr) --- 298 unchanged lines hidden --- |