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