extension-insteadof-inline.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
  2. --- uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
  3. +++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h 2009-06-21 19:08:44.487613137 +0200
  4. @@ -163,22 +163,25 @@
  5. #define OFFSET_GP_GOT 0x7ff0
  6. -static __inline__ ElfW(Addr) *
  7. -elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
  8. -{
  9. - /* FIXME: the offset of gp from GOT may be system-dependent. */
  10. - return (ElfW(Addr) *) (gpreg - OFFSET_GP_GOT);
  11. -}
  12. +#define elf_mips_got_from_gpreg(gpreg) __extension__({ \
  13. + ElfW(Addr) *elf_mips_got_from_gpreg_res; \
  14. + \
  15. + /* FIXME: the offset of gp from GOT may be system-dependent. */ \
  16. + elf_mips_got_from_gpreg_res = gpreg - OFFSET_GP_GOT; \
  17. + (elf_mips_got_from_gpreg_res); \
  18. +})
  19. /* Return the link-time address of _DYNAMIC. Conveniently, this is the
  20. first element of the GOT. This must be inlined in a function which
  21. uses global data. We assume its $gp points to the primary GOT. */
  22. -static __inline__ ElfW(Addr)
  23. -elf_machine_dynamic (void)
  24. -{
  25. - register ElfW(Addr) gp __asm__ ("$28");
  26. - return *elf_mips_got_from_gpreg (gp);
  27. -}
  28. +#define elf_machine_dynamic() __extension__({ \
  29. + register ElfW(Addr) elf_machine_dynamic_gp __asm__("$28"); \
  30. + ElfW(Addr) elf_machine_dynamic_res; \
  31. + \
  32. + elf_machine_dynamic_res = *elf_mips_got_from_gpreg( \
  33. + elf_machine_dynamic_gp); \
  34. + (elf_machine_dynamic_res); \
  35. +})
  36. #define STRINGXP(X) __STRING(X)
  37. #define STRINGXV(X) STRINGV_(X)
  38. @@ -192,21 +195,20 @@
  39. #endif
  40. /* Return the run-time load address of the shared object. */
  41. -static __inline__ ElfW(Addr)
  42. -elf_machine_load_address (void)
  43. -{
  44. - ElfW(Addr) addr;
  45. - __asm__ (" .set noreorder\n"
  46. - " " STRINGXP (PTR_LA) " %0, 0f\n"
  47. - " bltzal $0, 0f\n"
  48. - " nop\n"
  49. - "0: " STRINGXP (PTR_SUBU) " %0, $31, %0\n"
  50. - " .set reorder\n"
  51. - : "=r" (addr)
  52. - : /* No inputs */
  53. - : "$31");
  54. - return addr;
  55. -}
  56. +#define elf_machine_load_address() __extension__({ \
  57. + ElfW(Addr) elf_machine_load_address_addr; \
  58. + \
  59. + __asm__ (" .set noreorder\n" \
  60. + " " STRINGXP (PTR_LA) " %0, 0f\n" \
  61. + " bltzal $0, 0f\n" \
  62. + " nop\n" \
  63. + "0: " STRINGXP (PTR_SUBU) " %0, $31, %0\n" \
  64. + " .set reorder\n" \
  65. + : "=r" (elf_machine_load_address_addr) \
  66. + : /* No inputs */ \
  67. + : "$31"); \
  68. + (elf_machine_load_address_addr); \
  69. +})
  70. static __inline__ void
  71. elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr,