/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
// set this now (it causes things to break on 64-bit platforms).
#define __LIBELF64_LINUX 0
#define __LIBELF_NEED_LINK_H 0
+#define __LIBELF_SYMBOL_VERSIONS 0
#include <libelf/libelf.h>
#include <libelf/gelf.h>
#include "base/loader/elf_object.hh"
-#include "mem/functional_mem/functional_memory.hh"
+#include "mem/functional/functional.hh"
#include "base/loader/symtab.hh"
#include "base/trace.hh" // for DPRINTF
GElf_Ehdr ehdr;
// check that header matches library version
- assert(elf_version(EV_CURRENT) != EV_NONE);
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ panic("wrong elf version number!");
// get a pointer to elf structure
elf = elf_memory((char*)data,len);
else {
if (ehdr.e_ident[EI_CLASS] == ELFCLASS32)
panic("32 bit ELF Binary, Not Supported");
- if (ehdr.e_machine != EM_ALPHA)
- panic("Non Alpha Binary, Not Supported");
+ /* @todo this emachine value isn't offical yet.
+ * so we probably shouldn't check it. */
+// if (ehdr.e_machine != EM_ALPHA)
+// panic("Non Alpha Binary, Not Supported");
elf_end(elf);
GElf_Ehdr ehdr;
// check that header matches library version
- assert(elf_version(EV_CURRENT) != EV_NONE);
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ panic("wrong elf version number!");
// get a pointer to elf structure
elf = elf_memory((char*)fileData,len);
return false;
// check that header matches library version
- assert(elf_version(EV_CURRENT) != EV_NONE);
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ panic("wrong elf version number!");
// get a pointer to elf structure
elf = elf_memory((char*)fileData,len);
// loop through all the symbols, only loading global ones
for (ii = 0; ii < count; ++ii) {
gelf_getsym(data, ii, &sym);
- if (GELF_ST_BIND(sym.st_info) & binding) {
+ if (GELF_ST_BIND(sym.st_info) == binding) {
symtab->insert(sym.st_value,
elf_strptr(elf, shdr.sh_link, sym.st_name));
}