Skip to content

Commit 7d3321a

Browse files
fix a long standing problem with cabs*() fixes up on netbsd
netbsd has the cabs(3), cabsf(3), and cabsl(3) functions renamed with __c99_ prefixes on them, and may not all be present with the old names. there's code in netbsd.cc to fix up these names, but it's only invoked by a some of our target CPUs -- x86, vax, and arm64, but the rest fail. the problem is that config/netbsd.h defines SUBTARGET_INIT_BUILTINS to a function that does this fix up, but this define it only consumed inside the TARGET_INIT_BUILTINS's macro function if defined. looks like due to the supported users of SUBTARGET_INIT_BUILTINS currently, it was added for darwin support, and nothing else. add calls to SUBTARGET_INIT_BUILTINS if defined to each of the alpha, arm, ia64, m68k, mips, pa, riscv, sh, and sparc ports. tested on sparc64 (where "cabsl" is missing entirely), mips64, and amd64. this goes all the back to at leastnetbsd-9 (GCC 7), netbsd-10 (GCC 10), and netbsd-11 (GCC 12). XXX: pullup-* XXX: copy into gcc.old, too (still haven't switched alpha, sh3 or m68k.)
1 parent c72b890 commit 7d3321a

9 files changed

Lines changed: 34 additions & 0 deletions

File tree

external/gpl3/gcc/dist/gcc/config/alpha/alpha.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6588,6 +6588,10 @@ alpha_builtin_function (const char *name, tree ftype,
65886588
TREE_NOTHROW (decl) = 1;
65896589

65906590
alpha_builtins [(int) code] = decl;
6591+
6592+
#ifdef SUBTARGET_INIT_BUILTINS
6593+
SUBTARGET_INIT_BUILTINS;
6594+
#endif
65916595
}
65926596

65936597
/* Helper function of alpha_init_builtins. Add the COUNT built-in

external/gpl3/gcc/dist/gcc/config/arm/arm-builtins.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,10 @@ arm_init_builtins (void)
27092709
ftype_cmse_nonsecure_caller,
27102710
ARM_BUILTIN_CMSE_NONSECURE_CALLER);
27112711
}
2712+
2713+
#ifdef SUBTARGET_INIT_BUILTINS
2714+
SUBTARGET_INIT_BUILTINS;
2715+
#endif
27122716
}
27132717

27142718
/* Implement TARGET_BUILTIN_DECL for general builtins. */

external/gpl3/gcc/dist/gcc/config/ia64/ia64.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10569,6 +10569,10 @@ ia64_init_builtins (void)
1056910569
if ((decl = builtin_decl_explicit (BUILT_IN_FINITEL)) != NULL_TREE)
1057010570
set_user_assembler_name (decl, "_Isfinitef128");
1057110571
}
10572+
10573+
#ifdef SUBTARGET_INIT_BUILTINS
10574+
SUBTARGET_INIT_BUILTINS;
10575+
#endif
1057210576
}
1057310577

1057410578
static tree

external/gpl3/gcc/dist/gcc/config/m68k/netbsd-elf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ along with GCC; see the file COPYING3. If not see
5353
} \
5454
}
5555

56+
/* GCC m68k has no TARGET_INIT_BUILTINS, so simply use it. */
57+
#define TARGET_INIT_BUILTINS SUBTARGET_INIT_BUILTINS
5658

5759
/* Provide a CPP_SPEC appropriate for NetBSD m68k targets. Currently we
5860
deal with the GCC option '-posix', as well as an indication as to

external/gpl3/gcc/dist/gcc/config/mips/mips.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17023,6 +17023,10 @@ mips_init_builtins (void)
1702317023
mips_get_builtin_decl_index[d->icode] = i;
1702417024
}
1702517025
}
17026+
17027+
#ifdef SUBTARGET_INIT_BUILTINS
17028+
SUBTARGET_INIT_BUILTINS;
17029+
#endif
1702617030
}
1702717031

1702817032
/* Implement TARGET_BUILTIN_DECL. */

external/gpl3/gcc/dist/gcc/config/pa/pa.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,10 @@ pa_init_builtins (void)
710710
NULL, NULL_TREE);
711711
pa_builtins[PA_BUILTIN_HUGE_VALQ] = decl;
712712
}
713+
714+
#ifdef SUBTARGET_INIT_BUILTINS
715+
SUBTARGET_INIT_BUILTINS;
716+
#endif
713717
}
714718

715719
/* Implement TARGET_BUILTIN_DECL. */

external/gpl3/gcc/dist/gcc/config/riscv/riscv-builtins.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ riscv_init_builtins (void)
297297
riscv_builtin_decl_index[d->icode] = i;
298298
}
299299
}
300+
301+
#ifdef SUBTARGET_INIT_BUILTINS
302+
SUBTARGET_INIT_BUILTINS;
303+
#endif
300304
}
301305

302306
/* Implement TARGET_BUILTIN_DECL. */

external/gpl3/gcc/dist/gcc/config/sh/sh.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10317,6 +10317,10 @@ sh_init_builtins (void)
1031710317
else if (d->icode == CODE_FOR_set_fpscr)
1031810318
sh_builtin_set_fpscr = d->fndecl;
1031910319
}
10320+
10321+
#ifdef SUBTARGET_INIT_BUILTINS
10322+
SUBTARGET_INIT_BUILTINS;
10323+
#endif
1032010324
}
1032110325

1032210326
/* Implement TARGET_ATOMIC_ASSIGN_EXPAND_FENV. */

external/gpl3/gcc/dist/gcc/config/sparc/sparc.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11086,6 +11086,10 @@ sparc_init_builtins (void)
1108611086

1108711087
if (TARGET_VIS)
1108811088
sparc_vis_init_builtins ();
11089+
11090+
#ifdef SUBTARGET_INIT_BUILTINS
11091+
SUBTARGET_INIT_BUILTINS;
11092+
#endif
1108911093
}
1109011094

1109111095
/* Create builtin functions for FPU instructions. */

0 commit comments

Comments
 (0)