aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Loaders/ElfSym.cs
blob: 869938d357e89e9a4b4b1fec01290411747003e3 (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
39
40
namespace Ryujinx.HLE.Loaders
{
    struct ElfSym
    {
        public string Name { get; private set; }

        public ElfSymType       Type       { get; private set; }
        public ElfSymBinding    Binding    { get; private set; }
        public ElfSymVisibility Visibility { get; private set; }

        public bool IsFuncOrObject =>
            Type == ElfSymType.STT_FUNC ||
            Type == ElfSymType.STT_OBJECT;

        public bool IsGlobalOrWeak =>
            Binding == ElfSymBinding.STB_GLOBAL ||
            Binding == ElfSymBinding.STB_WEAK;

        public int  SHIdx { get; private set; }
        public long Value { get; private set; }
        public long Size  { get; private set; }

        public ElfSym(
            string Name,
            int    Info,
            int    Other,
            int    SHIdx,
            long   Value,
            long   Size)
        {
            this.Name       = Name;
            this.Type       = (ElfSymType)(Info & 0xf);
            this.Binding    = (ElfSymBinding)(Info >> 4);
            this.Visibility = (ElfSymVisibility)Other;
            this.SHIdx      = SHIdx;
            this.Value      = Value;
            this.Size       = Size;
        }
    }
}