blob: 32e3dbb4005dfa0ea612b4915d3adf5c10c73102 [file] [log] [blame]
Austin Schuh208337d2022-01-01 14:29:11 -08001/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _ELF_H
8#define _ELF_H
9
10#include <stdint.h>
11
12#define ELF_MAGIC 0x464c457fu
13
14#define EM_ARM 0x28u
15
16#define EF_ARM_ABI_FLOAT_HARD 0x00000400u
17
18#define PT_LOAD 0x00000001u
19
20#pragma pack(push, 1)
21struct elf_header {
22 uint32_t magic;
23 uint8_t arch_class;
24 uint8_t endianness;
25 uint8_t version;
26 uint8_t abi;
27 uint8_t abi_version;
28 uint8_t _pad[7];
29 uint16_t type;
30 uint16_t machine;
31 uint32_t version2;
32};
33
34struct elf32_header {
35 struct elf_header common;
36 uint32_t entry;
37 uint32_t ph_offset;
38 uint32_t sh_offset;
39 uint32_t flags;
40 uint16_t eh_size;
41 uint16_t ph_entry_size;
42 uint16_t ph_num;
43 uint16_t sh_entry_size;
44 uint16_t sh_num;
45 uint16_t sh_str_index;
46};
47
48struct elf32_ph_entry {
49 uint32_t type;
50 uint32_t offset;
51 uint32_t vaddr;
52 uint32_t paddr;
53 uint32_t filez;
54 uint32_t memsz;
55 uint32_t flags;
56 uint32_t align;
57};
58#pragma pack(pop)
59
60#endif