all repos — mgba @ 679630701eb2ea639f625f427c08981633ee9cdb

mGBA Game Boy Advance Emulator

include/mgba-util/elf-read.h (view raw)

 1/* Copyright (c) 2013-2017 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef ELF_READ_H
 7#define ELF_READ_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#ifdef USE_ELF
14
15#include <libelf.h>
16
17#include <mgba-util/vector.h>
18
19struct ELF;
20struct VFile;
21
22DECLARE_VECTOR(ELFProgramHeaders, Elf32_Phdr);
23DECLARE_VECTOR(ELFSectionHeaders, Elf32_Shdr);
24
25struct ELF* ELFOpen(struct VFile*);
26void ELFClose(struct ELF*);
27
28void* ELFBytes(struct ELF*, size_t* size);
29
30uint16_t ELFMachine(struct ELF*);
31uint32_t ELFEntry(struct ELF*);
32
33void ELFGetProgramHeaders(struct ELF*, struct ELFProgramHeaders*);
34
35size_t ELFFindSection(struct ELF*, const char* name);
36void ELFGetSectionHeaders(struct ELF*, struct ELFSectionHeaders*);
37Elf32_Shdr* ELFGetSectionHeader(struct ELF*, size_t index);
38
39const char* ELFGetString(struct ELF*, size_t section, size_t string);
40
41#endif
42
43CXX_GUARD_END
44
45#endif