From 19fbdcd30bfcbfe11b2a1a315039f0e3b68025a1 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Tue, 11 Sep 2007 00:01:24 -0400 Subject: Loader: Error if a TLS section is found in the binary. --HG-- extra : convert_revision : d763c0382f3cbcc9786510f5a8e521ec9d55eff1 --- src/base/loader/elf_object.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/base/loader/elf_object.hh') diff --git a/src/base/loader/elf_object.hh b/src/base/loader/elf_object.hh index d909140f3..3e7c85874 100644 --- a/src/base/loader/elf_object.hh +++ b/src/base/loader/elf_object.hh @@ -32,6 +32,7 @@ #define __ELF_OBJECT_HH__ #include "base/loader/object_file.hh" +#include class ElfObject : public ObjectFile { @@ -42,6 +43,7 @@ class ElfObject : public ObjectFile Addr _programHeaderTable; uint16_t _programHeaderSize; uint16_t _programHeaderCount; + std::set sectionNames; /// Helper functions for loadGlobalSymbols() and loadLocalSymbols(). bool loadSomeSymbols(SymbolTable *symtab, int binding); @@ -50,6 +52,9 @@ class ElfObject : public ObjectFile size_t _len, uint8_t *_data, Arch _arch, OpSys _opSys); + void getSections(); + bool sectionExists(std::string sec); + public: virtual ~ElfObject() {} @@ -58,7 +63,8 @@ class ElfObject : public ObjectFile virtual bool loadLocalSymbols(SymbolTable *symtab, Addr addrMask = std::numeric_limits::max()); - virtual bool isDynamic(); + virtual bool isDynamic() { return sectionExists(".interp"); } + virtual bool hasTLS() { return sectionExists(".tbss"); } static ObjectFile *tryFile(const std::string &fname, int fd, size_t len, uint8_t *data); -- cgit v1.2.3