elf_object.cc (6691:cd68b6ecd68d) elf_object.cc (7095:f7bb2d93cc49)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29 * Ali Saidi
30 */
31
32#include <cassert>
33#include <string>
34
35#include "gelf.h"
36
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29 * Ali Saidi
30 */
31
32#include <cassert>
33#include <string>
34
35#include "gelf.h"
36
37#include "base/bitfield.hh"
37#include "base/loader/elf_object.hh"
38#include "base/loader/symtab.hh"
39#include "base/misc.hh"
40#include "base/trace.hh" // for DPRINTF
41#include "sim/byteswap.hh"
42
43using namespace std;
44

--- 46 unchanged lines hidden (view full) ---

91 ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
92 arch = ObjectFile::X86_64;
93 } else if (ehdr.e_machine == EM_386 &&
94 ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
95 arch = ObjectFile::I386;
96 } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
97 arch = ObjectFile::Alpha;
98 } else if (ehdr.e_machine == EM_ARM) {
38#include "base/loader/elf_object.hh"
39#include "base/loader/symtab.hh"
40#include "base/misc.hh"
41#include "base/trace.hh" // for DPRINTF
42#include "sim/byteswap.hh"
43
44using namespace std;
45

--- 46 unchanged lines hidden (view full) ---

92 ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
93 arch = ObjectFile::X86_64;
94 } else if (ehdr.e_machine == EM_386 &&
95 ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
96 arch = ObjectFile::I386;
97 } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
98 arch = ObjectFile::Alpha;
99 } else if (ehdr.e_machine == EM_ARM) {
99 arch = ObjectFile::Arm;
100 if (bits(ehdr.e_entry, 0)) {
101 arch = ObjectFile::Thumb;
102 } else {
103 arch = ObjectFile::Arm;
104 }
100 } else if (ehdr.e_machine == EM_PPC &&
101 ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
102 if (ehdr.e_ident[EI_DATA] == ELFDATA2MSB) {
103 arch = ObjectFile::Power;
104 } else {
105 fatal("The binary you're trying to load is compiled for "
106 "little endian Power.\nM5 only supports big "
107 "endian Power. Please recompile your binary.\n");

--- 352 unchanged lines hidden ---
105 } else if (ehdr.e_machine == EM_PPC &&
106 ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
107 if (ehdr.e_ident[EI_DATA] == ELFDATA2MSB) {
108 arch = ObjectFile::Power;
109 } else {
110 fatal("The binary you're trying to load is compiled for "
111 "little endian Power.\nM5 only supports big "
112 "endian Power. Please recompile your binary.\n");

--- 352 unchanged lines hidden ---