aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs
blob: 1ed61b2cb5cacbfc5e2ff3ad7abb7d57c9422654 (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
namespace Ryujinx.HLE.Loaders.Elf
{
    struct ElfSymbol
    {
        public string Name { get; private set; }

        public ElfSymbolType Type { get; private set; }
        public ElfSymbolBinding Binding { get; private set; }
        public ElfSymbolVisibility Visibility { get; private set; }

        public readonly bool IsFuncOrObject => Type == ElfSymbolType.SttFunc || Type == ElfSymbolType.SttObject;
        public readonly bool IsGlobalOrWeak => Binding == ElfSymbolBinding.StbGlobal || Binding == ElfSymbolBinding.StbWeak;

        public int ShIdx { get; private set; }
        public ulong Value { get; private set; }
        public ulong Size { get; private set; }

        public ElfSymbol(
            string name,
            int info,
            int other,
            int shIdx,
            ulong value,
            ulong size)
        {
            Name = name;
            Type = (ElfSymbolType)(info & 0xf);
            Binding = (ElfSymbolBinding)(info >> 4);
            Visibility = (ElfSymbolVisibility)other;
            ShIdx = shIdx;
            Value = value;
            Size = size;
        }
    }
}