dl-sysdep.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (C) 2003, 2004 Red Hat, Inc.
  2. * Contributed by Alexandre Oliva <aoliva@redhat.com>
  3. * Based on ../i386/dl-sysdep.h
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. /*
  8. * Various assembly language/system dependent hacks that are required
  9. * so that we can minimize the amount of platform specific code.
  10. */
  11. /*
  12. * Define this if the system uses RELOCA.
  13. */
  14. #undef ELF_USES_RELOCA
  15. /* JMPREL relocs are inside the DT_RELA table. */
  16. #define ELF_MACHINE_PLTREL_OVERLAP
  17. #define DL_NO_COPY_RELOCS
  18. /* Here we define the magic numbers that this dynamic loader should accept */
  19. #define MAGIC1 EM_CYGNUS_FRV
  20. #undef MAGIC2
  21. /* Used for error messages */
  22. #define ELF_TARGET "FR-V"
  23. /* Need bootstrap relocations */
  24. #define ARCH_NEEDS_BOOTSTRAP_RELOCS
  25. extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
  26. /* We must force strings used early in the bootstrap into the data
  27. segment, such that they are referenced with GOTOFF instead of
  28. GPREL, because GPREL needs the GOT to have already been
  29. relocated. */
  30. #undef SEND_EARLY_STDERR
  31. #define SEND_EARLY_STDERR(S) \
  32. do { static char __s[] = (S); SEND_STDERR (__s); } while (0)
  33. /* Make sure we only load libraries that use the same number of
  34. general-purpose and floating-point registers the dynamic loader was
  35. compiled for. */
  36. #define DL_CHECK_REG_COUNT(flags) \
  37. (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \
  38. && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \
  39. && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \
  40. && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \
  41. && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1))
  42. /* We only support loading FDPIC independently-relocatable shared
  43. libraries. It probably wouldn't be too hard to support loading
  44. shared libraries that require relocation by the same amount, but we
  45. don't know that they exist or would be useful, and the dynamic
  46. loader code could leak the whole-library map unless we keeping a
  47. bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
  48. keep things simple for now. */
  49. #define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
  50. do \
  51. { \
  52. if (((epnt)->e_flags & EF_FRV_FDPIC) && ! ((epnt)->e_flags & EF_FRV_PIC)) \
  53. (piclib) = 2; \
  54. else \
  55. { \
  56. _dl_internal_error_number = LD_ERROR_NOTDYN; \
  57. _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
  58. "\n", (_dl_progname), (libname)); \
  59. _dl_close(infile); \
  60. return NULL; \
  61. } \
  62. \
  63. if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \
  64. { \
  65. _dl_internal_error_number = LD_ERROR_NOTDYN; \
  66. _dl_dprintf(2, "%s: '%s' assumes different register counts" \
  67. "\n", (_dl_progname), (libname)); \
  68. _dl_close(infile); \
  69. } \
  70. } \
  71. while (0)
  72. #include "../fdpic/dl-sysdep.h"
  73. static __always_inline Elf32_Addr
  74. elf_machine_load_address (void)
  75. {
  76. return 0;
  77. }
  78. static __always_inline void
  79. elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
  80. Elf32_Word relative_count)
  81. {
  82. ;
  83. }