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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From f75178ccd2f5e4d73e27cccffffada859b87be7d 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. Upstream: da8a9d695b3c4b9397b5d9a27660bfa48af8d707
  19. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  20. [Romain: add Upstream tag]
  21. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  22. ---
  23. libgcc/config.host | 4 ++--
  24. libgcc/config/or1k/t-crtstuff | 2 ++
  25. 2 files changed, 4 insertions(+), 2 deletions(-)
  26. create mode 100644 libgcc/config/or1k/t-crtstuff
  27. diff --git a/libgcc/config.host b/libgcc/config.host
  28. index 45f8e19ada4..5523345abb0 100644
  29. --- a/libgcc/config.host
  30. +++ b/libgcc/config.host
  31. @@ -1150,12 +1150,12 @@ nios2-*-*)
  32. extra_parts="$extra_parts crti.o crtn.o"
  33. ;;
  34. or1k-*-linux*)
  35. - tmake_file="$tmake_file or1k/t-or1k"
  36. + tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
  37. tmake_file="$tmake_file t-softfp-sfdf t-softfp"
  38. md_unwind_header=or1k/linux-unwind.h
  39. ;;
  40. or1k-*-*)
  41. - tmake_file="$tmake_file or1k/t-or1k"
  42. + tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
  43. tmake_file="$tmake_file t-softfp-sfdf t-softfp"
  44. ;;
  45. pdp11-*-*)
  46. diff --git a/libgcc/config/or1k/t-crtstuff b/libgcc/config/or1k/t-crtstuff
  47. new file mode 100644
  48. index 00000000000..dcae7f3498e
  49. --- /dev/null
  50. +++ b/libgcc/config/or1k/t-crtstuff
  51. @@ -0,0 +1,2 @@
  52. +# Compile crtbeginS.o and crtendS.o with -mcmodel=large
  53. +CRTSTUFF_T_CFLAGS_S += -mcmodel=large
  54. --
  55. 2.34.3