aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/Loaders/ElfSym.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Core/Loaders/ElfSym.cs')
-rw-r--r--Ryujinx.Core/Loaders/ElfSym.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Ryujinx.Core/Loaders/ElfSym.cs b/Ryujinx.Core/Loaders/ElfSym.cs
new file mode 100644
index 00000000..35a45500
--- /dev/null
+++ b/Ryujinx.Core/Loaders/ElfSym.cs
@@ -0,0 +1,43 @@
+namespace Ryujinx.Core.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 ValueAbs { 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 ImageBase,
+ 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.ValueAbs = Value + ImageBase;
+ this.Value = Value;
+ this.Size = Size;
+ }
+ }
+} \ No newline at end of file