aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/CodeGen/Linking/RelocEntry.cs
blob: d103bc3958d3014420ac3482730ddde7a144aed7 (plain) (blame)
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
namespace ARMeilleure.CodeGen.Linking
{
    /// <summary>
    /// Represents a relocation.
    /// </summary>
    readonly struct RelocEntry
    {
        public const int Stride = 13; // Bytes.

        /// <summary>
        /// Gets the position of the relocation.
        /// </summary>
        public int Position { get; }

        /// <summary>
        /// Gets the <see cref="Symbol"/> of the relocation.
        /// </summary>
        public Symbol Symbol { get; }

        /// <summary>
        /// Initializes a new instance of the <see cref="RelocEntry"/> struct with the specified position and
        /// <see cref="Symbol"/>.
        /// </summary>
        /// <param name="position">Position of relocation</param>
        /// <param name="symbol">Symbol of relocation</param>
        public RelocEntry(int position, Symbol symbol)
        {
            Position = position;
            Symbol = symbol;
        }

        /// <inheritdoc/>
        public override string ToString()
        {
            return $"({nameof(Position)} = {Position}, {nameof(Symbol)} = {Symbol})";
        }
    }
}