|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the sj-i/php-profiler package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) sji <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace PhpProfiler\Lib\Elf\Structure\Elf64; |
|
15
|
|
|
|
|
16
|
|
|
use PhpProfiler\Lib\Integer\UInt64; |
|
17
|
|
|
|
|
18
|
|
|
final class Elf64Header |
|
19
|
|
|
{ |
|
20
|
|
|
public const EI_MAG0 = 0; |
|
21
|
|
|
public const EI_MAG1 = 1; |
|
22
|
|
|
public const EI_MAG2 = 2; |
|
23
|
|
|
public const EI_MAG3 = 3; |
|
24
|
|
|
public const EI_CLASS = 4; |
|
25
|
|
|
public const EI_DATA = 5; |
|
26
|
|
|
public const EI_VERSION = 6; |
|
27
|
|
|
public const EI_OSABI = 7; |
|
28
|
|
|
public const EI_ABIVERSION = 8; |
|
29
|
|
|
public const EI_PAD = 9; |
|
30
|
|
|
public const EI_NIDENT = 16; |
|
31
|
|
|
|
|
32
|
|
|
public const MAGIC = "\x7fELF"; |
|
33
|
|
|
|
|
34
|
|
|
public const ELFCLASSNONE = 0; |
|
35
|
|
|
public const ELFCLASS32 = 1; |
|
36
|
|
|
public const ELFCLASS64 = 2; |
|
37
|
|
|
|
|
38
|
|
|
public const ELFDATANONE = 0; |
|
39
|
|
|
public const ELFDATA2LSB = 1; |
|
40
|
|
|
public const ELFDATA2MSB = 2; |
|
41
|
|
|
|
|
42
|
|
|
public const EV_NONE = 0; |
|
43
|
|
|
public const EV_CURRENT = 1; |
|
44
|
|
|
|
|
45
|
|
|
public const ELFOSABI_NONE = 0; |
|
46
|
|
|
|
|
47
|
|
|
public const ET_NONE = 0; |
|
48
|
|
|
public const ET_REL = 1; |
|
49
|
|
|
public const ET_EXEC = 2; |
|
50
|
|
|
public const ET_DYN = 3; |
|
51
|
|
|
public const ET_CORE = 4; |
|
52
|
|
|
public const ET_LOPROC = 0xff00; |
|
53
|
|
|
public const ET_HIPROC = 0xffff; |
|
54
|
|
|
|
|
55
|
|
|
public const EM_NONE = 0; |
|
56
|
|
|
public const EM_386 = 3; |
|
57
|
|
|
public const EM_X86_64 = 62; |
|
58
|
|
|
|
|
59
|
|
|
public function __construct( |
|
60
|
|
|
public array $e_ident, // unsigned char[EI_NIDENT] |
|
61
|
|
|
public int $e_type, // Elf64_Half |
|
62
|
|
|
public int $e_machine, // Elf64_Half |
|
63
|
|
|
public int $e_version, // Elf64_Word |
|
64
|
|
|
public UInt64 $e_entry, // Elf64_Addr |
|
65
|
|
|
public UInt64 $e_phoff, // Elf64_Off |
|
66
|
|
|
public UInt64 $e_shoff, // Elf64_Off |
|
67
|
|
|
public int $e_flags, // Elf64_Word |
|
68
|
|
|
public int $e_ehsize, // Elf64_Half |
|
69
|
|
|
public int $e_phentsize, // Elf64_Half |
|
70
|
|
|
public int $e_phnum, // Elf64_Half |
|
71
|
|
|
public int $e_shentsize, // Elf64_Half |
|
72
|
|
|
public int $e_shnum, // Elf64_Half |
|
73
|
|
|
public int $e_shstrndx // Elf64_Half |
|
74
|
|
|
) { |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function hasSectionHeader(): bool |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->e_shnum > 0; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|