diff options
| author | Andriy Gapon <avg@FreeBSD.org> | 2010-08-21 18:51:25 +0000 |
|---|---|---|
| committer | Andriy Gapon <avg@FreeBSD.org> | 2010-08-21 18:51:25 +0000 |
| commit | d6e69ef4efb7a4ae2d6dd2c00ee011a177dca34b (patch) | |
| tree | 45bd8fdd63308f5d43f4a05ca855fab71746da2e /sys | |
| parent | 23055db15625cb747fd6540b4616f626ec08cae3 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/boot/common/load_elf_obj.c | 2 | ||||
| -rw-r--r-- | sys/kern/link_elf_obj.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/boot/common/load_elf_obj.c b/sys/boot/common/load_elf_obj.c index 4b3aaeae7865..6f3b3493aa3d 100644 --- a/sys/boot/common/load_elf_obj.c +++ b/sys/boot/common/load_elf_obj.c @@ -221,6 +221,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) for (i = 0; i < hdr->e_shnum; i++) shdr[i].sh_addr = 0; for (i = 0; i < hdr->e_shnum; i++) { + if (shdr[i].sh_size == 0) + continue; switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 7aabe8daa2b9..f1f4fe9561da 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -522,6 +522,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, symtabindex = -1; symstrindex = -1; for (i = 0; i < hdr->e_shnum; i++) { + if (shdr[i].sh_size == 0) + continue; switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: @@ -644,6 +646,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, /* Size up code/data(progbits) and bss(nobits). */ alignmask = 0; for (i = 0; i < hdr->e_shnum; i++) { + if (shdr[i].sh_size == 0) + continue; switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: @@ -704,6 +708,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, ra = 0; alignmask = 0; for (i = 0; i < hdr->e_shnum; i++) { + if (shdr[i].sh_size == 0) + continue; switch (shdr[i].sh_type) { case SHT_PROGBITS: case SHT_NOBITS: |
