0002-or1k-Use-cmodel-large-when-building-crtstuff.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From c544a63928406b706b8493fd9b8ca2136b433cf0 Mon Sep 17 00:00:00 2001
  2. From: Stafford Horne <shorne@gmail.com>
  3. Date: Wed, 21 Apr 2021 05:33:15 +0900
  4. Subject: [PATCH] or1k: Use cmodel=large when building crtstuff
  5. When linking gcc runtime objects into large binaries the link may fail
  6. with the below errors. This will happen even if we are building with
  7. -mcmodel=large.
  8. /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `deregister_tm_clones':
  9. crtstuff.c:(.text+0x3c): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_deregisterTMCloneTable'
  10. /home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `register_tm_clones':
  11. crtstuff.c:(.text+0xc0): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_registerTMCloneTable'
  12. This patch builds the gcc crtstuff binaries always with the
  13. -mcmodel=large option to ensure they can be linked into large binaries.
  14. libgcc/ChangeLog:
  15. PR target/99783
  16. * config.host (or1k-*, tmake_file): Add or1k/t-crtstuff.
  17. * config/or1k/t-crtstuff: New file.
  18. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  19. ---
  20. libgcc/config.host | 4 ++--
  21. libgcc/config/or1k/t-crtstuff | 2 ++
  22. 2 files changed, 4 insertions(+), 2 deletions(-)
  23. create mode 100644 libgcc/config/or1k/t-crtstuff
  24. diff --git a/libgcc/config.host b/libgcc/config.host
  25. index f2dc7e266f4..6f193c32fbd 100644
  26. --- a/libgcc/config.host
  27. +++ b/libgcc/config.host
  28. @@ -1132,12 +1132,12 @@ nios2-*-*)
  29. extra_parts="$extra_parts crti.o crtn.o"
  30. ;;
  31. or1k-*-linux*)
  32. - tmake_file="$tmake_file or1k/t-or1k"
  33. + tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
  34. tmake_file="$tmake_file t-softfp-sfdf t-softfp"
  35. md_unwind_header=or1k/linux-unwind.h
  36. ;;
  37. or1k-*-*)
  38. - tmake_file="$tmake_file or1k/t-or1k"
  39. + tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
  40. tmake_file="$tmake_file t-softfp-sfdf t-softfp"
  41. ;;
  42. pdp11-*-*)
  43. diff --git a/libgcc/config/or1k/t-crtstuff b/libgcc/config/or1k/t-crtstuff
  44. new file mode 100644
  45. index 00000000000..dcae7f3498e
  46. --- /dev/null
  47. +++ b/libgcc/config/or1k/t-crtstuff
  48. @@ -0,0 +1,2 @@
  49. +# Compile crtbeginS.o and crtendS.o with -mcmodel=large
  50. +CRTSTUFF_T_CFLAGS_S += -mcmodel=large
  51. --
  52. 2.35.1