mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

mcm-gcc-9.4.0-merged.diff (37302B)


      1 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/builtins.c gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/builtins.c
      2 --- a/gcc/builtins.c	2021-06-01 07:53:04.000000000 +0000
      3 +++ b/gcc/builtins.c	2025-11-30 03:36:20.000000000 +0000
      4 @@ -4656,6 +4656,7 @@ expand_cmpstr (insn_code icode, rtx targ
      5  static rtx
      6  expand_builtin_memcmp (tree exp, rtx target, bool result_eq)
      7  {
      8 +  return NULL_RTX;
      9    if (!validate_arglist (exp,
     10   			 POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
     11      return NULL_RTX;
     12 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/common.opt gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/common.opt
     13 --- a/gcc/common.opt	2021-06-01 07:53:04.000000000 +0000
     14 +++ b/gcc/common.opt	2025-11-30 03:33:53.000000000 +0000
     15 @@ -3287,11 +3287,11 @@ Driver
     16  
     17  no-pie
     18  Driver RejectNegative Negative(shared)
     19 -Don't create a dynamically linked position independent executable.
     20 +Don't create a position independent executable.
     21  
     22  pie
     23  Driver RejectNegative Negative(no-pie)
     24 -Create a dynamically linked position independent executable.
     25 +Create a position independent executable.
     26  
     27  static-pie
     28  Driver RejectNegative Negative(pie)
     29 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/gnu-user.h gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/gnu-user.h
     30 --- a/gcc/config/gnu-user.h	2021-06-01 07:53:04.000000000 +0000
     31 +++ b/gcc/config/gnu-user.h	2025-11-30 03:33:53.000000000 +0000
     32 @@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTI
     33  #define GNU_USER_TARGET_STARTFILE_SPEC \
     34    "%{shared:; \
     35       pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
     36 -     static:crt1.o%s; \
     37 -     static-pie:rcrt1.o%s; \
     38 +     static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
     39       " PIE_SPEC ":Scrt1.o%s; \
     40       :crt1.o%s} " \
     41     GNU_USER_TARGET_CRTI " \
     42 -   %{static:crtbeginT.o%s; \
     43 -     shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
     44 +   %{shared|" PIE_SPEC ":crtbeginS.o%s; \
     45 +     static:crtbeginT.o%s; \
     46       :crtbegin.o%s} \
     47     %{fvtable-verify=none:%s; \
     48       fvtable-verify=preinit:vtv_start_preinit.o%s; \
     49 @@ -76,8 +75,7 @@ see the files COPYING3 and COPYING.RUNTI
     50    "%{fvtable-verify=none:%s; \
     51       fvtable-verify=preinit:vtv_end_preinit.o%s; \
     52       fvtable-verify=std:vtv_end.o%s} \
     53 -   %{static:crtend.o%s; \
     54 -     shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
     55 +   %{shared|" PIE_SPEC ":crtendS.o%s; \
     56       :crtend.o%s} " \
     57     GNU_USER_TARGET_CRTN " " \
     58     CRTOFFLOADEND
     59 @@ -106,7 +104,7 @@ see the files COPYING3 and COPYING.RUNTI
     60  #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
     61  
     62  #if defined(HAVE_LD_EH_FRAME_HDR)
     63 -#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
     64 +#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
     65  #endif
     66  
     67  #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
     68 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/i386/pmm_malloc.h gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/i386/pmm_malloc.h
     69 --- a/gcc/config/i386/pmm_malloc.h	2021-06-01 07:53:04.000000000 +0000
     70 +++ b/gcc/config/i386/pmm_malloc.h	2025-11-30 03:30:01.000000000 +0000
     71 @@ -27,12 +27,13 @@
     72  #include <stdlib.h>
     73  
     74  /* We can't depend on <stdlib.h> since the prototype of posix_memalign
     75 -   may not be visible.  */
     76 +   may not be visible and we can't pollute the namespace either.  */
     77  #ifndef __cplusplus
     78 -extern int posix_memalign (void **, size_t, size_t);
     79 +extern int _mm_posix_memalign (void **, size_t, size_t)
     80  #else
     81 -extern "C" int posix_memalign (void **, size_t, size_t) throw ();
     82 +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
     83  #endif
     84 +__asm__("posix_memalign");
     85  
     86  static __inline void *
     87  _mm_malloc (size_t __size, size_t __alignment)
     88 @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alig
     89      return malloc (__size);
     90    if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
     91      __alignment = sizeof (void *);
     92 -  if (posix_memalign (&__ptr, __alignment, __size) == 0)
     93 +  if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
     94      return __ptr;
     95    else
     96      return NULL;
     97 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/m68k/linux.h gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/m68k/linux.h
     98 --- a/gcc/config/m68k/linux.h	2021-06-01 07:53:04.000000000 +0000
     99 +++ b/gcc/config/m68k/linux.h	2025-11-30 03:33:28.000000000 +0000
    100 @@ -73,6 +73,9 @@ along with GCC; see the file COPYING3.
    101  
    102  #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
    103  
    104 +#undef MUSL_DYNAMIC_LINKER
    105 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-m68k.so.1"
    106 +
    107  #undef LINK_SPEC
    108  #define LINK_SPEC "-m m68kelf %{shared} \
    109    %{!shared: \
    110 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/m68k/m68k.md gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/m68k/m68k.md
    111 --- a/gcc/config/m68k/m68k.md	2021-06-01 07:53:04.000000000 +0000
    112 +++ b/gcc/config/m68k/m68k.md	2025-11-30 03:35:55.000000000 +0000
    113 @@ -4126,13 +4126,13 @@
    114  (define_expand "sqrt<mode>2"
    115    [(set (match_operand:FP 0 "nonimmediate_operand" "")
    116  	(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
    117 -  "TARGET_HARD_FLOAT"
    118 +  "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
    119    "")
    120  
    121  (define_insn "sqrt<mode>2_68881"
    122    [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
    123  	(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
    124 -  "TARGET_68881"
    125 +  "TARGET_68881 && TARGET_68040"
    126  {
    127    if (FP_REG_P (operands[1]))
    128      return "f<FP:round>sqrt%.x %1,%0";
    129 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/microblaze/microblaze.c gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/microblaze/microblaze.c
    130 --- a/gcc/config/microblaze/microblaze.c	2021-06-01 07:53:04.000000000 +0000
    131 +++ b/gcc/config/microblaze/microblaze.c	2025-11-30 03:32:40.000000000 +0000
    132 @@ -2476,7 +2476,7 @@ print_operand (FILE * file, rtx op, int
    133  	  unsigned long value_long;
    134  	  REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op),
    135  				       value_long);
    136 -	  fprintf (file, HOST_WIDE_INT_PRINT_HEX, value_long);
    137 +	  fprintf (file, "0x%lx", value_long);
    138  	}
    139        else
    140  	{
    141 @@ -2535,7 +2535,7 @@ print_operand (FILE * file, rtx op, int
    142        print_operand_address (file, XEXP (op, 0));
    143      }
    144    else if (letter == 'm')
    145 -    fprintf (file, HOST_WIDE_INT_PRINT_DEC, (1L << INTVAL (op)));
    146 +    fprintf (file, "%ld", (1L << INTVAL (op)));
    147    else
    148      output_addr_const (file, op);
    149  }
    150 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/riscv/riscv.c gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/riscv/riscv.c
    151 --- a/gcc/config/riscv/riscv.c	2021-06-01 07:53:04.000000000 +0000
    152 +++ b/gcc/config/riscv/riscv.c	2025-11-30 03:35:06.000000000 +0000
    153 @@ -1257,9 +1257,11 @@ riscv_legitimize_tls_address (rtx loc)
    154    rtx dest, tp, tmp;
    155    enum tls_model model = SYMBOL_REF_TLS_MODEL (loc);
    156  
    157 +#if 0
    158    /* Since we support TLS copy relocs, non-PIC TLS accesses may all use LE.  */
    159    if (!flag_pic)
    160      model = TLS_MODEL_LOCAL_EXEC;
    161 +#endif
    162  
    163    switch (model)
    164      {
    165 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/s390/linux.h gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/s390/linux.h
    166 --- a/gcc/config/s390/linux.h	2021-06-01 07:53:04.000000000 +0000
    167 +++ b/gcc/config/s390/linux.h	2025-11-30 03:32:16.000000000 +0000
    168 @@ -75,6 +75,9 @@ along with GCC; see the file COPYING3.
    169  #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
    170  #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
    171  
    172 +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
    173 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
    174 +
    175  #undef  LINK_SPEC
    176  #define LINK_SPEC \
    177    "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
    178 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/sh/sh.c gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/sh/sh.c
    179 --- a/gcc/config/sh/sh.c	2021-06-01 07:53:04.000000000 +0000
    180 +++ b/gcc/config/sh/sh.c	2025-11-30 03:36:45.017148662 +0000
    181 @@ -689,6 +689,7 @@ parse_validate_atomic_model_option (cons
    182    model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
    183    model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
    184    model_names[sh_atomic_model::soft_imask] = "soft-imask";
    185 +  model_names[sh_atomic_model::hard_cas] = "hard-cas";
    186  
    187    const char* model_cdef_names[sh_atomic_model::num_models];
    188    model_cdef_names[sh_atomic_model::none] = "NONE";
    189 @@ -696,6 +697,7 @@ parse_validate_atomic_model_option (cons
    190    model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
    191    model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
    192    model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
    193 +  model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
    194  
    195    sh_atomic_model ret;
    196    ret.type = sh_atomic_model::none;
    197 @@ -774,6 +776,9 @@ got_mode_name:;
    198    if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
    199      err_ret ("cannot use atomic model %s in user mode", ret.name);
    200  
    201 +  if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
    202 +    err_ret ("atomic model %s is only available J2 targets", ret.name);
    203 +
    204    return ret;
    205  
    206  #undef err_ret
    207 @@ -830,6 +835,8 @@ sh_option_override (void)
    208      sh_cpu = PROCESSOR_SH2E;
    209    if (TARGET_SH2A)
    210      sh_cpu = PROCESSOR_SH2A;
    211 +  if (TARGET_SHJ2)
    212 +    sh_cpu = PROCESSOR_SHJ2;
    213    if (TARGET_SH3)
    214      sh_cpu = PROCESSOR_SH3;
    215    if (TARGET_SH3E)
    216 @@ -9161,7 +9168,7 @@ legitimize_pic_address (rtx orig, machin
    217  	{
    218  	  /* Weak functions may be NULL which doesn't work with
    219  	     GOTOFFFUNCDESC because the runtime offset is not known.  */
    220 -	  if (SYMBOL_REF_WEAK (orig))
    221 +	  if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
    222  	    emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
    223  	  else
    224  	    emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));
    225 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/sh/sh.h gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/sh/sh.h
    226 --- a/gcc/config/sh/sh.h	2021-06-01 07:53:04.000000000 +0000
    227 +++ b/gcc/config/sh/sh.h	2025-11-30 03:31:53.000000000 +0000
    228 @@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratc
    229  #define SUPPORT_SH4_SINGLE 1
    230  #define SUPPORT_SH2A 1
    231  #define SUPPORT_SH2A_SINGLE 1
    232 +#define SUPPORT_SHJ2 1
    233  #endif
    234  
    235  #define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
    236 @@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratc
    237  #define SELECT_SH4A_SINGLE_ONLY  (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
    238  #define SELECT_SH4A		 (MASK_SH4A | SELECT_SH4)
    239  #define SELECT_SH4A_SINGLE	 (MASK_SH4A | SELECT_SH4_SINGLE)
    240 +#define SELECT_SHJ2		 (MASK_SHJ2 | SELECT_SH2)
    241  
    242  #if SUPPORT_SH1
    243  #define SUPPORT_SH2 1
    244 @@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratc
    245  #if SUPPORT_SH2
    246  #define SUPPORT_SH3 1
    247  #define SUPPORT_SH2A_NOFPU 1
    248 +#define SUPPORT_SHJ2 1
    249  #endif
    250  #if SUPPORT_SH3
    251  #define SUPPORT_SH4_NOFPU 1
    252 @@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratc
    253  #define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
    254  		   | MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
    255  		   | MASK_HARD_SH4 | MASK_FPU_SINGLE \
    256 -		   | MASK_FPU_SINGLE_ONLY)
    257 +		   | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
    258  
    259  /* This defaults us to big-endian.  */
    260  #ifndef TARGET_ENDIAN_DEFAULT
    261 @@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratc
    262  %{m2a-single:--isa=sh2a} \
    263  %{m2a-single-only:--isa=sh2a} \
    264  %{m2a-nofpu:--isa=sh2a-nofpu} \
    265 -%{m4al:-dsp}"
    266 +%{m4al:-dsp} \
    267 +%{mj2:-isa=j2}"
    268  
    269  #define ASM_SPEC SH_ASM_SPEC
    270  
    271 @@ -347,6 +351,7 @@ struct sh_atomic_model
    272      hard_llcs,
    273      soft_tcb,
    274      soft_imask,
    275 +    hard_cas,
    276  
    277      num_models
    278    };
    279 @@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_a
    280  #define TARGET_ATOMIC_SOFT_IMASK \
    281    (selected_atomic_model ().type == sh_atomic_model::soft_imask)
    282  
    283 +#define TARGET_ATOMIC_HARD_CAS \
    284 +  (selected_atomic_model ().type == sh_atomic_model::hard_cas)
    285 +
    286  #endif // __cplusplus
    287  
    288  #define SUBTARGET_OVERRIDE_OPTIONS (void) 0
    289 @@ -1523,7 +1531,7 @@ extern bool current_function_interrupt;
    290  
    291  /* Nonzero if the target supports dynamic shift instructions
    292     like shad and shld.  */
    293 -#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
    294 +#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
    295  
    296  /* The cost of using the dynamic shift insns (shad, shld) are the same
    297     if they are available.  If they are not available a library function will
    298 @@ -1786,6 +1794,7 @@ enum processor_type {
    299    PROCESSOR_SH2,
    300    PROCESSOR_SH2E,
    301    PROCESSOR_SH2A,
    302 +  PROCESSOR_SHJ2,
    303    PROCESSOR_SH3,
    304    PROCESSOR_SH3E,
    305    PROCESSOR_SH4,
    306 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/sh/sh.opt gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/sh/sh.opt
    307 --- a/gcc/config/sh/sh.opt	2021-06-01 07:53:04.000000000 +0000
    308 +++ b/gcc/config/sh/sh.opt	2025-11-30 03:31:53.000000000 +0000
    309 @@ -65,6 +65,10 @@ m2e
    310  Target RejectNegative Condition(SUPPORT_SH2E)
    311  Generate SH2e code.
    312  
    313 +mj2
    314 +Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
    315 +Generate J2 code.
    316 +
    317  m3
    318  Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
    319  Generate SH3 code.
    320 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/sh/sync.md gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/sh/sync.md
    321 --- a/gcc/config/sh/sync.md	2021-06-01 07:53:04.000000000 +0000
    322 +++ b/gcc/config/sh/sync.md	2025-11-30 03:31:53.000000000 +0000
    323 @@ -240,6 +240,9 @@
    324        || (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
    325      atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
    326  							  exp_val, new_val);
    327 +  else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
    328 +    atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
    329 +							 exp_val, new_val);
    330    else if (TARGET_ATOMIC_SOFT_GUSA)
    331      atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
    332  		      exp_val, new_val);
    333 @@ -306,6 +309,57 @@
    334  }
    335    [(set_attr "length" "14")])
    336  
    337 +(define_expand "atomic_compare_and_swapsi_cas"
    338 +  [(set (match_operand:SI 0 "register_operand" "=r")
    339 +	(unspec_volatile:SI
    340 +	  [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
    341 +	   (match_operand:SI 2 "register_operand" "r")
    342 +	   (match_operand:SI 3 "register_operand" "r")]
    343 +	  UNSPECV_CMPXCHG_1))]
    344 +  "TARGET_ATOMIC_HARD_CAS"
    345 +{
    346 +  rtx mem = gen_rtx_REG (SImode, 0);
    347 +  emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
    348 +  emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
    349 +  DONE;
    350 +})
    351 +
    352 +(define_insn "shj2_cas"
    353 +  [(set (match_operand:SI 0 "register_operand" "=&r")
    354 +  (unspec_volatile:SI
    355 +   [(match_operand:SI 1 "register_operand" "=r")
    356 +   (match_operand:SI 2 "register_operand" "r")
    357 +   (match_operand:SI 3 "register_operand" "0")]
    358 +   UNSPECV_CMPXCHG_1))
    359 +   (set (reg:SI T_REG)
    360 +	(unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
    361 +  "TARGET_ATOMIC_HARD_CAS"
    362 +  "cas.l	%2,%0,@%1"
    363 +  [(set_attr "length" "2")]
    364 +)
    365 +
    366 +(define_expand "atomic_compare_and_swapqi_cas"
    367 +  [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
    368 +	(unspec_volatile:SI
    369 +	  [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
    370 +	   (match_operand:SI 2 "arith_operand" "rI08")
    371 +	   (match_operand:SI 3 "arith_operand" "rI08")]
    372 +	  UNSPECV_CMPXCHG_1))]
    373 +  "TARGET_ATOMIC_HARD_CAS"
    374 +{FAIL;}
    375 +)
    376 +
    377 +(define_expand "atomic_compare_and_swaphi_cas"
    378 +  [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
    379 +	(unspec_volatile:SI
    380 +	  [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
    381 +	   (match_operand:SI 2 "arith_operand" "rI08")
    382 +	   (match_operand:SI 3 "arith_operand" "rI08")]
    383 +	  UNSPECV_CMPXCHG_1))]
    384 +  "TARGET_ATOMIC_HARD_CAS"
    385 +{FAIL;}
    386 +)
    387 +
    388  ;; The QIHImode llcs patterns modify the address register of the memory
    389  ;; operand.  In order to express that, we have to open code the memory
    390  ;; operand.  Initially the insn is expanded like every other atomic insn
    391 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config/sh/t-sh gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config/sh/t-sh
    392 --- a/gcc/config/sh/t-sh	2021-06-01 07:53:04.000000000 +0000
    393 +++ b/gcc/config/sh/t-sh	2025-11-30 03:31:53.000000000 +0000
    394 @@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
    395               m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
    396               m2a-single,m2a-single-only \
    397               m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
    398 -             m4,m4-100,m4-200,m4-300,m4a; do \
    399 +             m4,m4-100,m4-200,m4-300,m4a \
    400 +             mj2; do \
    401      subst= ; \
    402      for lib in `echo $$abi|tr , ' '` ; do \
    403        if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
    404 @@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
    405  
    406  # SH1 and SH2A support big endian only.
    407  ifeq ($(DEFAULT_ENDIAN),ml)
    408 -MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
    409 +MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
    410  else
    411 -MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
    412 +MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
    413  endif
    414  
    415  MULTILIB_OSDIRNAMES = \
    416 @@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
    417  	m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
    418  	m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
    419  	m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
    420 -	m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
    421 +	m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
    422 +	mj2=!j2
    423  
    424  $(out_object_file): gt-sh.h
    425  gt-sh.h : s-gtype ; @true
    426 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/config.gcc gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/config.gcc
    427 --- a/gcc/config.gcc	2021-06-01 07:53:04.000000000 +0000
    428 +++ b/gcc/config.gcc	2025-11-30 03:31:53.000000000 +0000
    429 @@ -536,7 +536,7 @@ s390*-*-*)
    430  	extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
    431  	;;
    432  # Note the 'l'; we need to be able to match e.g. "shle" or "shl".
    433 -sh[123456789lbe]*-*-* | sh-*-*)
    434 +sh[123456789lbej]*-*-* | sh-*-*)
    435  	cpu_type=sh
    436  	extra_options="${extra_options} fused-madd.opt"
    437  	extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
    438 @@ -2853,18 +2853,18 @@ s390x-ibm-tpf*)
    439  	extra_options="${extra_options} s390/tpf.opt"
    440  	tmake_file="${tmake_file} s390/t-s390"
    441  	;;
    442 -sh-*-elf* | sh[12346l]*-*-elf* | \
    443 -  sh-*-linux* | sh[2346lbe]*-*-linux* | \
    444 +sh-*-elf* | sh[12346lj]*-*-elf* | \
    445 +  sh-*-linux* | sh[2346lbej]*-*-linux* | \
    446    sh-*-netbsdelf* | shl*-*-netbsdelf*)
    447  	tmake_file="${tmake_file} sh/t-sh sh/t-elf"
    448  	if test x${with_endian} = x; then
    449  		case ${target} in
    450 -		sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
    451 +		sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
    452  		shbe-*-* | sheb-*-*)		   with_endian=big,little ;;
    453  		sh[1234]l* | sh[34]*-*-linux*)	   with_endian=little ;;
    454  		shl* | sh*-*-linux* | \
    455  		  sh-superh-elf)		   with_endian=little,big ;;
    456 -		sh[1234]*-*-*)			   with_endian=big ;;
    457 +		sh[j1234]*-*-*)			   with_endian=big ;;
    458  		*)				   with_endian=big,little ;;
    459  		esac
    460  	fi
    461 @@ -2931,6 +2931,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
    462  	sh2a_nofpu*)		sh_cpu_target=sh2a-nofpu ;;
    463  	sh2a*)			sh_cpu_target=sh2a ;;
    464  	sh2e*)			sh_cpu_target=sh2e ;;
    465 +	shj2*)			sh_cpu_target=shj2;;
    466  	sh2*)			sh_cpu_target=sh2 ;;
    467  	*)			sh_cpu_target=sh1 ;;
    468  	esac
    469 @@ -2952,7 +2953,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
    470  	  sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
    471  	  sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
    472  	  sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
    473 -	  sh3e | sh3 | sh2e | sh2 | sh1) ;;
    474 +	  sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
    475  	"")	sh_cpu_default=${sh_cpu_target} ;;
    476  	*)	echo "with_cpu=$with_cpu not supported"; exit 1 ;;
    477  	esac
    478 @@ -2961,9 +2962,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
    479  		case ${target} in
    480  		sh[1234]*)	sh_multilibs=${sh_cpu_target} ;;
    481  		sh-superh-*)	sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
    482 -		sh*-*-linux*)	sh_multilibs=m1,m2,m2a,m3e,m4 ;;
    483 +		sh*-*-linux*)	sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
    484  		sh*-*-netbsd*)	sh_multilibs=m3,m3e,m4 ;;
    485 -		*) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
    486 +		*) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
    487  		esac
    488  		if test x$with_fp = xno; then
    489  			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`"
    490 @@ -2978,7 +2979,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
    491  		m1 | m2 | m2e | m3 | m3e | \
    492  		m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
    493  		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
    494 -		m2a | m2a-single | m2a-single-only | m2a-nofpu)
    495 +		m2a | m2a-single | m2a-single-only | m2a-nofpu | \
    496 +		mj2)
    497  			# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
    498  			# It is passed to MULTIILIB_OPTIONS verbatim.
    499  			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
    500 @@ -2995,7 +2997,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
    501  	done
    502  	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
    503  	if test x${enable_incomplete_targets} = xyes ; then
    504 -		tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
    505 +		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"
    506  	fi
    507  	tm_file="$tm_file ./sysroot-suffix.h"
    508  	tmake_file="$tmake_file t-sysroot-suffix"
    509 @@ -4801,6 +4803,8 @@ case "${target}" in
    510  			;;
    511  		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
    512  		        ;;
    513 +		mj2)
    514 +			;;
    515  		*)
    516  			echo "Unknown CPU used in --with-cpu=$with_cpu, known values:"  1>&2
    517  			echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
    518 @@ -5028,7 +5032,7 @@ case ${target} in
    519  		tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
    520  		;;
    521  
    522 -	sh[123456ble]*-*-* | sh-*-*)
    523 +	sh[123456blej]*-*-* | sh-*-*)
    524  		c_target_objs="${c_target_objs} sh-c.o"
    525  		cxx_target_objs="${cxx_target_objs} sh-c.o"
    526  		;;
    527 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/configure gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/configure
    528 --- a/gcc/configure	2021-06-01 07:53:40.000000000 +0000
    529 +++ b/gcc/configure	2025-11-30 03:33:04.000000000 +0000
    530 @@ -29389,6 +29389,15 @@ if test "${with_long_double_128+set}" =
    531    withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
    532  else
    533  
    534 +      case "$target" in
    535 +	s390*-*-linux-musl*)
    536 +	  gcc_cv_target_ldbl128=yes
    537 +	  ;;
    538 +	powerpc*-*-linux-musl*)
    539 +	  gcc_cv_target_ldbl128=no
    540 +	  ;;
    541 +	*)
    542 +
    543  if test $glibc_version_major -gt 2 \
    544    || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
    545    gcc_cv_target_ldbl128=yes
    546 @@ -29400,6 +29409,10 @@ else
    547        && gcc_cv_target_ldbl128=yes
    548  
    549  fi
    550 +
    551 +	  ;;
    552 +      esac
    553 +
    554  fi
    555  
    556      ;;
    557 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/configure.ac gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/configure.ac
    558 --- a/gcc/configure.ac	2021-06-01 07:53:04.000000000 +0000
    559 +++ b/gcc/configure.ac	2025-11-30 03:33:04.000000000 +0000
    560 @@ -6024,13 +6024,25 @@ case "$target" in
    561      AC_ARG_WITH(long-double-128,
    562        [AS_HELP_STRING([--with-long-double-128],
    563  		      [use 128-bit long double by default])],
    564 -      gcc_cv_target_ldbl128="$with_long_double_128",
    565 +      gcc_cv_target_ldbl128="$with_long_double_128", [
    566 +      case "$target" in
    567 +	s390*-*-linux-musl*)
    568 +	  gcc_cv_target_ldbl128=yes
    569 +	  ;;
    570 +	powerpc*-*-linux-musl*)
    571 +	  gcc_cv_target_ldbl128=no
    572 +	  ;;
    573 +	*)]
    574        [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
    575        [gcc_cv_target_ldbl128=no
    576        grep '^[ 	]*#[ 	]*define[ 	][ 	]*__LONG_DOUBLE_MATH_OPTIONAL' \
    577          $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
    578        && gcc_cv_target_ldbl128=yes
    579 -      ]])])
    580 +      ]])]
    581 +      [
    582 +	  ;;
    583 +      esac
    584 +      ])
    585      ;;
    586  esac
    587  if test x$gcc_cv_target_ldbl128 = xyes; then
    588 diff -ru --no-dereference --show-c-function gcc-9.4.0/gcc/gcc.c gcc-9.4.0-0020-sh-fdpic-pr114641/gcc/gcc.c
    589 --- a/gcc/gcc.c	2021-06-01 07:53:04.000000000 +0000
    590 +++ b/gcc/gcc.c	2025-11-30 03:33:53.000000000 +0000
    591 @@ -878,7 +878,8 @@ proper position among the other output f
    592  #ifndef LINK_SSP_SPEC
    593  #ifdef TARGET_LIBC_PROVIDES_SSP
    594  #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
    595 -		       "|fstack-protector-strong|fstack-protector-explicit:}"
    596 +		       "|fstack-protector-strong|fstack-protector-explicit" \
    597 +		       ":-lssp_nonshared}"
    598  #else
    599  #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
    600  		       "|fstack-protector-strong|fstack-protector-explicit" \
    601 @@ -907,7 +908,7 @@ proper position among the other output f
    602  #define NO_FPIE_AND_FPIC_SPEC	NO_FPIE_SPEC "|" NO_FPIC_SPEC
    603  #define FPIE_OR_FPIC_SPEC	NO_FPIE_AND_FPIC_SPEC ":;"
    604  #else
    605 -#define PIE_SPEC		"pie"
    606 +#define PIE_SPEC		"pie|static-pie"
    607  #define FPIE1_SPEC		"fpie"
    608  #define NO_FPIE1_SPEC		FPIE1_SPEC ":;"
    609  #define FPIE2_SPEC		"fPIE"
    610 @@ -931,12 +932,12 @@ proper position among the other output f
    611  #ifndef LINK_PIE_SPEC
    612  #ifdef HAVE_LD_PIE
    613  #ifndef LD_PIE_SPEC
    614 -#define LD_PIE_SPEC "-pie"
    615 +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
    616  #endif
    617  #else
    618  #define LD_PIE_SPEC ""
    619  #endif
    620 -#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
    621 +#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
    622  #endif
    623  
    624  #ifndef LINK_BUILDID_SPEC
    625 diff -ru --no-dereference --show-c-function gcc-9.4.0/libatomic/testsuite/Makefile.am gcc-9.4.0-0020-sh-fdpic-pr114641/libatomic/testsuite/Makefile.am
    626 --- a/libatomic/testsuite/Makefile.am	2021-06-01 07:53:06.000000000 +0000
    627 +++ b/libatomic/testsuite/Makefile.am	2025-11-30 03:30:23.000000000 +0000
    628 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_buildd
    629  _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
    630  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    631  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    632 +
    633 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    634 +
    635 +extra.exp:
    636 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    637 +	mv $@.tmp $@
    638 diff -ru --no-dereference --show-c-function gcc-9.4.0/libatomic/testsuite/Makefile.in gcc-9.4.0-0020-sh-fdpic-pr114641/libatomic/testsuite/Makefile.in
    639 --- a/libatomic/testsuite/Makefile.in	2021-06-01 07:53:06.000000000 +0000
    640 +++ b/libatomic/testsuite/Makefile.in	2025-11-30 03:30:23.000000000 +0000
    641 @@ -277,6 +277,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
    642  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    643  
    644  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    645 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    646  all: all-am
    647  
    648  .SUFFIXES:
    649 @@ -484,6 +485,10 @@ uninstall-am:
    650  .PRECIOUS: Makefile
    651  
    652  
    653 +extra.exp:
    654 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    655 +	mv $@.tmp $@
    656 +
    657  # Tell versions [3.59,3.63) of GNU make to not export all variables.
    658  # Otherwise a system limit (for SysV at least) may be exceeded.
    659  .NOEXPORT:
    660 diff -ru --no-dereference --show-c-function gcc-9.4.0/libatomic/testsuite/lib/libatomic.exp gcc-9.4.0-0020-sh-fdpic-pr114641/libatomic/testsuite/lib/libatomic.exp
    661 --- a/libatomic/testsuite/lib/libatomic.exp	2021-06-01 07:53:06.000000000 +0000
    662 +++ b/libatomic/testsuite/lib/libatomic.exp	2025-11-30 03:30:23.000000000 +0000
    663 @@ -77,6 +77,7 @@ proc libatomic_init { args } {
    664      global ALWAYS_CFLAGS
    665      global CFLAGS
    666      global TOOL_EXECUTABLE TOOL_OPTIONS
    667 +    global BUILD_CC
    668      global GCC_UNDER_TEST
    669      global TESTING_IN_BUILD_TREE
    670      global target_triplet
    671 @@ -92,6 +93,8 @@ proc libatomic_init { args } {
    672      if ![info exists GCC_UNDER_TEST] then {
    673  	if [info exists TOOL_EXECUTABLE] {
    674  	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
    675 +	} elseif [info exists BUILD_CC] {
    676 +	    set GCC_UNDER_TEST $BUILD_CC
    677  	} else {
    678  	    set GCC_UNDER_TEST "[find_gcc]"
    679  	}
    680 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgcc/config/m68k/linux-unwind.h gcc-9.4.0-0020-sh-fdpic-pr114641/libgcc/config/m68k/linux-unwind.h
    681 --- a/libgcc/config/m68k/linux-unwind.h	2021-06-01 07:53:06.000000000 +0000
    682 +++ b/libgcc/config/m68k/linux-unwind.h	2025-11-30 03:33:28.000000000 +0000
    683 @@ -37,7 +37,7 @@ struct uw_ucontext {
    684  	stack_t		  uc_stack;
    685  	mcontext_t	  uc_mcontext;
    686  	unsigned long	  uc_filler[80];
    687 -	__sigset_t	  uc_sigmask;
    688 +	sigset_t	  uc_sigmask;
    689  };
    690  
    691  #define MD_FALLBACK_FRAME_STATE_FOR m68k_fallback_frame_state
    692 Only in gcc-9.4.0-0020-sh-fdpic-pr114641/libgcc/config: t-gthr-noweak
    693 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgcc/config.host gcc-9.4.0-0020-sh-fdpic-pr114641/libgcc/config.host
    694 --- a/libgcc/config.host	2021-06-01 07:53:06.000000000 +0000
    695 +++ b/libgcc/config.host	2025-11-30 03:34:42.000000000 +0000
    696 @@ -1480,3 +1480,10 @@ aarch64*-*-*)
    697  	tm_file="${tm_file} aarch64/value-unwind.h"
    698  	;;
    699  esac
    700 +
    701 +case ${host} in
    702 +*-*-musl*)
    703 +  # The gthr weak references are unsafe with static linking
    704 +  tmake_file="$tmake_file t-gthr-noweak"
    705 +  ;;
    706 +esac
    707 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgomp/configure.tgt gcc-9.4.0-0020-sh-fdpic-pr114641/libgomp/configure.tgt
    708 --- a/libgomp/configure.tgt	2021-06-01 07:53:06.000000000 +0000
    709 +++ b/libgomp/configure.tgt	2025-11-30 03:34:17.000000000 +0000
    710 @@ -17,6 +17,9 @@ if test $gcc_cv_have_tls = yes ; then
    711      *-*-k*bsd*-gnu*)
    712  	;;
    713  
    714 +    *-*-musl*)
    715 +	;;
    716 +
    717      *-*-linux* | *-*-gnu*)
    718  	XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
    719  	;;
    720 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgomp/testsuite/Makefile.am gcc-9.4.0-0020-sh-fdpic-pr114641/libgomp/testsuite/Makefile.am
    721 --- a/libgomp/testsuite/Makefile.am	2021-06-01 07:53:06.000000000 +0000
    722 +++ b/libgomp/testsuite/Makefile.am	2025-11-30 03:30:46.000000000 +0000
    723 @@ -12,6 +12,12 @@ _RUNTEST = $(shell if test -f $(top_srcd
    724  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    725  RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
    726  
    727 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    728 +
    729 +extra.exp:
    730 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    731 +	mv $@.tmp $@
    732 +
    733  # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
    734  # following variables have to be "routed through" this Makefile, for expansion
    735  # of the several (Makefile) variables used therein.
    736 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgomp/testsuite/Makefile.in gcc-9.4.0-0020-sh-fdpic-pr114641/libgomp/testsuite/Makefile.in
    737 --- a/libgomp/testsuite/Makefile.in	2021-06-01 07:53:40.000000000 +0000
    738 +++ b/libgomp/testsuite/Makefile.in	2025-11-30 03:30:46.000000000 +0000
    739 @@ -303,6 +303,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
    740  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    741  
    742  RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
    743 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    744  all: all-am
    745  
    746  .SUFFIXES:
    747 @@ -464,6 +465,10 @@ uninstall-am:
    748  .PRECIOUS: Makefile
    749  
    750  
    751 +extra.exp:
    752 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    753 +	mv $@.tmp $@
    754 +
    755  # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
    756  # following variables have to be "routed through" this Makefile, for expansion
    757  # of the several (Makefile) variables used therein.
    758 diff -ru --no-dereference --show-c-function gcc-9.4.0/libgomp/testsuite/lib/libgomp.exp gcc-9.4.0-0020-sh-fdpic-pr114641/libgomp/testsuite/lib/libgomp.exp
    759 --- a/libgomp/testsuite/lib/libgomp.exp	2021-06-01 07:53:06.000000000 +0000
    760 +++ b/libgomp/testsuite/lib/libgomp.exp	2025-11-30 03:30:46.000000000 +0000
    761 @@ -68,6 +68,7 @@ proc libgomp_init { args } {
    762      global ALWAYS_CFLAGS
    763      global CFLAGS
    764      global TOOL_EXECUTABLE TOOL_OPTIONS
    765 +    global BUILD_CC
    766      global GCC_UNDER_TEST
    767      global TESTING_IN_BUILD_TREE
    768      global target_triplet
    769 @@ -90,6 +91,8 @@ proc libgomp_init { args } {
    770      if ![info exists GCC_UNDER_TEST] then {
    771  	if [info exists TOOL_EXECUTABLE] {
    772  	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
    773 +	} elseif [info exists BUILD_CC] {
    774 +	    set GCC_UNDER_TEST $BUILD_CC
    775  	} else {
    776  	    set GCC_UNDER_TEST "[find_gcc]"
    777  	}
    778 diff -ru --no-dereference --show-c-function gcc-9.4.0/libitm/configure.tgt gcc-9.4.0-0020-sh-fdpic-pr114641/libitm/configure.tgt
    779 --- a/libitm/configure.tgt	2021-06-01 07:53:06.000000000 +0000
    780 +++ b/libitm/configure.tgt	2025-11-30 03:34:17.000000000 +0000
    781 @@ -31,6 +31,9 @@
    782  if test "$gcc_cv_have_tls" = yes ; then
    783    case "${target}" in
    784  
    785 +    *-*-musl*)
    786 +	;;
    787 +
    788      # For x86, we use slots in the TCB head for most of our TLS.
    789      # The setup of those slots in beginTransaction can afford to
    790      # use the global-dynamic model.
    791 diff -ru --no-dereference --show-c-function gcc-9.4.0/libitm/testsuite/Makefile.am gcc-9.4.0-0020-sh-fdpic-pr114641/libitm/testsuite/Makefile.am
    792 --- a/libitm/testsuite/Makefile.am	2021-06-01 07:53:06.000000000 +0000
    793 +++ b/libitm/testsuite/Makefile.am	2025-11-30 03:31:08.000000000 +0000
    794 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_buildd
    795  _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
    796  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    797  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    798 +
    799 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    800 +
    801 +extra.exp:
    802 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    803 +	mv $@.tmp $@
    804 diff -ru --no-dereference --show-c-function gcc-9.4.0/libitm/testsuite/Makefile.in gcc-9.4.0-0020-sh-fdpic-pr114641/libitm/testsuite/Makefile.in
    805 --- a/libitm/testsuite/Makefile.in	2021-06-01 07:53:40.000000000 +0000
    806 +++ b/libitm/testsuite/Makefile.in	2025-11-30 03:31:08.000000000 +0000
    807 @@ -285,6 +285,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
    808  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    809  
    810  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    811 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    812  all: all-am
    813  
    814  .SUFFIXES:
    815 @@ -492,6 +493,10 @@ uninstall-am:
    816  .PRECIOUS: Makefile
    817  
    818  
    819 +extra.exp:
    820 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    821 +	mv $@.tmp $@
    822 +
    823  # Tell versions [3.59,3.63) of GNU make to not export all variables.
    824  # Otherwise a system limit (for SysV at least) may be exceeded.
    825  .NOEXPORT:
    826 diff -ru --no-dereference --show-c-function gcc-9.4.0/libitm/testsuite/lib/libitm.exp gcc-9.4.0-0020-sh-fdpic-pr114641/libitm/testsuite/lib/libitm.exp
    827 --- a/libitm/testsuite/lib/libitm.exp	2021-06-01 07:53:06.000000000 +0000
    828 +++ b/libitm/testsuite/lib/libitm.exp	2025-11-30 03:31:08.000000000 +0000
    829 @@ -77,6 +77,7 @@ proc libitm_init { args } {
    830      global ALWAYS_CFLAGS
    831      global CFLAGS
    832      global TOOL_EXECUTABLE TOOL_OPTIONS
    833 +    global BUILD_CC
    834      global GCC_UNDER_TEST
    835      global TESTING_IN_BUILD_TREE
    836      global target_triplet
    837 @@ -92,6 +93,8 @@ proc libitm_init { args } {
    838      if ![info exists GCC_UNDER_TEST] then {
    839  	if [info exists TOOL_EXECUTABLE] {
    840  	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
    841 +	} elseif [info exists BUILD_CC] {
    842 +	    set GCC_UNDER_TEST $BUILD_CC
    843  	} else {
    844  	    set GCC_UNDER_TEST "[find_gcc]"
    845  	}
    846 diff -ru --no-dereference --show-c-function gcc-9.4.0/libstdc++-v3/src/c++11/futex.cc gcc-9.4.0-0020-sh-fdpic-pr114641/libstdc++-v3/src/c++11/futex.cc
    847 --- a/libstdc++-v3/src/c++11/futex.cc	2021-06-01 07:53:06.000000000 +0000
    848 +++ b/libstdc++-v3/src/c++11/futex.cc	2025-11-30 03:35:31.000000000 +0000
    849 @@ -61,7 +61,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    850  	struct timeval tv;
    851  	gettimeofday (&tv, NULL);
    852  	// Convert the absolute timeout value to a relative timeout
    853 +#if defined(SYS_futex_time64) && SYS_futex_time64 != SYS_futex
    854 +	struct
    855 +	  {
    856 +	    long tv_sec;
    857 +	    long tv_nsec;
    858 +	  } rt;
    859 +#else
    860  	struct timespec rt;
    861 +#endif
    862  	rt.tv_sec = __s.count() - tv.tv_sec;
    863  	rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
    864  	if (rt.tv_nsec < 0)
    865 diff -ru --no-dereference --show-c-function gcc-9.4.0/libvtv/testsuite/Makefile.am gcc-9.4.0-0020-sh-fdpic-pr114641/libvtv/testsuite/Makefile.am
    866 --- a/libvtv/testsuite/Makefile.am	2021-06-01 07:53:07.000000000 +0000
    867 +++ b/libvtv/testsuite/Makefile.am	2025-11-30 03:31:31.000000000 +0000
    868 @@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_buildd
    869  _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
    870  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    871  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    872 +
    873 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    874 +
    875 +extra.exp:
    876 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    877 +	mv $@.tmp $@
    878 diff -ru --no-dereference --show-c-function gcc-9.4.0/libvtv/testsuite/Makefile.in gcc-9.4.0-0020-sh-fdpic-pr114641/libvtv/testsuite/Makefile.in
    879 --- a/libvtv/testsuite/Makefile.in	2021-06-01 07:53:07.000000000 +0000
    880 +++ b/libvtv/testsuite/Makefile.in	2025-11-30 03:31:31.000000000 +0000
    881 @@ -280,6 +280,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
    882  	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
    883  
    884  RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
    885 +EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
    886  all: all-am
    887  
    888  .SUFFIXES:
    889 @@ -487,6 +488,10 @@ uninstall-am:
    890  .PRECIOUS: Makefile
    891  
    892  
    893 +extra.exp:
    894 +	echo 'set BUILD_CC "$(CC)"' > $@.tmp
    895 +	mv $@.tmp $@
    896 +
    897  # Tell versions [3.59,3.63) of GNU make to not export all variables.
    898  # Otherwise a system limit (for SysV at least) may be exceeded.
    899  .NOEXPORT:
    900 diff -ru --no-dereference --show-c-function gcc-9.4.0/libvtv/testsuite/lib/libvtv.exp gcc-9.4.0-0020-sh-fdpic-pr114641/libvtv/testsuite/lib/libvtv.exp
    901 --- a/libvtv/testsuite/lib/libvtv.exp	2021-06-01 07:53:07.000000000 +0000
    902 +++ b/libvtv/testsuite/lib/libvtv.exp	2025-11-30 03:31:31.000000000 +0000
    903 @@ -76,6 +76,7 @@ proc libvtv_init { args } {
    904      global ALWAYS_CFLAGS
    905      global CFLAGS
    906      global TOOL_EXECUTABLE TOOL_OPTIONS
    907 +    global BUILD_CC
    908      global GCC_UNDER_TEST
    909      global TESTING_IN_BUILD_TREE
    910      global target_triplet
    911 @@ -91,6 +92,8 @@ proc libvtv_init { args } {
    912      if ![info exists GCC_UNDER_TEST] then {
    913  	if [info exists TOOL_EXECUTABLE] {
    914  	    set GCC_UNDER_TEST $TOOL_EXECUTABLE
    915 +	} elseif [info exists BUILD_CC] {
    916 +	    set GCC_UNDER_TEST $BUILD_CC
    917  	} else {
    918  	    set GCC_UNDER_TEST "[find_gcc]"
    919  	}