| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: loadfile_elf32.c,v 1.41 2017/09/25 20:39:21 maxv Exp $ */ | | 1 | /* $NetBSD: loadfile_elf32.c,v 1.42 2017/10/04 22:00:40 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center, by Christos Zoulas, and by Maxime Villard. | | 9 | * NASA Ames Research Center, by Christos Zoulas, and by Maxime Villard. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -479,27 +479,27 @@ out: | | | @@ -479,27 +479,27 @@ out: |
479 | * The KERNEL SEGMENTS start address is fixed by the segments themselves. We | | 479 | * The KERNEL SEGMENTS start address is fixed by the segments themselves. We |
480 | * then map the rest by increasing maxp. | | 480 | * then map the rest by increasing maxp. |
481 | * | | 481 | * |
482 | * The offsets of the SYMBOL SECTIONS are relative to the start address of the | | 482 | * The offsets of the SYMBOL SECTIONS are relative to the start address of the |
483 | * ELF HEADER. The shdr offset of ELF HEADER points to SECTION HEADERS. | | 483 | * ELF HEADER. The shdr offset of ELF HEADER points to SECTION HEADERS. |
484 | * | | 484 | * |
485 | * We just give the kernel a pointer to the ELF HEADER, which is enough for it | | 485 | * We just give the kernel a pointer to the ELF HEADER, which is enough for it |
486 | * to find the location and number of symbols by itself later. | | 486 | * to find the location and number of symbols by itself later. |
487 | */ | | 487 | */ |
488 | int | | 488 | int |
489 | ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags) | | 489 | ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *elf, u_long *marks, int flags) |
490 | { | | 490 | { |
491 | Elf_Phdr *phdr; | | 491 | Elf_Phdr *phdr; |
492 | int i, first; | | 492 | int i, first __used; |
493 | ssize_t sz; | | 493 | ssize_t sz; |
494 | Elf_Addr minp = ~0, maxp = 0, pos = 0, elfp = 0; | | 494 | Elf_Addr minp = ~0, maxp = 0, pos = 0, elfp = 0; |
495 | u_long offset = marks[MARK_START]; | | 495 | u_long offset = marks[MARK_START]; |
496 | ssize_t nr; | | 496 | ssize_t nr; |
497 | | | 497 | |
498 | /* some ports dont use the offset */ | | 498 | /* some ports dont use the offset */ |
499 | (void)&offset; | | 499 | (void)&offset; |
500 | | | 500 | |
501 | /* have not seen a data segment so far */ | | 501 | /* have not seen a data segment so far */ |
502 | marks[MARK_DATA] = 0; | | 502 | marks[MARK_DATA] = 0; |
503 | | | 503 | |
504 | internalize_ehdr(elf->e_ident[EI_DATA], elf); | | 504 | internalize_ehdr(elf->e_ident[EI_DATA], elf); |
505 | | | 505 | |