dl-sysdep.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (C) 2003, 2004 Red Hat, Inc.
  2. * Contributed by Alexandre Oliva <aoliva@redhat.com>
  3. * Copyright (C) 2006-2011 Analog Devices, Inc.
  4. * Based on ../i386/dl-sysdep.h
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. /*
  9. * Various assembly language/system dependent hacks that are required
  10. * so that we can minimize the amount of platform specific code.
  11. */
  12. /*
  13. * Define this if the system uses RELOCA.
  14. */
  15. #undef ELF_USES_RELOCA
  16. /* JMPREL relocs are inside the DT_RELA table. */
  17. #define ELF_MACHINE_PLTREL_OVERLAP
  18. #define DL_NO_COPY_RELOCS
  19. /* Here we define the magic numbers that this dynamic loader should accept */
  20. #define MAGIC1 EM_BLACKFIN
  21. #undef MAGIC2
  22. /* Used for error messages */
  23. #define ELF_TARGET "BFIN"
  24. /* Need bootstrap relocations */
  25. #define ARCH_NEEDS_BOOTSTRAP_RELOCS
  26. extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
  27. #undef SEND_EARLY_STDERR
  28. #define SEND_EARLY_STDERR(S) \
  29. do { \
  30. static const char __attribute__((section(".text"))) __s[] = (S); \
  31. const char *__p, *__scratch; \
  32. __asm__ ("call 1f;\n1:\n\t" \
  33. "%1 = RETS;\n\t" \
  34. "%0 = [%3 + 1b@GOT17M4];\n\t" \
  35. "%1 = %1 - %0;\n\t" \
  36. "%1 = %1 + %2;\n\t" \
  37. : "=&d" (__scratch), "=&d" (__p) \
  38. : "d" (__s), "a" (dl_boot_got_pointer) : "RETS"); \
  39. SEND_STDERR (__p); \
  40. { int __t; \
  41. for (__t = 0; __t < 0x1000000; __t++) __asm__ __volatile__ (""); } \
  42. } while (0)
  43. /* We only support loading FDPIC independently-relocatable shared
  44. libraries. It probably wouldn't be too hard to support loading
  45. shared libraries that require relocation by the same amount, but we
  46. don't know that they exist or would be useful, and the dynamic
  47. loader code could leak the whole-library map unless we keeping a
  48. bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
  49. keep things simple for now. */
  50. #define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
  51. do \
  52. { \
  53. if (((epnt)->e_flags & EF_BFIN_FDPIC) && ! ((epnt)->e_flags & EF_BFIN_PIC)) \
  54. (piclib) = 2; \
  55. else \
  56. { \
  57. _dl_internal_error_number = LD_ERROR_NOTDYN; \
  58. _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
  59. "\n", (_dl_progname), (libname)); \
  60. _dl_close(infile); \
  61. return NULL; \
  62. } \
  63. \
  64. } \
  65. while (0)
  66. #define DL_IS_SPECIAL_SEGMENT(EPNT, PPNT) \
  67. __dl_is_special_segment(EPNT, PPNT)
  68. #define DL_MAP_SEGMENT(EPNT, PPNT, INFILE, FLAGS) \
  69. __dl_map_segment (EPNT, PPNT, INFILE, FLAGS)
  70. #if defined(__BFIN_FDPIC__)
  71. #include "../fdpic/dl-sysdep.h"
  72. static __always_inline Elf32_Addr
  73. elf_machine_load_address (void)
  74. {
  75. /* this is never an issue on Blackfin systems, so screw it */
  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. return;
  83. }
  84. #endif