reloc.h 989 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <stdint.h>
  2. #include <string.h>
  3. #include <elf.h>
  4. #define LDSO_ARCH "x32"
  5. /* FIXME: x32 is very strange in its use of 64-bit relocation types in
  6. * a 32-bit environment. As long as the memory at reloc_addr is
  7. * zero-filled prior to relocations, just treating 64-bit relocations
  8. * as operating on 32-bit slots should be fine, but this should be
  9. * checked. In particular, R_X86_64_64, R_X86_64_DTPOFF64, and
  10. * R_X86_64_TPOFF64 may need checking. */
  11. static int remap_rel(int type)
  12. {
  13. switch(type) {
  14. case R_X86_64_64:
  15. case R_X86_64_32:
  16. return REL_SYMBOLIC;
  17. case R_X86_64_PC32:
  18. return REL_OFFSET;
  19. case R_X86_64_GLOB_DAT:
  20. return REL_GOT;
  21. case R_X86_64_JUMP_SLOT:
  22. return REL_PLT;
  23. case R_X86_64_RELATIVE:
  24. return REL_RELATIVE;
  25. case R_X86_64_COPY:
  26. return REL_COPY;
  27. case R_X86_64_DTPMOD64:
  28. return REL_DTPMOD;
  29. case R_X86_64_DTPOFF64:
  30. case R_X86_64_DTPOFF32:
  31. return REL_DTPOFF;
  32. case R_X86_64_TPOFF64:
  33. case R_X86_64_TPOFF32:
  34. return REL_TPOFF;
  35. }
  36. return 0;
  37. }