-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkEdit.h
More file actions
62 lines (47 loc) · 1.69 KB
/
LinkEdit.h
File metadata and controls
62 lines (47 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2026 Nikita Hmelnitkii. MIT License - see LICENSE.
//
// LinkEdit.h - element types for linkedit-producing vectors.
#ifndef LD_LINKEDIT_H
#define LD_LINKEDIT_H
#include "Primitives.h"
#include <cstddef>
#include <cstdint>
namespace ld {
using LinkerOption = CString;
static_assert(sizeof(LinkerOption) == 16, "");
// Large-addend pool slot (indexed when the inline 21-bit addend overflows).
using LargeAddend = int64_t;
static_assert(sizeof(LargeAddend) == 8, "");
// Linker optimization hint: 8-byte packed record.
namespace LOH {
enum Kind : uint8_t {
kNone = 0x00,
kAdrpAdrp = 0x01, // two ADRPs to the same page
kAdrpLdr = 0x02, // ADRP + LDR
kAdrpAddLdr = 0x03, // ADRP + ADD + LDR
kAdrpLdrGotLdr = 0x04, // ADRP + LDR(GOT) + LDR
kAdrpAddStr = 0x05, // ADRP + ADD + STR
kAdrpLdrGotStr = 0x06, // ADRP + LDR(GOT) + STR
kAdrpAdd = 0x07, // ADRP + ADD
kAdrpLdrGot = 0x08, // ADRP + LDR(GOT)
};
inline constexpr uint8_t kMaxInstructions = 3;
constexpr Kind decodeKind(uint64_t record) {
return static_cast<Kind>(record & 0xFF);
}
}
// Dependency info entry. Values match the dep_info file format.
// kInputLTO is absent on ld-1266+ (LTO dep tracking folded into kInput).
namespace DependencyEntry {
enum Kind : uint8_t {
kVersion = 0x00,
kInput = 0x10,
kInputNotFound = 0x11,
kInputLTO = 0x12, // pre-1266 only
kOutput = 0x40,
};
inline constexpr size_t kTag = 0x00; // u8
inline constexpr size_t kPath = 0x08; // std::string (libc++ SSO, 24B)
}
} // namespace ld
#endif