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