dl-sysdep.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Various assmbly language/system dependent hacks that are required
  4. * so that we can minimize the amount of platform specific code.
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. */
  7. /* Define this if the system uses RELOCA. */
  8. #undef ELF_USES_RELOCA
  9. /* Initialization sequence for the GOT. */
  10. #define INIT_GOT(GOT_BASE,MODULE) \
  11. { \
  12. GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \
  13. GOT_BASE[1] = (unsigned long) MODULE; \
  14. }
  15. static inline unsigned long arm_modulus(unsigned long m, unsigned long p)
  16. {
  17. unsigned long i,t,inc;
  18. i=p; t=0;
  19. while(!(i&(1<<31))) {
  20. i<<=1;
  21. t++;
  22. }
  23. t--;
  24. for(inc=t;inc>2;inc--) {
  25. i=p<<inc;
  26. if(i&(1<<31))
  27. break;
  28. while(m>=i) {
  29. m-=i;
  30. i<<=1;
  31. if(i&(1<<31))
  32. break;
  33. if(i<p)
  34. break;
  35. }
  36. }
  37. while(m>=p) {
  38. m-=p;
  39. }
  40. return m;
  41. }
  42. #define do_rem(result, n, base) ((result) = arm_modulus(n, base))
  43. /* Here we define the magic numbers that this dynamic loader should accept */
  44. #define MAGIC1 EM_ARM
  45. #undef MAGIC2
  46. /* Used for error messages */
  47. #define ELF_TARGET "ARM"
  48. struct elf_resolve;
  49. unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
  50. /* 4096 bytes alignment */
  51. #define PAGE_ALIGN 0xfffff000
  52. #define ADDR_ALIGN 0xfff
  53. #define OFFS_ALIGN 0x7ffff000
  54. /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
  55. PLT entries should not be allowed to define the value.
  56. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
  57. of the main executable's symbols, as for a COPY reloc. */
  58. #define elf_machine_type_class(type) \
  59. ((((type) == R_ARM_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
  60. | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))