mcm-gcc-13.3.0-merged.diff (22745B)
1 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/common.opt gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/common.opt 2 --- a/gcc/common.opt 2024-05-21 07:47:38.000000000 +0000 3 +++ b/gcc/common.opt 2025-11-30 02:12:28.000000000 +0000 4 @@ -3669,11 +3669,11 @@ Driver 5 6 no-pie 7 Driver RejectNegative Negative(shared) 8 -Don't create a dynamically linked position independent executable. 9 +Don't create a position independent executable. 10 11 pie 12 Driver RejectNegative Negative(no-pie) 13 -Create a dynamically linked position independent executable. 14 +Create a position independent executable. 15 16 static-pie 17 Driver RejectNegative Negative(pie) 18 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/gnu-user.h gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/gnu-user.h 19 --- a/gcc/config/gnu-user.h 2024-05-21 07:47:38.000000000 +0000 20 +++ b/gcc/config/gnu-user.h 2025-11-30 02:12:28.000000000 +0000 21 @@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTI 22 #define GNU_USER_TARGET_STARTFILE_SPEC \ 23 "%{shared:; \ 24 pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \ 25 - static:crt1.o%s; \ 26 - static-pie:rcrt1.o%s; \ 27 + static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \ 28 " PIE_SPEC ":Scrt1.o%s; \ 29 :crt1.o%s} " \ 30 GNU_USER_TARGET_CRTI " \ 31 - %{static:crtbeginT.o%s; \ 32 - shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \ 33 + %{shared|" PIE_SPEC ":crtbeginS.o%s; \ 34 + static:crtbeginT.o%s; \ 35 :crtbegin.o%s} \ 36 %{fvtable-verify=none:%s; \ 37 fvtable-verify=preinit:vtv_start_preinit.o%s; \ 38 @@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTI 39 GNU userspace "finalizer" file, `crtn.o'. */ 40 41 #define GNU_USER_TARGET_ENDFILE_SPEC \ 42 - "%{!static:%{fvtable-verify=none:%s; \ 43 + "%{static|static-pie:; \ 44 + fvtable-verify=none:%s; \ 45 fvtable-verify=preinit:vtv_end_preinit.o%s; \ 46 - fvtable-verify=std:vtv_end.o%s}} \ 47 - %{static:crtend.o%s; \ 48 - shared|static-pie|" PIE_SPEC ":crtendS.o%s; \ 49 + fvtable-verify=std:vtv_end.o%s} \ 50 + %{shared|" PIE_SPEC ":crtendS.o%s; \ 51 :crtend.o%s} " \ 52 GNU_USER_TARGET_CRTN " " \ 53 CRTOFFLOADEND 54 @@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTI 55 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC 56 57 #if defined(HAVE_LD_EH_FRAME_HDR) 58 -#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " 59 +#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} " 60 #endif 61 62 #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \ 63 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/i386/pmm_malloc.h gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/i386/pmm_malloc.h 64 --- a/gcc/config/i386/pmm_malloc.h 2024-05-21 07:47:38.000000000 +0000 65 +++ b/gcc/config/i386/pmm_malloc.h 2025-11-30 02:11:23.000000000 +0000 66 @@ -27,12 +27,13 @@ 67 #include <stdlib.h> 68 69 /* We can't depend on <stdlib.h> since the prototype of posix_memalign 70 - may not be visible. */ 71 + may not be visible and we can't pollute the namespace either. */ 72 #ifndef __cplusplus 73 -extern int posix_memalign (void **, size_t, size_t); 74 +extern int _mm_posix_memalign (void **, size_t, size_t) 75 #else 76 -extern "C" int posix_memalign (void **, size_t, size_t) throw (); 77 +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw () 78 #endif 79 +__asm__("posix_memalign"); 80 81 static __inline void * 82 _mm_malloc (size_t __size, size_t __alignment) 83 @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alig 84 return malloc (__size); 85 if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) 86 __alignment = sizeof (void *); 87 - if (posix_memalign (&__ptr, __alignment, __size) == 0) 88 + if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0) 89 return __ptr; 90 else 91 return NULL; 92 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/m68k/m68k.md gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/m68k/m68k.md 93 --- a/gcc/config/m68k/m68k.md 2024-05-21 07:47:38.000000000 +0000 94 +++ b/gcc/config/m68k/m68k.md 2025-11-30 02:13:02.000000000 +0000 95 @@ -4174,13 +4174,13 @@ 96 (define_expand "sqrt<mode>2" 97 [(set (match_operand:FP 0 "nonimmediate_operand" "") 98 (sqrt:FP (match_operand:FP 1 "general_operand" "")))] 99 - "TARGET_HARD_FLOAT" 100 + "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU" 101 "") 102 103 (define_insn "sqrt<mode>2_68881" 104 [(set (match_operand:FP 0 "nonimmediate_operand" "=f") 105 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))] 106 - "TARGET_68881" 107 + "TARGET_68881 && TARGET_68040" 108 { 109 if (FP_REG_P (operands[1])) 110 return "f<FP:round>sqrt%.x %1,%0"; 111 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/sh/sh.cc gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/sh/sh.cc 112 --- a/gcc/config/sh/sh.cc 2024-05-21 07:47:38.000000000 +0000 113 +++ b/gcc/config/sh/sh.cc 2025-11-30 02:15:17.933966271 +0000 114 @@ -686,6 +686,7 @@ parse_validate_atomic_model_option (cons 115 model_names[sh_atomic_model::hard_llcs] = "hard-llcs"; 116 model_names[sh_atomic_model::soft_tcb] = "soft-tcb"; 117 model_names[sh_atomic_model::soft_imask] = "soft-imask"; 118 + model_names[sh_atomic_model::hard_cas] = "hard-cas"; 119 120 const char* model_cdef_names[sh_atomic_model::num_models]; 121 model_cdef_names[sh_atomic_model::none] = "NONE"; 122 @@ -693,6 +694,7 @@ parse_validate_atomic_model_option (cons 123 model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS"; 124 model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB"; 125 model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK"; 126 + model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS"; 127 128 sh_atomic_model ret; 129 ret.type = sh_atomic_model::none; 130 @@ -771,6 +773,9 @@ got_mode_name:; 131 if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE) 132 err_ret ("cannot use atomic model %s in user mode", ret.name); 133 134 + if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2) 135 + err_ret ("atomic model %s is only available J2 targets", ret.name); 136 + 137 return ret; 138 139 #undef err_ret 140 @@ -827,6 +832,8 @@ sh_option_override (void) 141 sh_cpu = PROCESSOR_SH2E; 142 if (TARGET_SH2A) 143 sh_cpu = PROCESSOR_SH2A; 144 + if (TARGET_SHJ2) 145 + sh_cpu = PROCESSOR_SHJ2; 146 if (TARGET_SH3) 147 sh_cpu = PROCESSOR_SH3; 148 if (TARGET_SH3E) 149 @@ -9141,7 +9148,7 @@ legitimize_pic_address (rtx orig, machin 150 { 151 /* Weak functions may be NULL which doesn't work with 152 GOTOFFFUNCDESC because the runtime offset is not known. */ 153 - if (SYMBOL_REF_WEAK (orig)) 154 + if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN)) 155 emit_insn (gen_symGOTFUNCDESC2reg (reg, orig)); 156 else 157 emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig)); 158 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/sh/sh.h gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/sh/sh.h 159 --- a/gcc/config/sh/sh.h 2024-05-21 07:47:38.000000000 +0000 160 +++ b/gcc/config/sh/sh.h 2025-11-30 02:11:55.000000000 +0000 161 @@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratc 162 #define SUPPORT_SH4_SINGLE 1 163 #define SUPPORT_SH2A 1 164 #define SUPPORT_SH2A_SINGLE 1 165 +#define SUPPORT_SHJ2 1 166 #endif 167 168 #define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1) 169 @@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratc 170 #define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY) 171 #define SELECT_SH4A (MASK_SH4A | SELECT_SH4) 172 #define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE) 173 +#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2) 174 175 #if SUPPORT_SH1 176 #define SUPPORT_SH2 1 177 @@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratc 178 #if SUPPORT_SH2 179 #define SUPPORT_SH3 1 180 #define SUPPORT_SH2A_NOFPU 1 181 +#define SUPPORT_SHJ2 1 182 #endif 183 #if SUPPORT_SH3 184 #define SUPPORT_SH4_NOFPU 1 185 @@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratc 186 #define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \ 187 | MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \ 188 | MASK_HARD_SH4 | MASK_FPU_SINGLE \ 189 - | MASK_FPU_SINGLE_ONLY) 190 + | MASK_FPU_SINGLE_ONLY | MASK_SHJ2) 191 192 /* This defaults us to big-endian. */ 193 #ifndef TARGET_ENDIAN_DEFAULT 194 @@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratc 195 %{m2a-single:--isa=sh2a} \ 196 %{m2a-single-only:--isa=sh2a} \ 197 %{m2a-nofpu:--isa=sh2a-nofpu} \ 198 -%{m4al:-dsp}" 199 +%{m4al:-dsp} \ 200 +%{mj2:-isa=j2}" 201 202 #define ASM_SPEC SH_ASM_SPEC 203 204 @@ -347,6 +351,7 @@ struct sh_atomic_model 205 hard_llcs, 206 soft_tcb, 207 soft_imask, 208 + hard_cas, 209 210 num_models 211 }; 212 @@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_a 213 #define TARGET_ATOMIC_SOFT_IMASK \ 214 (selected_atomic_model ().type == sh_atomic_model::soft_imask) 215 216 +#define TARGET_ATOMIC_HARD_CAS \ 217 + (selected_atomic_model ().type == sh_atomic_model::hard_cas) 218 + 219 #endif // __cplusplus 220 221 #define SUBTARGET_OVERRIDE_OPTIONS (void) 0 222 @@ -1484,7 +1492,7 @@ extern bool current_function_interrupt; 223 224 /* Nonzero if the target supports dynamic shift instructions 225 like shad and shld. */ 226 -#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A) 227 +#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2) 228 229 /* The cost of using the dynamic shift insns (shad, shld) are the same 230 if they are available. If they are not available a library function will 231 @@ -1747,6 +1755,7 @@ enum processor_type { 232 PROCESSOR_SH2, 233 PROCESSOR_SH2E, 234 PROCESSOR_SH2A, 235 + PROCESSOR_SHJ2, 236 PROCESSOR_SH3, 237 PROCESSOR_SH3E, 238 PROCESSOR_SH4, 239 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/sh/sh.opt gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/sh/sh.opt 240 --- a/gcc/config/sh/sh.opt 2024-05-21 07:47:38.000000000 +0000 241 +++ b/gcc/config/sh/sh.opt 2025-11-30 02:11:55.000000000 +0000 242 @@ -65,6 +65,10 @@ m2e 243 Target RejectNegative Condition(SUPPORT_SH2E) 244 Generate SH2e code. 245 246 +mj2 247 +Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2) 248 +Generate J2 code. 249 + 250 m3 251 Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3) 252 Generate SH3 code. 253 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/sh/sync.md gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/sh/sync.md 254 --- a/gcc/config/sh/sync.md 2024-05-21 07:47:38.000000000 +0000 255 +++ b/gcc/config/sh/sync.md 2025-11-30 02:11:55.000000000 +0000 256 @@ -240,6 +240,9 @@ 257 || (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT)) 258 atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem, 259 exp_val, new_val); 260 + else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode) 261 + atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem, 262 + exp_val, new_val); 263 else if (TARGET_ATOMIC_SOFT_GUSA) 264 atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem, 265 exp_val, new_val); 266 @@ -306,6 +309,57 @@ 267 } 268 [(set_attr "length" "14")]) 269 270 +(define_expand "atomic_compare_and_swapsi_cas" 271 + [(set (match_operand:SI 0 "register_operand" "=r") 272 + (unspec_volatile:SI 273 + [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") 274 + (match_operand:SI 2 "register_operand" "r") 275 + (match_operand:SI 3 "register_operand" "r")] 276 + UNSPECV_CMPXCHG_1))] 277 + "TARGET_ATOMIC_HARD_CAS" 278 +{ 279 + rtx mem = gen_rtx_REG (SImode, 0); 280 + emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0))); 281 + emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3])); 282 + DONE; 283 +}) 284 + 285 +(define_insn "shj2_cas" 286 + [(set (match_operand:SI 0 "register_operand" "=&r") 287 + (unspec_volatile:SI 288 + [(match_operand:SI 1 "register_operand" "=r") 289 + (match_operand:SI 2 "register_operand" "r") 290 + (match_operand:SI 3 "register_operand" "0")] 291 + UNSPECV_CMPXCHG_1)) 292 + (set (reg:SI T_REG) 293 + (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))] 294 + "TARGET_ATOMIC_HARD_CAS" 295 + "cas.l %2,%0,@%1" 296 + [(set_attr "length" "2")] 297 +) 298 + 299 +(define_expand "atomic_compare_and_swapqi_cas" 300 + [(set (match_operand:SI 0 "arith_reg_dest" "=&r") 301 + (unspec_volatile:SI 302 + [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") 303 + (match_operand:SI 2 "arith_operand" "rI08") 304 + (match_operand:SI 3 "arith_operand" "rI08")] 305 + UNSPECV_CMPXCHG_1))] 306 + "TARGET_ATOMIC_HARD_CAS" 307 +{FAIL;} 308 +) 309 + 310 +(define_expand "atomic_compare_and_swaphi_cas" 311 + [(set (match_operand:SI 0 "arith_reg_dest" "=&r") 312 + (unspec_volatile:SI 313 + [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra") 314 + (match_operand:SI 2 "arith_operand" "rI08") 315 + (match_operand:SI 3 "arith_operand" "rI08")] 316 + UNSPECV_CMPXCHG_1))] 317 + "TARGET_ATOMIC_HARD_CAS" 318 +{FAIL;} 319 +) 320 + 321 ;; The QIHImode llcs patterns modify the address register of the memory 322 ;; operand. In order to express that, we have to open code the memory 323 ;; operand. Initially the insn is expanded like every other atomic insn 324 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config/sh/t-sh gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config/sh/t-sh 325 --- a/gcc/config/sh/t-sh 2024-05-21 07:47:38.000000000 +0000 326 +++ b/gcc/config/sh/t-sh 2025-11-30 02:11:55.000000000 +0000 327 @@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \ 328 m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \ 329 m2a-single,m2a-single-only \ 330 m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \ 331 - m4,m4-100,m4-200,m4-300,m4a; do \ 332 + m4,m4-100,m4-200,m4-300,m4a \ 333 + mj2; do \ 334 subst= ; \ 335 for lib in `echo $$abi|tr , ' '` ; do \ 336 if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \ 337 @@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \ 338 339 # SH1 and SH2A support big endian only. 340 ifeq ($(DEFAULT_ENDIAN),ml) 341 -MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG) 342 +MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG) 343 else 344 -MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG) 345 +MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG) 346 endif 347 348 MULTILIB_OSDIRNAMES = \ 349 @@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \ 350 m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \ 351 m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \ 352 m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \ 353 - m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al 354 + m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \ 355 + mj2=!j2 356 357 $(out_object_file): gt-sh.h 358 gt-sh.h : s-gtype ; @true 359 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/config.gcc gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/config.gcc 360 --- a/gcc/config.gcc 2024-05-21 07:47:38.000000000 +0000 361 +++ b/gcc/config.gcc 2025-11-30 02:11:55.000000000 +0000 362 @@ -558,7 +558,7 @@ s390*-*-*) 363 extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h" 364 ;; 365 # Note the 'l'; we need to be able to match e.g. "shle" or "shl". 366 -sh[123456789lbe]*-*-* | sh-*-*) 367 +sh[123456789lbej]*-*-* | sh-*-*) 368 cpu_type=sh 369 extra_options="${extra_options} fused-madd.opt" 370 extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o" 371 @@ -3179,18 +3179,18 @@ s390x-ibm-tpf*) 372 extra_options="${extra_options} s390/tpf.opt" 373 tmake_file="${tmake_file} s390/t-s390" 374 ;; 375 -sh-*-elf* | sh[12346l]*-*-elf* | \ 376 - sh-*-linux* | sh[2346lbe]*-*-linux* | \ 377 +sh-*-elf* | sh[12346lj]*-*-elf* | \ 378 + sh-*-linux* | sh[2346lbej]*-*-linux* | \ 379 sh-*-netbsdelf* | shl*-*-netbsdelf*) 380 tmake_file="${tmake_file} sh/t-sh sh/t-elf" 381 if test x${with_endian} = x; then 382 case ${target} in 383 - sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;; 384 + sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;; 385 shbe-*-* | sheb-*-*) with_endian=big,little ;; 386 sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;; 387 shl* | sh*-*-linux* | \ 388 sh-superh-elf) with_endian=little,big ;; 389 - sh[1234]*-*-*) with_endian=big ;; 390 + sh[j1234]*-*-*) with_endian=big ;; 391 *) with_endian=big,little ;; 392 esac 393 fi 394 @@ -3257,6 +3257,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ 395 sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;; 396 sh2a*) sh_cpu_target=sh2a ;; 397 sh2e*) sh_cpu_target=sh2e ;; 398 + shj2*) sh_cpu_target=shj2;; 399 sh2*) sh_cpu_target=sh2 ;; 400 *) sh_cpu_target=sh1 ;; 401 esac 402 @@ -3278,7 +3279,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ 403 sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \ 404 sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \ 405 sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \ 406 - sh3e | sh3 | sh2e | sh2 | sh1) ;; 407 + sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;; 408 "") sh_cpu_default=${sh_cpu_target} ;; 409 *) echo "with_cpu=$with_cpu not supported"; exit 1 ;; 410 esac 411 @@ -3287,9 +3288,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ 412 case ${target} in 413 sh[1234]*) sh_multilibs=${sh_cpu_target} ;; 414 sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; 415 - sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;; 416 + sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;; 417 sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;; 418 - *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;; 419 + *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;; 420 esac 421 if test x$with_fp = xno; then 422 sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`" 423 @@ -3304,7 +3305,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ 424 m1 | m2 | m2e | m3 | m3e | \ 425 m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\ 426 m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \ 427 - m2a | m2a-single | m2a-single-only | m2a-nofpu) 428 + m2a | m2a-single | m2a-single-only | m2a-nofpu | \ 429 + mj2) 430 # TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition 431 # It is passed to MULTIILIB_OPTIONS verbatim. 432 TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}" 433 @@ -3321,7 +3323,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \ 434 done 435 TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'` 436 if test x${enable_incomplete_targets} = xyes ; then 437 - tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1" 438 + tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1" 439 fi 440 tm_file="$tm_file ./sysroot-suffix.h" 441 tmake_file="$tmake_file t-sysroot-suffix" 442 @@ -5517,6 +5519,8 @@ case "${target}" in 443 ;; 444 m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al) 445 ;; 446 + mj2) 447 + ;; 448 *) 449 echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2 450 echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2 451 @@ -5783,7 +5787,7 @@ case ${target} in 452 tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}" 453 ;; 454 455 - sh[123456ble]*-*-* | sh-*-*) 456 + sh[123456blej]*-*-* | sh-*-*) 457 c_target_objs="${c_target_objs} sh-c.o" 458 cxx_target_objs="${cxx_target_objs} sh-c.o" 459 ;; 460 diff -ru --no-dereference --show-c-function gcc-13.3.0/gcc/gcc.cc gcc-13.3.0-0009-sh-fdpic-pr114641/gcc/gcc.cc 461 --- a/gcc/gcc.cc 2024-05-21 07:47:38.000000000 +0000 462 +++ b/gcc/gcc.cc 2025-11-30 02:12:28.000000000 +0000 463 @@ -974,7 +974,8 @@ proper position among the other output f 464 #ifndef LINK_SSP_SPEC 465 #ifdef TARGET_LIBC_PROVIDES_SSP 466 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 467 - "|fstack-protector-strong|fstack-protector-explicit:}" 468 + "|fstack-protector-strong|fstack-protector-explicit" \ 469 + ":-lssp_nonshared}" 470 #else 471 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 472 "|fstack-protector-strong|fstack-protector-explicit" \ 473 @@ -1003,7 +1004,7 @@ proper position among the other output f 474 #define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC 475 #define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;" 476 #else 477 -#define PIE_SPEC "pie" 478 +#define PIE_SPEC "pie|static-pie" 479 #define FPIE1_SPEC "fpie" 480 #define NO_FPIE1_SPEC FPIE1_SPEC ":;" 481 #define FPIE2_SPEC "fPIE" 482 @@ -1027,12 +1028,12 @@ proper position among the other output f 483 #ifndef LINK_PIE_SPEC 484 #ifdef HAVE_LD_PIE 485 #ifndef LD_PIE_SPEC 486 -#define LD_PIE_SPEC "-pie" 487 +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}" 488 #endif 489 #else 490 #define LD_PIE_SPEC "" 491 #endif 492 -#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " 493 +#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " 494 #endif 495 496 #ifndef LINK_BUILDID_SPEC 497 diff -ru --no-dereference --show-c-function gcc-13.3.0/libgcc/crtstuff.c gcc-13.3.0-0009-sh-fdpic-pr114641/libgcc/crtstuff.c 498 --- a/libgcc/crtstuff.c 2024-05-21 07:47:41.000000000 +0000 499 +++ b/libgcc/crtstuff.c 2025-11-30 02:14:43.000000000 +0000 500 @@ -442,17 +442,9 @@ __do_global_dtors_aux (void) 501 #ifdef FINI_SECTION_ASM_OP 502 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux) 503 #elif defined (FINI_ARRAY_SECTION_ASM_OP) 504 -#if defined(__FDPIC__) 505 -__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n"); 506 -extern char __do_global_dtors_aux_alias; 507 -static void *__do_global_dtors_aux_fini_array_entry[] 508 -__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *)))) 509 - = { &__do_global_dtors_aux_alias }; 510 -#else /* defined(__FDPIC__) */ 511 static func_ptr __do_global_dtors_aux_fini_array_entry[] 512 __attribute__ ((__used__, section(".fini_array"), 513 aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux }; 514 -#endif /* defined(__FDPIC__) */ 515 #else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */ 516 static void __attribute__((used)) 517 __do_global_dtors_aux_1 (void) 518 @@ -495,17 +487,9 @@ frame_dummy (void) 519 #ifdef __LIBGCC_INIT_SECTION_ASM_OP__ 520 CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy) 521 #else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ 522 -#if defined(__FDPIC__) 523 -__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n"); 524 -extern char __frame_dummy_alias; 525 -static void *__frame_dummy_init_array_entry[] 526 -__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *)))) 527 - = { &__frame_dummy_alias }; 528 -#else /* defined(__FDPIC__) */ 529 static func_ptr __frame_dummy_init_array_entry[] 530 __attribute__ ((__used__, section(".init_array"), 531 aligned(__alignof__(func_ptr)))) = { frame_dummy }; 532 -#endif /* defined(__FDPIC__) */ 533 #endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ 534 #endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */ 535 536 diff -ru --no-dereference --show-c-function gcc-13.3.0/libgcc/unwind-pe.h gcc-13.3.0-0009-sh-fdpic-pr114641/libgcc/unwind-pe.h 537 --- a/libgcc/unwind-pe.h 2024-05-21 07:47:41.000000000 +0000 538 +++ b/libgcc/unwind-pe.h 2025-11-30 02:14:09.000000000 +0000 539 @@ -262,7 +262,7 @@ read_encoded_value_with_base (unsigned c 540 541 if (result != 0) 542 { 543 -#if __FDPIC__ 544 +#if __FDPIC__ && __arm__ 545 /* FDPIC relative addresses imply taking the GOT address 546 into account. */ 547 if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))