Merge saidi@zizzer.eecs.umich.edu:/bk/linux
[gem5.git] / base / loader / elf_object.cc
index 9889b9d4cc98b41a7663ffb095df380f7d1ce8f3..b8f46449a0ae9033693309d723c86752b9312ed2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -36,6 +36,7 @@
 // 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>
@@ -73,8 +74,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
     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);
 
@@ -225,7 +227,7 @@ ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
             // 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));
                 }