From 31a20c88c52f6051575fe760251407d11e5715ba Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 16 Mar 2006 10:31:00 -0500 Subject: [PATCH] Add warning for ignored loadable ELF segments. base/loader/elf_object.cc: Print warning if there are more than two loadable segments. We currently assume there are at most two (text & data), and that's held so far, but it would be nice not to silently ignore others. --HG-- extra : convert_revision : 1b3e693e95ba1210b09528b97819a7fa86426edc --- base/loader/elf_object.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index 2925817cd..844a0bea8 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -75,8 +75,7 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) DPRINTFR(Loader, "Not ELF\n"); elf_end(elf); return NULL; - } - else { + } else { //Detect the architecture //Versioning issues in libelf need to be resolved to get the correct //SPARC constants. @@ -213,8 +212,7 @@ ElfObject::ElfObject(const string &_filename, int _fd, bss.size = phdr.p_memsz - phdr.p_filesz; bss.baseAddr = phdr.p_vaddr + phdr.p_filesz; bss.fileImage = NULL; - } - else if (data.size == 0) { // have text, this must be data + } else if (data.size == 0) { // have text, this must be data data.baseAddr = phdr.p_vaddr; data.size = phdr.p_filesz; data.fileImage = fileData + phdr.p_offset; @@ -227,6 +225,10 @@ ElfObject::ElfObject(const string &_filename, int _fd, bss.size = phdr.p_memsz - phdr.p_filesz; bss.baseAddr = phdr.p_vaddr + phdr.p_filesz; bss.fileImage = NULL; + } else { + warn("More than two loadable segments in ELF object."); + warn("Ignoring segment @ 0x%x length 0x%x.", + phdr.p_vaddr, phdr.p_filesz); } } -- 2.30.2