9#ifndef LLVM_MC_MCELFEXTRAS_H
10#define LLVM_MC_MCELFEXTRAS_H
24template <
bool Is64,
class RelocsTy,
class F>
26 using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
27 uint OffsetMask = 8,
Offset = 0, Addend = 0;
29 for (
const auto &R : Relocs)
30 OffsetMask |= ToCrel(R).r_offset;
33 for (
const auto &R : Relocs) {
35 auto DeltaOffset =
static_cast<uint
>((CR.r_offset -
Offset) >> Shift);
37 uint8_t
B = (DeltaOffset << 3) + (SymIdx != CR.r_symidx) +
38 (
Type != CR.r_type ? 2 : 0) +
39 (Addend != uint(CR.r_addend) ? 4 : 0);
40 if (DeltaOffset < 0x10) {
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file implements the C++20 <bit> header.
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
void encodeCrel(raw_ostream &OS, RelocsTy Relocs, F ToCrel)
constexpr unsigned CREL_HDR_ADDEND
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.