ElfSym.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace Ryujinx.Core.Loaders
  2. {
  3. struct ElfSym
  4. {
  5. public string Name { get; private set; }
  6. public ElfSymType Type { get; private set; }
  7. public ElfSymBinding Binding { get; private set; }
  8. public ElfSymVisibility Visibility { get; private set; }
  9. public bool IsFuncOrObject =>
  10. Type == ElfSymType.STT_FUNC ||
  11. Type == ElfSymType.STT_OBJECT;
  12. public bool IsGlobalOrWeak =>
  13. Binding == ElfSymBinding.STB_GLOBAL ||
  14. Binding == ElfSymBinding.STB_WEAK;
  15. public int SHIdx { get; private set; }
  16. public long ValueAbs { get; private set; }
  17. public long Value { get; private set; }
  18. public long Size { get; private set; }
  19. public ElfSym(
  20. string Name,
  21. int Info,
  22. int Other,
  23. int SHIdx,
  24. long ImageBase,
  25. long Value,
  26. long Size)
  27. {
  28. this.Name = Name;
  29. this.Type = (ElfSymType)(Info & 0xf);
  30. this.Binding = (ElfSymBinding)(Info >> 4);
  31. this.Visibility = (ElfSymVisibility)Other;
  32. this.SHIdx = SHIdx;
  33. this.ValueAbs = Value + ImageBase;
  34. this.Value = Value;
  35. this.Size = Size;
  36. }
  37. }
  38. }