/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2003-2004 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>
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");
+ printf("emachine = %x\n", ehdr.e_machine);
+// if (ehdr.e_machine != EM_ALPHA)
+// panic("Non Alpha Binary, Not Supported");
elf_end(elf);
ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
{
Elf *elf;
- int secidx = 1; // there is a 0 but it is nothing, go figure
+ int sec_idx = 1; // there is a 0 but it is nothing, go figure
Elf_Scn *section;
GElf_Shdr shdr;
Elf_Data *data;
assert(elf != NULL);
// Get the first section
- section = elf_getscn(elf, secidx);
+ section = elf_getscn(elf, sec_idx);
// While there are no more sections
while (section != NULL) {
// 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));
}
}
}
- ++secidx;
- section = elf_getscn(elf, secidx);
+ ++sec_idx;
+ section = elf_getscn(elf, sec_idx);
}
elf_end(elf);