860-uclibc_use_eh_frame.patch 1.2 KB

1234567891011121314151617181920212223242526272829
  1. --- a/gcc/crtstuff.c
  2. +++ b/gcc/crtstuff.c
  3. @@ -100,15 +100,20 @@ call_ ## FUNC (void) \
  4. #if defined(OBJECT_FORMAT_ELF) \
  5. && !defined(OBJECT_FORMAT_FLAT) \
  6. && defined(HAVE_LD_EH_FRAME_HDR) \
  7. - && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
  8. - && defined(__GLIBC__) && __GLIBC__ >= 2
  9. + && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
  10. #include <link.h>
  11. /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
  12. But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
  13. -# if !defined(__UCLIBC__) \
  14. - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
  15. - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
  16. -# define USE_PT_GNU_EH_FRAME
  17. +# if defined(__UCLIBC__)
  18. +# if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
  19. + (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
  20. +# define USE_PT_GNU_EH_FRAME
  21. +# endif
  22. +# elif defined(__GLIBC__)
  23. +# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
  24. + || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
  25. +# define USE_PT_GNU_EH_FRAME
  26. +# endif
  27. # endif
  28. #endif
  29. #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)