aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/Loaders/Elf
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.HLE/Loaders/Elf
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.HLE/Loaders/Elf')
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs15
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs75
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs35
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs14
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs14
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs9
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs13
-rw-r--r--src/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs10
8 files changed, 185 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs
new file mode 100644
index 00000000..f489e85a
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs
@@ -0,0 +1,15 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ struct ElfDynamic
+ {
+ public ElfDynamicTag Tag { get; private set; }
+
+ public long Value { get; private set; }
+
+ public ElfDynamic(ElfDynamicTag tag, long value)
+ {
+ Tag = tag;
+ Value = value;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs
new file mode 100644
index 00000000..eb37d612
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs
@@ -0,0 +1,75 @@
+using System.Diagnostics.CodeAnalysis;
+
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
+ enum ElfDynamicTag
+ {
+ DT_NULL = 0,
+ DT_NEEDED = 1,
+ DT_PLTRELSZ = 2,
+ DT_PLTGOT = 3,
+ DT_HASH = 4,
+ DT_STRTAB = 5,
+ DT_SYMTAB = 6,
+ DT_RELA = 7,
+ DT_RELASZ = 8,
+ DT_RELAENT = 9,
+ DT_STRSZ = 10,
+ DT_SYMENT = 11,
+ DT_INIT = 12,
+ DT_FINI = 13,
+ DT_SONAME = 14,
+ DT_RPATH = 15,
+ DT_SYMBOLIC = 16,
+ DT_REL = 17,
+ DT_RELSZ = 18,
+ DT_RELENT = 19,
+ DT_PLTREL = 20,
+ DT_DEBUG = 21,
+ DT_TEXTREL = 22,
+ DT_JMPREL = 23,
+ DT_BIND_NOW = 24,
+ DT_INIT_ARRAY = 25,
+ DT_FINI_ARRAY = 26,
+ DT_INIT_ARRAYSZ = 27,
+ DT_FINI_ARRAYSZ = 28,
+ DT_RUNPATH = 29,
+ DT_FLAGS = 30,
+ DT_ENCODING = 32,
+ DT_PREINIT_ARRAY = 32,
+ DT_PREINIT_ARRAYSZ = 33,
+ DT_GNU_PRELINKED = 0x6ffffdf5,
+ DT_GNU_CONFLICTSZ = 0x6ffffdf6,
+ DT_GNU_LIBLISTSZ = 0x6ffffdf7,
+ DT_CHECKSUM = 0x6ffffdf8,
+ DT_PLTPADSZ = 0x6ffffdf9,
+ DT_MOVEENT = 0x6ffffdfa,
+ DT_MOVESZ = 0x6ffffdfb,
+ DT_FEATURE_1 = 0x6ffffdfc,
+ DT_POSFLAG_1 = 0x6ffffdfd,
+ DT_SYMINSZ = 0x6ffffdfe,
+ DT_SYMINENT = 0x6ffffdff,
+ DT_GNU_HASH = 0x6ffffef5,
+ DT_TLSDESC_PLT = 0x6ffffef6,
+ DT_TLSDESC_GOT = 0x6ffffef7,
+ DT_GNU_CONFLICT = 0x6ffffef8,
+ DT_GNU_LIBLIST = 0x6ffffef9,
+ DT_CONFIG = 0x6ffffefa,
+ DT_DEPAUDIT = 0x6ffffefb,
+ DT_AUDIT = 0x6ffffefc,
+ DT_PLTPAD = 0x6ffffefd,
+ DT_MOVETAB = 0x6ffffefe,
+ DT_SYMINFO = 0x6ffffeff,
+ DT_VERSYM = 0x6ffffff0,
+ DT_RELACOUNT = 0x6ffffff9,
+ DT_RELCOUNT = 0x6ffffffa,
+ DT_FLAGS_1 = 0x6ffffffb,
+ DT_VERDEF = 0x6ffffffc,
+ DT_VERDEFNUM = 0x6ffffffd,
+ DT_VERNEED = 0x6ffffffe,
+ DT_VERNEEDNUM = 0x6fffffff,
+ DT_AUXILIARY = 0x7ffffffd,
+ DT_FILTER = 0x7fffffff
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs
new file mode 100644
index 00000000..1cfc0bdc
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs
@@ -0,0 +1,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 bool IsFuncOrObject => Type == ElfSymbolType.SttFunc || Type == ElfSymbolType.SttObject;
+ public 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;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs
new file mode 100644
index 00000000..2f84796b
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol32.cs
@@ -0,0 +1,14 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ struct ElfSymbol32
+ {
+#pragma warning disable CS0649
+ public uint NameOffset;
+ public uint ValueAddress;
+ public uint Size;
+ public byte Info;
+ public byte Other;
+ public ushort SectionIndex;
+#pragma warning restore CS0649
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs
new file mode 100644
index 00000000..665e65b0
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbol64.cs
@@ -0,0 +1,14 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ struct ElfSymbol64
+ {
+#pragma warning disable CS0649
+ public uint NameOffset;
+ public byte Info;
+ public byte Other;
+ public ushort SectionIndex;
+ public ulong ValueAddress;
+ public ulong Size;
+#pragma warning restore CS0649
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs
new file mode 100644
index 00000000..92274fde
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs
@@ -0,0 +1,9 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolBinding
+ {
+ StbLocal = 0,
+ StbGlobal = 1,
+ StbWeak = 2
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs
new file mode 100644
index 00000000..4110d4c3
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs
@@ -0,0 +1,13 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolType
+ {
+ SttNoType = 0,
+ SttObject = 1,
+ SttFunc = 2,
+ SttSection = 3,
+ SttFile = 4,
+ SttCommon = 5,
+ SttTls = 6
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs
new file mode 100644
index 00000000..f026fca8
--- /dev/null
+++ b/src/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs
@@ -0,0 +1,10 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolVisibility
+ {
+ StvDefault = 0,
+ StvInternal = 1,
+ StvHidden = 2,
+ StvProtected = 3
+ }
+} \ No newline at end of file