Module Name: src
Committed By: mrg
Date: Sun Jul 30 06:15:17 UTC 2023
Modified Files:
src/external/gpl3/gcc/dist/gcc: cfgexpand.cc cppbuiltin.cc
cppdefault.cc dse.cc expr.cc file-prefix-map.cc gcc.cc genemit.cc
genrecog.cc ggc-common.cc ipa-inline.cc opts-global.cc opts.cc
reload.cc targhooks.cc tree-cfg.cc tree-ssa-ccp.cc
src/external/gpl3/gcc/dist/gcc/c-family: c-cppbuiltin.cc c-format.cc
c-opts.cc
src/external/gpl3/gcc/dist/gcc/common/config/aarch64: aarch64-common.cc
src/external/gpl3/gcc/dist/gcc/common/config/arm: arm-common.cc
src/external/gpl3/gcc/dist/gcc/config: host-darwin.cc
src/external/gpl3/gcc/dist/gcc/config/aarch64: aarch64-builtins.cc
driver-aarch64.cc
src/external/gpl3/gcc/dist/gcc/config/i386: i386.h netbsd-elf.h
netbsd64.h
src/external/gpl3/gcc/dist/gcc/config/mips: mips.cc
src/external/gpl3/gcc/dist/gcc/config/pa: pa.cc
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000-logue.cc rs6000.cc
src/external/gpl3/gcc/dist/libcpp: files.cc lex.cc macro.cc
Log Message:
GCC 12.3.0: merge our old changes into the renamed .cc files.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/cfgexpand.cc \
src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc \
src/external/gpl3/gcc/dist/gcc/cppdefault.cc \
src/external/gpl3/gcc/dist/gcc/dse.cc \
src/external/gpl3/gcc/dist/gcc/expr.cc \
src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc \
src/external/gpl3/gcc/dist/gcc/gcc.cc \
src/external/gpl3/gcc/dist/gcc/genemit.cc \
src/external/gpl3/gcc/dist/gcc/genrecog.cc \
src/external/gpl3/gcc/dist/gcc/ggc-common.cc \
src/external/gpl3/gcc/dist/gcc/ipa-inline.cc \
src/external/gpl3/gcc/dist/gcc/opts-global.cc \
src/external/gpl3/gcc/dist/gcc/opts.cc \
src/external/gpl3/gcc/dist/gcc/reload.cc \
src/external/gpl3/gcc/dist/gcc/targhooks.cc \
src/external/gpl3/gcc/dist/gcc/tree-cfg.cc \
src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc \
src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc \
src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc \
src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc
cvs rdiff -u -r1.16 -r1.17 src/external/gpl3/gcc/dist/gcc/config/i386/i386.h \
src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h \
src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/libcpp/files.cc \
src/external/gpl3/gcc/dist/libcpp/lex.cc \
src/external/gpl3/gcc/dist/libcpp/macro.cc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gcc/dist/gcc/cfgexpand.cc
diff -u src/external/gpl3/gcc/dist/gcc/cfgexpand.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/cfgexpand.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/cfgexpand.cc:1.1.1.1 Sun Jul 30 05:20:50 2023
+++ src/external/gpl3/gcc/dist/gcc/cfgexpand.cc Sun Jul 30 06:15:16 2023
@@ -1909,7 +1909,9 @@ stack_protect_classify_type (tree type)
else
len = tree_to_uhwi (TYPE_SIZE_UNIT (type));
- if (len < max)
+ if (len == 0)
+ ret = SPCT_HAS_ARRAY;
+ else if (len < max)
ret = SPCT_HAS_SMALL_CHAR_ARRAY | SPCT_HAS_ARRAY;
else
ret = SPCT_HAS_LARGE_CHAR_ARRAY | SPCT_HAS_ARRAY;
Index: src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc
diff -u src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc:1.1.1.1 Sun Jul 30 05:20:45 2023
+++ src/external/gpl3/gcc/dist/gcc/cppbuiltin.cc Sun Jul 30 06:15:16 2023
@@ -96,6 +96,12 @@ define_builtin_macros_for_compilation_fl
if (flag_sanitize & SANITIZE_HWADDRESS)
cpp_define (pfile, "__SANITIZE_HWADDRESS__");
+ if (flag_sanitize & SANITIZE_UNDEFINED)
+ cpp_define (pfile, "__SANITIZE_UNDEFINED__");
+
+ if (flag_sanitize & SANITIZE_LEAK)
+ cpp_define (pfile, "__SANITIZE_LEAK__");
+
if (flag_sanitize & SANITIZE_THREAD)
cpp_define (pfile, "__SANITIZE_THREAD__");
Index: src/external/gpl3/gcc/dist/gcc/cppdefault.cc
diff -u src/external/gpl3/gcc/dist/gcc/cppdefault.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/cppdefault.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/cppdefault.cc:1.1.1.1 Sun Jul 30 05:20:49 2023
+++ src/external/gpl3/gcc/dist/gcc/cppdefault.cc Sun Jul 30 06:15:16 2023
@@ -61,8 +61,12 @@ const struct default_include cpp_include
GPLUSPLUS_LIBCXX_INCLUDE_DIR_ADD_SYSROOT, 0 },
#endif
#ifdef GCC_INCLUDE_DIR
+#ifndef GCC_INCLUDE_DIR_ADD_SYSROOT
+#define GCC_INCLUDE_DIR_ADD_SYSROOT 0
+#endif
/* This is the dir for gcc's private headers. */
- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+ { GCC_INCLUDE_DIR, "GCC", 0, 0,
+ GCC_INCLUDE_DIR_ADD_SYSROOT, 0 },
#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
Index: src/external/gpl3/gcc/dist/gcc/dse.cc
diff -u src/external/gpl3/gcc/dist/gcc/dse.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/dse.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/dse.cc:1.1.1.1 Sun Jul 30 05:20:54 2023
+++ src/external/gpl3/gcc/dist/gcc/dse.cc Sun Jul 30 06:15:16 2023
@@ -301,6 +301,11 @@ static unsigned HOST_WIDE_INT
lowpart_bitmask (int n)
{
unsigned HOST_WIDE_INT mask = HOST_WIDE_INT_M1U;
+#if 1 // XXXMRG
+ gcc_assert(n >= 0 && n <= HOST_BITS_PER_WIDE_INT);
+ if (n == 0)
+ return 0;
+#endif
return mask >> (HOST_BITS_PER_WIDE_INT - n);
}
Index: src/external/gpl3/gcc/dist/gcc/expr.cc
diff -u src/external/gpl3/gcc/dist/gcc/expr.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/expr.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/expr.cc:1.1.1.1 Sun Jul 30 05:20:46 2023
+++ src/external/gpl3/gcc/dist/gcc/expr.cc Sun Jul 30 06:15:16 2023
@@ -4688,7 +4688,8 @@ emit_push_insn (rtx x, machine_mode mode
int overlapping = 0;
if (mode == BLKmode
- || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode)))
+ || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode)
+ && type != NULL_TREE))
{
/* Copy a block into the stack, entirely or partially. */
Index: src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc
diff -u src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc:1.1.1.1 Sun Jul 30 05:20:54 2023
+++ src/external/gpl3/gcc/dist/gcc/file-prefix-map.cc Sun Jul 30 06:15:16 2023
@@ -40,7 +40,8 @@ static void
add_prefix_map (file_prefix_map *&maps, const char *arg, const char *opt)
{
file_prefix_map *map;
- const char *p;
+ const char *p, *old;
+ size_t oldlen;
/* Note: looking for the last '='. The thinking is we can control the paths
inside our projects but not where the users build them. */
@@ -50,9 +51,28 @@ add_prefix_map (file_prefix_map *&maps,
error ("invalid argument %qs to %qs", arg, opt);
return;
}
+ if (*arg == '$')
+ {
+ char *env = xstrndup (arg + 1, p - (arg + 1));
+ old = getenv(env);
+ if (!old)
+ {
+ warning (0, "environment variable %qs not set in argument to "
+ "%s", env, opt);
+ free(env);
+ return;
+ }
+ oldlen = strlen(old);
+ free(env);
+ }
+ else
+ {
+ old = xstrndup (arg, p - arg);
+ oldlen = p - arg;
+ }
map = XNEW (file_prefix_map);
- map->old_prefix = xstrndup (arg, p - arg);
- map->old_len = p - arg;
+ map->old_prefix = old;
+ map->old_len = oldlen;
p++;
map->new_prefix = xstrdup (p);
map->new_len = strlen (p);
@@ -132,6 +152,8 @@ remap_macro_filename (const char *filena
return remap_filename (macro_prefix_maps, filename);
}
+/* Original GCC version disabled. The NetBSD version handles regex */
+#if 0
/* Remap using -fdebug-prefix-map. Return the GC-allocated new name
corresponding to FILENAME or FILENAME if no remapping was performed. */
const char *
@@ -139,6 +161,118 @@ remap_debug_filename (const char *filena
{
return remap_filename (debug_prefix_maps, filename);
}
+#endif
+
+/*****
+ ***** The following code is a NetBSD extension that allows regex and
+ ***** \[0-9] substitutition arguments.
+ *****/
+
+/* Perform user-specified mapping of debug filename prefixes. Return
+ the new name corresponding to FILENAME. */
+
+static const char *
+remap_debug_prefix_filename (const char *filename)
+{
+ file_prefix_map *map;
+ char *s;
+ const char *name;
+ size_t name_len;
+
+ for (map = debug_prefix_maps; map; map = map->next)
+ if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
+ break;
+ if (!map)
+ return filename;
+ name = filename + map->old_len;
+ name_len = strlen (name) + 1;
+ s = (char *) alloca (name_len + map->new_len);
+ memcpy (s, map->new_prefix, map->new_len);
+ memcpy (s + map->new_len, name, name_len);
+ return ggc_strdup (s);
+}
+
+#include <regex.h>
+
+typedef struct debug_regex_map
+{
+ regex_t re;
+ const char *sub;
+ struct debug_regex_map *next;
+} debug_regex_map;
+
+/* Linked list of such structures. */
+debug_regex_map *debug_regex_maps;
+
+
+/* Record a debug file regex mapping. ARG is the argument to
+ -fdebug-regex-map and must be of the form OLD=NEW. */
+
+void
+add_debug_regex_map (const char *arg)
+{
+ debug_regex_map *map;
+ const char *p;
+ char *old;
+ char buf[1024];
+ regex_t re;
+ int e;
+
+ p = strchr (arg, '=');
+ if (!p)
+ {
+ error ("invalid argument %qs to -fdebug-regex-map", arg);
+ return;
+ }
+
+ old = xstrndup (arg, p - arg);
+ if ((e = regcomp(&re, old, REG_EXTENDED)) != 0)
+ {
+ regerror(e, &re, buf, sizeof(buf));
+ warning (0, "regular expression compilation for %qs in argument to "
+ "-fdebug-regex-map failed: %qs", old, buf);
+ free(old);
+ return;
+ }
+ free(old);
+
+ map = XNEW (debug_regex_map);
+ map->re = re;
+ p++;
+ map->sub = xstrdup (p);
+ map->next = debug_regex_maps;
+ debug_regex_maps = map;
+}
+
+extern "C" ssize_t regasub(char **, const char *,
+ const regmatch_t *rm, const char *);
+
+/* Perform user-specified mapping of debug filename regular expressions. Return
+ the new name corresponding to FILENAME. */
+
+static const char *
+remap_debug_regex_filename (const char *filename)
+{
+ debug_regex_map *map;
+ char *s;
+ regmatch_t rm[10];
+
+ for (map = debug_regex_maps; map; map = map->next)
+ if (regexec (&map->re, filename, 10, rm, 0) == 0
+ && regasub (&s, map->sub, rm, filename) >= 0)
+ {
+ const char *name = ggc_strdup(s);
+ free(s);
+ return name;
+ }
+ return filename;
+}
+
+const char *
+remap_debug_filename (const char *filename)
+{
+ return remap_debug_regex_filename (remap_debug_prefix_filename (filename));
+}
/* Remap using -fprofile-prefix-map. Return the GC-allocated new name
corresponding to FILENAME or FILENAME if no remapping was performed. */
Index: src/external/gpl3/gcc/dist/gcc/gcc.cc
diff -u src/external/gpl3/gcc/dist/gcc/gcc.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/gcc.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/gcc.cc:1.1.1.1 Sun Jul 30 05:20:54 2023
+++ src/external/gpl3/gcc/dist/gcc/gcc.cc Sun Jul 30 06:15:16 2023
@@ -1097,23 +1097,23 @@ proper position among the other output f
/* Linker command line options for -fsanitize= early on the command line. */
#ifndef SANITIZER_EARLY_SPEC
#define SANITIZER_EARLY_SPEC "\
-%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \
+%{!shared:%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_EARLY_SPEC "} \
%{%:sanitize(hwaddress):" LIBHWASAN_EARLY_SPEC "} \
%{%:sanitize(thread):" LIBTSAN_EARLY_SPEC "} \
- %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}"
+ %{%:sanitize(leak):" LIBLSAN_EARLY_SPEC "}}}}}"
#endif
/* Linker command line options for -fsanitize= late on the command line. */
#ifndef SANITIZER_SPEC
#define SANITIZER_SPEC "\
-%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\
+%{!shared:%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\
%{static:%ecannot specify -static with -fsanitize=address}}\
%{%:sanitize(hwaddress):" LIBHWASAN_SPEC "\
%{static:%ecannot specify -static with -fsanitize=hwaddress}}\
%{%:sanitize(thread):" LIBTSAN_SPEC "\
%{static:%ecannot specify -static with -fsanitize=thread}}\
%{%:sanitize(undefined):" LIBUBSAN_SPEC "}\
- %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}"
+ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}}}"
#endif
#ifndef POST_LINK_SPEC
@@ -4737,6 +4737,10 @@ process_command (unsigned int decoded_op
/* FIXME: make_relative_prefix doesn't yet work for VMS. */
if (!gcc_exec_prefix)
{
+#ifdef NETBSD_NATIVE
+ add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
+ PREFIX_PRIORITY_LAST, 0, 0);
+#else
gcc_exec_prefix = get_relative_prefix (decoded_options[0].arg,
standard_bindir_prefix,
standard_exec_prefix);
@@ -4745,6 +4749,7 @@ process_command (unsigned int decoded_op
standard_libexec_prefix);
if (gcc_exec_prefix)
xputenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
+#endif
}
else
{
@@ -8354,6 +8359,7 @@ driver::set_up_specs () const
spec_machine_suffix = just_machine_suffix;
#endif
+#ifndef NETBSD_NATIVE
/* We need to check standard_exec_prefix/spec_machine_suffix/specs
for any override of as, ld and libraries. */
specs_file = (char *) alloca (strlen (standard_exec_prefix)
@@ -8363,6 +8369,7 @@ driver::set_up_specs () const
strcat (specs_file, "specs");
if (access (specs_file, R_OK) == 0)
read_specs (specs_file, true, false);
+#endif
/* Process any configure-time defaults specified for the command line
options, via OPTION_DEFAULT_SPECS. */
@@ -8458,14 +8465,17 @@ driver::set_up_specs () const
PREFIX_PRIORITY_LAST, 0, 1);
else if (*cross_compile == '0')
{
+#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS)
add_prefix (&startfile_prefixes,
concat (gcc_exec_prefix
? gcc_exec_prefix : standard_exec_prefix,
machine_suffix,
standard_startfile_prefix, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, 1);
+#endif /* NETBSD_NATIVE */
}
+#if !defined(NETBSD_NATIVE) && !defined(NETBSD_TOOLS)
/* Sysrooted prefixes are relocated because target_system_root is
also relocated by gcc_exec_prefix. */
if (*standard_startfile_prefix_1)
@@ -8476,6 +8486,7 @@ driver::set_up_specs () const
add_sysrooted_prefix (&startfile_prefixes,
standard_startfile_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 0, 1);
+#endif /* NETBSD_NATIVE */
}
/* Process any user specified specs in the order given on the command
Index: src/external/gpl3/gcc/dist/gcc/genemit.cc
diff -u src/external/gpl3/gcc/dist/gcc/genemit.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/genemit.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/genemit.cc:1.1.1.1 Sun Jul 30 05:20:50 2023
+++ src/external/gpl3/gcc/dist/gcc/genemit.cc Sun Jul 30 06:15:16 2023
@@ -186,7 +186,9 @@ gen_exp (rtx x, enum rtx_code subroutine
else
{
printf ("GEN_INT (");
- printf (HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
+ printf ("HOST_WIDE_INT_C (");
+ printf (HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
+ printf (")");
printf (")");
}
return;
Index: src/external/gpl3/gcc/dist/gcc/genrecog.cc
diff -u src/external/gpl3/gcc/dist/gcc/genrecog.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/genrecog.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/genrecog.cc:1.1.1.1 Sun Jul 30 05:20:51 2023
+++ src/external/gpl3/gcc/dist/gcc/genrecog.cc Sun Jul 30 06:15:16 2023
@@ -4526,9 +4526,9 @@ print_host_wide_int (uint64_t val)
{
uint64_t min = uint64_t (1) << (HOST_BITS_PER_WIDE_INT - 1);
if (val == min)
- printf ("(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1);
+ printf ("( HOST_WIDE_INT_C (" HOST_WIDE_INT_PRINT_DEC ") - 1)", val + 1);
else
- printf (HOST_WIDE_INT_PRINT_DEC_C, val);
+ printf (" HOST_WIDE_INT_C (" HOST_WIDE_INT_PRINT_DEC ")", val);
}
/* Print the C expression for actual parameter PARAM. */
Index: src/external/gpl3/gcc/dist/gcc/ggc-common.cc
diff -u src/external/gpl3/gcc/dist/gcc/ggc-common.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/ggc-common.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/ggc-common.cc:1.1.1.1 Sun Jul 30 05:20:47 2023
+++ src/external/gpl3/gcc/dist/gcc/ggc-common.cc Sun Jul 30 06:15:16 2023
@@ -726,6 +726,8 @@ gt_pch_restore (FILE *f)
size_t i;
struct mmap_info mmi;
int result;
+ struct line_maps * old_line_table = line_table;
+ location_t old_input_loc = input_location;
/* We are about to reload the line maps along with the rest of the PCH
data, which means that the (loaded) ones cannot be guaranteed to be
@@ -745,7 +747,11 @@ gt_pch_restore (FILE *f)
for (rt = gt_pch_scalar_rtab; *rt; rt++)
for (rti = *rt; rti->base != NULL; rti++)
if (fread (rti->base, rti->stride, 1, f) != 1)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
/* Read in all the global pointers, in 6 easy loops. */
bool error_reading_pointers = false;
@@ -764,7 +770,11 @@ gt_pch_restore (FILE *f)
fatal_error (input_location, "cannot read PCH file: %m");
if (fread (&mmi, sizeof (mmi), 1, f) != 1)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
void *orig_preferred_base = mmi.preferred_base;
result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size,
@@ -774,6 +784,8 @@ gt_pch_restore (FILE *f)
address needed. */
if (result < 0)
{
+ line_table = old_line_table;
+ input_location = old_input_loc;
sorry_at (input_location, "PCH allocation failure");
/* There is no point in continuing from here, we will only end up
with a crashed (most likely hanging) compiler. */
@@ -787,14 +799,26 @@ gt_pch_restore (FILE *f)
{
if (fseek (f, mmi.offset, SEEK_SET) != 0
|| fread (mmi.preferred_base, mmi.size, 1, f) != 1)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
}
else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
size_t reloc_addrs_size;
if (fread (&reloc_addrs_size, sizeof (reloc_addrs_size), 1, f) != 1)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
if (orig_preferred_base != mmi.preferred_base)
{
@@ -829,7 +853,11 @@ gt_pch_restore (FILE *f)
= MIN (reloc_addrs_size,
(size_t) (4096 - (uleb128_ptr - uleb128_buf)));
if (fread (uleb128_ptr, 1, this_size, f) != this_size)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
unsigned char *uleb128_end = uleb128_ptr + this_size;
if (this_size != reloc_addrs_size)
uleb128_end -= 2 * sizeof (size_t);
@@ -866,7 +894,11 @@ gt_pch_restore (FILE *f)
unsigned num_callbacks;
if (fread (&pch_save, sizeof (pch_save), 1, f) != 1
|| fread (&num_callbacks, sizeof (num_callbacks), 1, f) != 1)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
if (pch_save != >_pch_save)
{
uintptr_t binbias = (uintptr_t) >_pch_save - (uintptr_t) pch_save;
@@ -876,7 +908,11 @@ gt_pch_restore (FILE *f)
= (uintptr_t) mmi.preferred_base - (uintptr_t) orig_preferred_base;
if (fread (ptrs, sizeof (void *), num_callbacks, f) != num_callbacks)
- fatal_error (input_location, "cannot read PCH file: %m");
+ {
+ line_table = old_line_table;
+ input_location = old_input_loc;
+ fatal_error (input_location, "cannot read PCH file: %m");
+ }
for (i = 0; i < num_callbacks; ++i)
{
void *ptr = (void *) ((uintptr_t) ptrs[i] + bias);
Index: src/external/gpl3/gcc/dist/gcc/ipa-inline.cc
diff -u src/external/gpl3/gcc/dist/gcc/ipa-inline.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/ipa-inline.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/ipa-inline.cc:1.1.1.1 Sun Jul 30 05:20:56 2023
+++ src/external/gpl3/gcc/dist/gcc/ipa-inline.cc Sun Jul 30 06:15:16 2023
@@ -2714,7 +2714,11 @@ ipa_inline (void)
could remove other nodes with flatten attribute. See PR82801. */
struct cgraph_node_hook_list *node_removal_hook_holder = NULL;
hash_set<struct cgraph_node *> *flatten_removed_nodes = NULL;
- if (j < nnodes - 2)
+ /*
+ * XXXMRG: added "nnodes > 1" as -O2 (but not -O) warn:
+ * "assuming signed overflow does not occur"
+ */
+ if (nnodes > 1 && j < nnodes - 2)
{
flatten_removed_nodes = new hash_set<struct cgraph_node *>;
node_removal_hook_holder
Index: src/external/gpl3/gcc/dist/gcc/opts-global.cc
diff -u src/external/gpl3/gcc/dist/gcc/opts-global.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/opts-global.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/opts-global.cc:1.1.1.1 Sun Jul 30 05:20:47 2023
+++ src/external/gpl3/gcc/dist/gcc/opts-global.cc Sun Jul 30 06:15:16 2023
@@ -382,6 +382,10 @@ handle_common_deferred_options (void)
add_debug_prefix_map (opt->arg);
break;
+ case OPT_fdebug_regex_map_:
+ add_debug_regex_map (opt->arg);
+ break;
+
case OPT_ffile_prefix_map_:
add_file_prefix_map (opt->arg);
break;
Index: src/external/gpl3/gcc/dist/gcc/opts.cc
diff -u src/external/gpl3/gcc/dist/gcc/opts.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/opts.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/opts.cc:1.1.1.1 Sun Jul 30 05:20:51 2023
+++ src/external/gpl3/gcc/dist/gcc/opts.cc Sun Jul 30 06:15:16 2023
@@ -2756,6 +2756,10 @@ common_handle_option (struct gcc_options
/* Deferred. */
break;
+ case OPT_fdebug_regex_map_:
+ /* Deferred. */
+ break;
+
case OPT_fcallgraph_info:
opts->x_flag_callgraph_info = CALLGRAPH_INFO_NAKED;
break;
Index: src/external/gpl3/gcc/dist/gcc/reload.cc
diff -u src/external/gpl3/gcc/dist/gcc/reload.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/reload.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/reload.cc:1.1.1.1 Sun Jul 30 05:20:56 2023
+++ src/external/gpl3/gcc/dist/gcc/reload.cc Sun Jul 30 06:15:16 2023
@@ -838,6 +838,7 @@ static bool
reload_inner_reg_of_subreg (rtx x, machine_mode mode, bool output)
{
rtx inner;
+ int regno;
/* Only SUBREGs are problematical. */
if (GET_CODE (x) != SUBREG)
@@ -849,10 +850,20 @@ reload_inner_reg_of_subreg (rtx x, machi
if (CONSTANT_P (inner) || GET_CODE (inner) == PLUS)
return true;
- /* If INNER is not a hard register, then INNER will not need reloading. */
- if (!(REG_P (inner) && HARD_REGISTER_P (inner)))
+ /* If INNER is not a register, then INNER will not need reloading. */
+ if (!REG_P (inner))
return false;
+ regno = REGNO (inner);
+
+ /* If INNER is not a hard register, then INNER will not need reloading
+ unless it's a mode dependent memory reference. */
+ if (regno >= FIRST_PSEUDO_REGISTER)
+ return !output
+ && reg_equiv_mem (regno) != 0
+ && mode_dependent_address_p (XEXP (reg_equiv_mem (regno), 0),
+ MEM_ADDR_SPACE (reg_equiv_mem (regno)));
+
/* If INNER is not ok for MODE, then INNER will need reloading. */
if (!targetm.hard_regno_mode_ok (subreg_regno (x), mode))
return true;
@@ -1138,7 +1149,7 @@ push_reload (rtx in, rtx out, rtx *inloc
if (in != 0 && reload_inner_reg_of_subreg (in, inmode, false))
{
- if (REG_P (SUBREG_REG (in)))
+ if (REG_P (SUBREG_REG (in)) && HARD_REGISTER_P (SUBREG_REG (in)))
subreg_in_class
= find_valid_class (inmode, GET_MODE (SUBREG_REG (in)),
subreg_regno_offset (REGNO (SUBREG_REG (in)),
@@ -1146,8 +1157,13 @@ push_reload (rtx in, rtx out, rtx *inloc
SUBREG_BYTE (in),
GET_MODE (in)),
REGNO (SUBREG_REG (in)));
+#if 1 // XXXMRG
+ else if (REG_P (SUBREG_REG (in))
+ || GET_CODE (SUBREG_REG (in)) == SYMBOL_REF)
+#else
else if (CONSTANT_P (SUBREG_REG (in))
|| GET_CODE (SUBREG_REG (in)) == PLUS)
+#endif
subreg_in_class = find_valid_class_1 (inmode,
GET_MODE (SUBREG_REG (in)),
rclass);
Index: src/external/gpl3/gcc/dist/gcc/targhooks.cc
diff -u src/external/gpl3/gcc/dist/gcc/targhooks.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/targhooks.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/targhooks.cc:1.1.1.1 Sun Jul 30 05:20:56 2023
+++ src/external/gpl3/gcc/dist/gcc/targhooks.cc Sun Jul 30 06:15:16 2023
@@ -961,7 +961,17 @@ default_hidden_stack_protect_fail (void)
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
DECL_VISIBILITY_SPECIFIED (t) = 1;
+#if 1
+ /*
+ * This is a hack:
+ * It appears that our gas does not generate @PLT for hidden
+ * symbols. It could be that we need a newer version, or that
+ * this local function is handled differently on linux.
+ */
+ DECL_VISIBILITY (t) = VISIBILITY_DEFAULT;
+#else
DECL_VISIBILITY (t) = VISIBILITY_HIDDEN;
+#endif
stack_chk_fail_decl = t;
}
Index: src/external/gpl3/gcc/dist/gcc/tree-cfg.cc
diff -u src/external/gpl3/gcc/dist/gcc/tree-cfg.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/tree-cfg.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/tree-cfg.cc:1.1.1.1 Sun Jul 30 05:20:58 2023
+++ src/external/gpl3/gcc/dist/gcc/tree-cfg.cc Sun Jul 30 06:15:16 2023
@@ -9508,7 +9508,11 @@ pass_warn_function_return::execute (func
}
if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus;
- warning_at (location, 0, "%<noreturn%> function does return");
+
+#ifdef notyet
+ if (warn_missing_noreturn)
+ warning_at (location, 0, "%<noreturn%> function does return");
+#endif
}
/* If we see "return;" in some basic block, then we do reach the end
Index: src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc
diff -u src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc:1.1.1.1 Sun Jul 30 05:20:51 2023
+++ src/external/gpl3/gcc/dist/gcc/tree-ssa-ccp.cc Sun Jul 30 06:15:16 2023
@@ -4641,3 +4641,49 @@ make_pass_post_ipa_warn (gcc::context *c
{
return new pass_post_ipa_warn (ctxt);
}
+
+#if defined(__NetBSD__) && defined(NETBSD_NATIVE)
+/*
+ * This is a big, ugly, temporary hack:
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59958
+ * To make sure we have configured all our targets correctly, mimic the
+ * #ifdef cascade from src/lib/libc/stdlib/jemalloc.c here and compile
+ * time assert that the value matches gcc's MALLOC_ABI_ALIGNMENT here.
+ */
+
+#if defined(__hppa__)
+#define JEMALLOC_TINY_MIN_2POW 4
+#elif defined(__alpha__) || defined(__amd64__) || defined(__sparc64__) \
+ || (defined(__arm__) && defined(__ARM_EABI__)) \
+ || defined(__ia64__) || defined(__powerpc__) \
+ || defined(__aarch64__) \
+ || ((defined(__mips__) || defined(__riscv__)) && defined(_LP64))
+#define JEMALLOC_TINY_MIN_2POW 3
+#endif
+
+#ifndef JEMALLOC_TINY_MIN_2POW
+#define JEMALLOC_TINY_MIN_2POW 2
+#endif
+
+/* make sure we test the (native) 64bit variant for targets supporting -m32 */
+#undef TARGET_64BIT
+#ifdef _LP64
+#define TARGET_64BIT 1
+#else
+#ifdef __sh__
+#undef UNITS_PER_WORD
+#define UNITS_PER_WORD 4 /* original definition varies depending on cpu */
+#endif
+#define TARGET_64BIT 0
+#endif
+
+/* ARM has a non-constant MALLOC_ABI_ALIGNMENT since GCC 5. */
+#if !defined(__arm__)
+#ifdef __CTASSERT
+__CTASSERT((8<<JEMALLOC_TINY_MIN_2POW) == MALLOC_ABI_ALIGNMENT);
+#else
+#error compiling on an older NetBSD version?
+#endif
+#endif
+
+#endif
Index: src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc
diff -u src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc:1.1.1.1 Sun Jul 30 05:21:14 2023
+++ src/external/gpl3/gcc/dist/gcc/c-family/c-cppbuiltin.cc Sun Jul 30 06:15:16 2023
@@ -532,22 +532,35 @@ builtin_define_stdint_macros (void)
builtin_define_type_max ("__UINT_LEAST64_MAX__", uint_least64_type_node);
builtin_define_constants ("__UINT64_C", uint_least64_type_node);
}
+/*
+ * NetBSD/sparc64 long ago defined signed and unsigned fast{8,16,32} to be
+ * different to the common sparc64 definitions, and they are not the same
+ * size for the same bitsize. GCC 7 introduced checks that they are the
+ * same size below that trigger here.
+ *
+ * NETBSD_TOOLS/NETBSD_NATIVE is wrong for this, but it will do for now.
+ */
+#if defined(NETBSD_TOOLS) || defined(NETBSD_NATIVE)
+#define builtin_define_type_width_nb(a,b,c) builtin_define_type_width(a,b,NULL_TREE)
+#else
+#define builtin_define_type_width_nb(a,b,c) builtin_define_type_width(a,b,c)
+#endif
if (int_fast8_type_node)
{
builtin_define_type_max ("__INT_FAST8_MAX__", int_fast8_type_node);
- builtin_define_type_width ("__INT_FAST8_WIDTH__", int_fast8_type_node,
+ builtin_define_type_width_nb ("__INT_FAST8_WIDTH__", int_fast8_type_node,
uint_fast8_type_node);
}
if (int_fast16_type_node)
{
builtin_define_type_max ("__INT_FAST16_MAX__", int_fast16_type_node);
- builtin_define_type_width ("__INT_FAST16_WIDTH__", int_fast16_type_node,
+ builtin_define_type_width_nb ("__INT_FAST16_WIDTH__", int_fast16_type_node,
uint_fast16_type_node);
}
if (int_fast32_type_node)
{
builtin_define_type_max ("__INT_FAST32_MAX__", int_fast32_type_node);
- builtin_define_type_width ("__INT_FAST32_WIDTH__", int_fast32_type_node,
+ builtin_define_type_width_nb ("__INT_FAST32_WIDTH__", int_fast32_type_node,
uint_fast32_type_node);
}
if (int_fast64_type_node)
@@ -556,6 +569,7 @@ builtin_define_stdint_macros (void)
builtin_define_type_width ("__INT_FAST64_WIDTH__", int_fast64_type_node,
uint_fast64_type_node);
}
+#undef builtin_define_type_width_nb
if (uint_fast8_type_node)
builtin_define_type_max ("__UINT_FAST8_MAX__", uint_fast8_type_node);
if (uint_fast16_type_node)
Index: src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc
diff -u src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc:1.1.1.1 Sun Jul 30 05:21:14 2023
+++ src/external/gpl3/gcc/dist/gcc/c-family/c-format.cc Sun Jul 30 06:15:16 2023
@@ -926,43 +926,43 @@ static const format_kind_info format_typ
printf_flag_specs, printf_flag_pairs,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
'w', 0, 'p', 0, 'L', 0,
- &integer_type_node, &integer_type_node
+ &integer_type_node, &integer_type_node, format_type_error
},
{ "asm_fprintf", asm_fprintf_length_specs, asm_fprintf_char_table, " +#0-", NULL,
asm_fprintf_flag_specs, asm_fprintf_flag_pairs,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK,
'w', 0, 'p', 0, 'L', 0,
- NULL, NULL
+ NULL, NULL, format_type_error
},
{ "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL,
gcc_diag_flag_specs, gcc_diag_flag_pairs,
- FMT_FLAG_ARG_CONVERT,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK,
0, 0, 'p', 0, 'L', 0,
- NULL, &integer_type_node
+ NULL, &integer_type_node, format_type_error
},
{ "gcc_tdiag", gcc_tdiag_length_specs, gcc_tdiag_char_table, "q+#", NULL,
gcc_tdiag_flag_specs, gcc_tdiag_flag_pairs,
- FMT_FLAG_ARG_CONVERT,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK,
0, 0, 'p', 0, 'L', 0,
- NULL, &integer_type_node
+ NULL, &integer_type_node, format_type_error
},
{ "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+#", NULL,
gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs,
- FMT_FLAG_ARG_CONVERT,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK,
0, 0, 'p', 0, 'L', 0,
- NULL, &integer_type_node
+ NULL, &integer_type_node, format_type_error
},
{ "gcc_cxxdiag", gcc_cxxdiag_length_specs, gcc_cxxdiag_char_table, "q+#", NULL,
gcc_cxxdiag_flag_specs, gcc_cxxdiag_flag_pairs,
- FMT_FLAG_ARG_CONVERT,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK,
0, 0, 'p', 0, 'L', 0,
- NULL, &integer_type_node
+ NULL, &integer_type_node, format_type_error
},
{ "gcc_gfc", gcc_gfc_length_specs, gcc_gfc_char_table, "q+#", NULL,
gcc_gfc_flag_specs, gcc_gfc_flag_pairs,
- FMT_FLAG_ARG_CONVERT,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_M_OK,
0, 0, 0, 0, 0, 0,
- NULL, NULL
+ NULL, NULL, format_type_error
},
{ "gcc_dump_printf", gcc_dump_printf_length_specs,
gcc_dump_printf_char_table, "q+#", NULL,
@@ -974,24 +974,30 @@ static const format_kind_info format_typ
{ "NSString", NULL, NULL, NULL, NULL,
NULL, NULL,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL, 0, 0, 0, 0, 0, 0,
- NULL, NULL
+ NULL, NULL, format_type_error
},
{ "gnu_scanf", scanf_length_specs, scan_char_table, "*'I", NULL,
scanf_flag_specs, scanf_flag_pairs,
FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK,
'w', 0, 0, '*', 'L', 'm',
- NULL, NULL
+ NULL, NULL, format_type_error
},
{ "gnu_strftime", NULL, time_char_table, "_-0^#", "EO",
strftime_flag_specs, strftime_flag_pairs,
- FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0, 0,
- NULL, NULL
+ FMT_FLAG_FANCY_PERCENT_OK|FMT_FLAG_M_OK, 'w', 0, 0, 0, 0, 0,
+ NULL, NULL, format_type_error
},
{ "gnu_strfmon", strfmon_length_specs, monetary_char_table, "=^+(!-", NULL,
strfmon_flag_specs, strfmon_flag_pairs,
FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0,
- NULL, NULL
- }
+ NULL, NULL, format_type_error
+ },
+ { "gnu_syslog", printf_length_specs, print_char_table, " +#0-'I", NULL,
+ printf_flag_specs, printf_flag_pairs,
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_M_OK,
+ 'w', 0, 'p', 0, 'L', 0,
+ &integer_type_node, &integer_type_node, printf_format_type
+ },
};
/* This layer of indirection allows GCC to reassign format_types with
@@ -1187,6 +1193,7 @@ check_function_format (const_tree fntype
params = tree_cons (NULL_TREE, argarray[i], params);
check_format_info (&info, params, arglocs);
}
+ const format_kind_info *fi = &format_types[info.format_type];
/* Attempt to detect whether the current function might benefit
from the format attribute if the called function is decorated
@@ -1195,8 +1202,7 @@ check_function_format (const_tree fntype
if (warn_suggest_attribute_format
&& current_function_decl != NULL_TREE
&& info.first_arg_num == 0
- && (format_types[info.format_type].flags
- & (int) FMT_FLAG_ARG_CONVERT)
+ && (fi->flags & (int) FMT_FLAG_ARG_CONVERT)
/* c_strlen will fail for a function parameter but succeed
for a literal or constant array. */
&& !c_strlen (argarray[info.format_num - 1], 1))
@@ -1205,11 +1211,17 @@ check_function_format (const_tree fntype
for (c = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl));
c;
c = TREE_CHAIN (c))
- if (is_attribute_p ("format", get_attribute_name (c))
- && (decode_format_type (IDENTIFIER_POINTER
- (TREE_VALUE (TREE_VALUE (c))))
- == info.format_type))
- break;
+ {
+ if (!is_attribute_p ("format", TREE_PURPOSE (c)))
+ continue;
+ int format_type = decode_format_type (
+ IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (c))));
+ if (format_type == format_type_error)
+ continue;
+ if (format_type == info.format_type ||
+ format_type == fi->parent_format_type)
+ break;
+ }
if (c == NULL_TREE)
{
/* Check if the current function has a parameter to which
@@ -3891,6 +3903,14 @@ check_format_info_main (format_check_res
"conversion lacks type at end of format");
continue;
}
+
+ if (format_char == 'm' && !(fki->flags & FMT_FLAG_M_OK))
+ {
+ warning (OPT_Wformat_,
+ "%%m is only allowed in syslog(3) like functions");
+ continue;
+ }
+
format_chars++;
const format_char_info * const fci
@@ -5093,6 +5113,7 @@ extern const target_ovr_attr TARGET_OVER
static const target_ovr_attr gnu_target_overrides_format_attributes[] =
{
{ "gnu_printf", "printf" },
+ { "gnu_syslog", "syslog" },
{ "gnu_scanf", "scanf" },
{ "gnu_strftime", "strftime" },
{ "gnu_strfmon", "strfmon" },
Index: src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc
diff -u src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc:1.1.1.1 Sun Jul 30 05:21:14 2023
+++ src/external/gpl3/gcc/dist/gcc/c-family/c-opts.cc Sun Jul 30 06:15:16 2023
@@ -320,6 +320,10 @@ c_common_handle_option (size_t scode, co
cpp_opts->discard_comments_in_macro_exp = 0;
break;
+ case OPT_cxx_isystem:
+ add_path (xstrdup (arg), INC_SYSTEM, 1, true);
+ break;
+
case OPT_D:
defer_opt (code, arg);
break;
@@ -585,6 +589,10 @@ c_common_handle_option (size_t scode, co
add_path (xstrdup (arg), INC_QUOTE, 0, true);
break;
+ case OPT_iremap:
+ add_cpp_remap_path (arg);
+ break;
+
case OPT_isysroot:
sysroot = arg;
break;
Index: src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc
diff -u src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc:1.1.1.1 Sun Jul 30 05:21:11 2023
+++ src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.cc Sun Jul 30 06:15:16 2023
@@ -313,9 +313,9 @@ aarch64_option_init_struct (struct gcc_o
to calculate the feature strings is called on every options push,
pop and attribute change (arm_neon headers, lto etc all cause this to
happen quite frequently). It is a trade-off between time and space and
- so time won. */
+ so time won. Keep NULL entry last. */
int n_extensions
- = sizeof (all_extensions) / sizeof (struct aarch64_option_extension);
+ = sizeof (all_extensions_by_on) / sizeof (all_extensions_by_on[0]) - 1;
qsort (&all_extensions_by_on, n_extensions,
sizeof (struct aarch64_option_extension), opt_ext_cmp);
}
Index: src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc
diff -u src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc:1.1.1.1 Sun Jul 30 05:21:11 2023
+++ src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.cc Sun Jul 30 06:15:16 2023
@@ -55,6 +55,9 @@ arm_except_unwind_info (struct gcc_optio
return UI_SJLJ;
#endif
+ if (ARM_DWARF_UNWIND_TABLES)
+ return UI_DWARF2;
+
/* If not using ARM EABI unwind tables... */
if (ARM_UNWIND_INFO)
{
Index: src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc:1.1.1.1 Sun Jul 30 05:21:02 2023
+++ src/external/gpl3/gcc/dist/gcc/config/host-darwin.cc Sun Jul 30 06:15:17 2023
@@ -23,6 +23,8 @@
#include "options.h"
#include "diagnostic-core.h"
#include "config/host-darwin.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
#include <errno.h>
/* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the
@@ -78,6 +80,8 @@ darwin_gt_pch_get_address (size_t sz, in
if (addr == (void *) TRY_EMPTY_VM_SPACE)
return addr;
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
/* OK try to find a space without the constraint. */
addr = mmap ((void *) TRY_EMPTY_VM_SPACE, sz, PROT_READ | PROT_WRITE,
MAP_PRIVATE, fd, 0);
Index: src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc:1.1.1.1 Sun Jul 30 05:21:04 2023
+++ src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.cc Sun Jul 30 06:15:17 2023
@@ -1561,7 +1561,7 @@ aarch64_init_rng_builtins (void)
}
/* Initialize the memory tagging extension (MTE) builtins. */
-struct
+struct aarch64_mte
{
tree ftype;
enum insn_code icode;
Index: src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc:1.1.1.1 Sun Jul 30 05:21:04 2023
+++ src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.cc Sun Jul 30 06:15:17 2023
@@ -26,6 +26,7 @@
#include "coretypes.h"
#include "tm.h"
#include "aarch64-protos.h"
+#include "diagnostic-core.h"
struct aarch64_arch_extension
{
@@ -244,6 +245,14 @@ contains_core_p (unsigned *arr, unsigned
ARGC and ARGV are set depending on the actual arguments given
in the spec. */
+#ifdef __NetBSD__
+/* The NetBSD/arm64 platform may not export linux-style /proc/cpuinfo,
+ but the data is available via a sysctl(3) interface. */
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <aarch64/armreg.h>
+#endif
+
const char *
host_detect_local_cpu (int argc, const char **argv)
{
@@ -282,6 +291,7 @@ host_detect_local_cpu (int argc, const c
if (!arch && !tune && !cpu)
goto not_found;
+#ifndef __NetBSD__
fcpu_info = getenv ("GCC_CPUINFO");
if (fcpu_info)
f = fopen (fcpu_info, "r");
@@ -374,6 +384,145 @@ host_detect_local_cpu (int argc, const c
fclose (f);
f = NULL;
+#else
+ unsigned int curcpu;
+ size_t len;
+ char impl_buf[8];
+ int mib[2], ncpu;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ len = sizeof(ncpu);
+ if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1)
+ goto not_found;
+
+ for (curcpu = 0; curcpu < ncpu; curcpu++)
+ {
+ char path[128];
+ struct aarch64_sysctl_cpu_id id;
+
+ len = sizeof id;
+ snprintf(path, sizeof path, "machdep.cpu%d.cpu_id", curcpu);
+ if (sysctlbyname(path, &id, &len, NULL, 0) != 0)
+ goto not_found;
+
+ unsigned cimp = __SHIFTOUT(id.ac_midr, MIDR_EL1_IMPL);
+ if (cimp == INVALID_IMP)
+ goto not_found;
+
+ if (imp == INVALID_IMP)
+ imp = cimp;
+ /* FIXME: BIG.little implementers are always equal. */
+ else if (imp != cimp)
+ goto not_found;
+
+ unsigned cvariant = __SHIFTOUT(id.ac_midr, MIDR_EL1_VARIANT);
+ if (!contains_core_p (variants, cvariant))
+ {
+ if (n_variants == 2)
+ goto not_found;
+
+ variants[n_variants++] = cvariant;
+ }
+
+ unsigned ccore = __SHIFTOUT(id.ac_midr, MIDR_EL1_PARTNUM);
+ if (!contains_core_p (cores, ccore))
+ {
+ if (n_cores == 2)
+ goto not_found;
+
+ cores[n_cores++] = ccore;
+ }
+
+ if (!tune && !processed_exts)
+ {
+ std::string exts;
+
+ /* These are all the extensions from aarch64-option-extensions.def. */
+ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_FP) == ID_AA64PFR0_EL1_FP_IMPL)
+ exts += "fp ";
+ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_ADVSIMD) == ID_AA64PFR0_EL1_ADV_SIMD_IMPL)
+ exts += "asimd ";
+#ifdef ID_AA64ISAR0_EL1_RDM
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_RDM) == ID_AA64ISAR0_EL1_RDM_SQRDML)
+ exts += "asimdrdm ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_DP) == ID_AA64ISAR0_EL1_DP_UDOT)
+ exts += "asimddp ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_FHM) == ID_AA64ISAR0_EL1_FHM_FMLAL)
+ exts += "asimdfml ";
+#endif
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_AES)
+ exts += "aes ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_AES) == ID_AA64ISAR0_EL1_AES_PMUL)
+ exts += "aes pmull ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_CRC32) == ID_AA64ISAR0_EL1_CRC32_CRC32X)
+ exts += "crc32 ";
+#ifdef ID_AA64ISAR0_EL1_ATOMIC
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_ATOMIC) == ID_AA64ISAR0_EL1_ATOMIC_SWP)
+ exts += "atomics ";
+#endif
+ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA1) & ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU) != 0)
+ exts += "sha1 ";
+ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA256HSU) != 0)
+ exts += "sha2 ";
+#ifdef ID_AA64ISAR0_EL1_SHA2_SHA512HSU
+ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA2) & ID_AA64ISAR0_EL1_SHA2_SHA512HSU) != 0)
+ exts += "sha512 ";
+ if ((__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SHA3) & ID_AA64ISAR0_EL1_SHA3_EOR3) != 0)
+ exts += "sha3 ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM3) == ID_AA64ISAR0_EL1_SM3_SM3)
+ exts += "sm3 ";
+ if (__SHIFTOUT(id.ac_aa64isar0, ID_AA64ISAR0_EL1_SM4) == ID_AA64ISAR0_EL1_SM4_SM4)
+ exts += "sm4 ";
+ if (__SHIFTOUT(id.ac_aa64pfr0, ID_AA64PFR0_EL1_SVE) == ID_AA64PFR0_EL1_SVE_IMPL)
+ exts += "sve ";
+ if (__SHIFTOUT(id.ac_aa64isar1, ID_AA64ISAR1_EL1_LRCPC) == ID_AA64ISAR1_EL1_LRCPC_PR)
+ exts += "lrcpc ";
+#endif
+
+ for (i = 0; i < num_exts; i++)
+ {
+ const char *p = aarch64_extensions[i].feat_string;
+
+ /* If the feature contains no HWCAPS string then ignore it for the
+ auto detection. */
+ if (*p == '\0')
+ continue;
+
+ bool enabled = true;
+
+ /* This may be a multi-token feature string. We need
+ to match all parts, which could be in any order. */
+ size_t len = strlen (exts.c_str());
+ do
+ {
+ const char *end = strchr (p, ' ');
+ if (end == NULL)
+ end = strchr (p, '\0');
+ if (memmem (exts.c_str(), len, p, end - p) == NULL)
+ {
+ /* Failed to match this token. Turn off the
+ features we'd otherwise enable. */
+ enabled = false;
+ break;
+ }
+ if (*end == '\0')
+ break;
+ p = end + 1;
+ }
+ while (1);
+
+ if (enabled)
+ extension_flags |= aarch64_extensions[i].flag;
+ else
+ extension_flags &= ~(aarch64_extensions[i].flag);
+ }
+
+ processed_exts = true;
+ }
+ }
+ /* End of NetBSD specific section. */
+#endif
/* Weird cpuinfo format that we don't know how to handle. */
if (n_cores == 0
Index: src/external/gpl3/gcc/dist/gcc/config/i386/i386.h
diff -u src/external/gpl3/gcc/dist/gcc/config/i386/i386.h:1.16 src/external/gpl3/gcc/dist/gcc/config/i386/i386.h:1.17
--- src/external/gpl3/gcc/dist/gcc/config/i386/i386.h:1.16 Sun Jul 30 05:51:25 2023
+++ src/external/gpl3/gcc/dist/gcc/config/i386/i386.h Sun Jul 30 06:15:17 2023
@@ -2878,9 +2878,6 @@ extern enum attr_cpu ix86_schedule;
#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("no-mmx,no-sse")))
#endif
-/* Standard location for 32-bit ASAN shadow map. */
-#define X86_32_ASAN_BIT_OFFSET 29
-
/*
Local variables:
version-control: t
Index: src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h:1.16 src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h:1.17
--- src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h:1.16 Sun Jul 30 05:51:25 2023
+++ src/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h Sun Jul 30 06:15:17 2023
@@ -114,6 +114,7 @@ along with GCC; see the file COPYING3.
#undef PREFERRED_STACK_BOUNDARY_DEFAULT
#define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY
-/* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000. */
-#undef X86_32_ASAN_BIT_OFFSET
-#define X86_32_ASAN_BIT_OFFSET 30
+/* Define the shadow offsets for asan. */
+#undef SUBTARGET_SHADOW_OFFSET
+#define SUBTARGET_SHADOW_OFFSET \
+ (TARGET_LP64 ? HOST_WIDE_INT_1 << 46 : HOST_WIDE_INT_1 << 30)
Index: src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h
diff -u src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.16 src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.17
--- src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.16 Sun Jul 30 05:51:25 2023
+++ src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h Sun Jul 30 06:15:17 2023
@@ -74,6 +74,7 @@ along with GCC; see the file COPYING3.
#define HAVE_ENABLE_EXECUTE_STACK
-/* NetBSD/x86 on 32-bit places the ASAN shadow map at 0x40000000. */
-#undef X86_32_ASAN_BIT_OFFSET
-#define X86_32_ASAN_BIT_OFFSET 30
+/* Define the shadow offsets for asan. */
+#undef SUBTARGET_SHADOW_OFFSET
+#define SUBTARGET_SHADOW_OFFSET \
+ (TARGET_LP64 ? HOST_WIDE_INT_1 << 46 : HOST_WIDE_INT_1 << 30)
Index: src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc:1.1.1.1 Sun Jul 30 05:21:02 2023
+++ src/external/gpl3/gcc/dist/gcc/config/mips/mips.cc Sun Jul 30 06:15:17 2023
@@ -9579,7 +9579,7 @@ mips_output_external (FILE *file, tree d
/* Implement TARGET_ASM_OUTPUT_SOURCE_FILENAME. */
-static void
+static void ATTRIBUTE_UNUSED
mips_output_filename (FILE *stream, const char *name)
{
/* If we are emitting DWARF-2, let dwarf2out handle the ".file"
@@ -22992,8 +22992,10 @@ mips_asm_file_end (void)
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT mips_trampoline_init
+#ifndef MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME
#undef TARGET_ASM_OUTPUT_SOURCE_FILENAME
#define TARGET_ASM_OUTPUT_SOURCE_FILENAME mips_output_filename
+#endif /* MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME */
#undef TARGET_SHIFT_TRUNCATION_MASK
#define TARGET_SHIFT_TRUNCATION_MASK mips_shift_truncation_mask
Index: src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc:1.1.1.1 Sun Jul 30 05:21:08 2023
+++ src/external/gpl3/gcc/dist/gcc/config/pa/pa.cc Sun Jul 30 06:15:17 2023
@@ -1128,9 +1128,9 @@ hppa_legitimize_address (rtx x, rtx oldx
|| GET_CODE (XEXP (x, 0)) == REG))
{
rtx int_part, ptr_reg;
- int newoffset;
- int offset = INTVAL (XEXP (x, 1));
- int mask;
+ HOST_WIDE_INT newoffset;
+ HOST_WIDE_INT offset = INTVAL (XEXP (x, 1));
+ HOST_WIDE_INT mask;
mask = (GET_MODE_CLASS (mode) == MODE_FLOAT
&& !INT14_OK_STRICT ? 0x1f : 0x3fff);
@@ -1185,7 +1185,7 @@ hppa_legitimize_address (rtx x, rtx oldx
{
/* If we were given a MULT, we must fix the constant
as we're going to create the ASHIFT form. */
- int shift_val = INTVAL (XEXP (XEXP (x, 0), 1));
+ HOST_WIDE_INT shift_val = INTVAL (XEXP (XEXP (x, 0), 1));
if (GET_CODE (XEXP (x, 0)) == MULT)
shift_val = exact_log2 (shift_val);
@@ -1268,7 +1268,7 @@ hppa_legitimize_address (rtx x, rtx oldx
&& INTVAL (XEXP (idx, 1)) % INTVAL (XEXP (XEXP (idx, 0), 1)) == 0)
{
/* Divide the CONST_INT by the scale factor, then add it to A. */
- int val = INTVAL (XEXP (idx, 1));
+ HOST_WIDE_INT val = INTVAL (XEXP (idx, 1));
val /= (1 << shift_val);
reg1 = XEXP (XEXP (idx, 0), 0);
@@ -1372,7 +1372,7 @@ hppa_legitimize_address (rtx x, rtx oldx
&& INTVAL (XEXP (y, 1)) >= -4096
&& INTVAL (XEXP (y, 1)) <= 4095)
{
- int shift_val = INTVAL (XEXP (XEXP (x, 0), 1));
+ HOST_WIDE_INT shift_val = INTVAL (XEXP (XEXP (x, 0), 1));
/* If we were given a MULT, we must fix the constant
as we're going to create the ASHIFT form. */
@@ -3005,8 +3005,8 @@ find_addr_reg (rtx addr)
const char *
pa_output_block_move (rtx *operands, int size_is_constant ATTRIBUTE_UNUSED)
{
- int align = INTVAL (operands[5]);
- unsigned long n_bytes = INTVAL (operands[4]);
+ HOST_WIDE_INT align = INTVAL (operands[5]);
+ unsigned HOST_WIDE_INT n_bytes = INTVAL (operands[4]);
/* We can't move more than a word at a time because the PA
has no longer integer move insns. (Could use fp mem ops?) */
@@ -3133,8 +3133,8 @@ static int
compute_cpymem_length (rtx_insn *insn)
{
rtx pat = PATTERN (insn);
- unsigned int align = INTVAL (XEXP (XVECEXP (pat, 0, 7), 0));
- unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0));
+ unsigned HOST_WIDE_INT align = INTVAL (XEXP (XVECEXP (pat, 0, 7), 0));
+ unsigned HOST_WIDE_INT n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0));
unsigned int n_insns = 0;
/* We can't move more than four bytes at a time because the PA
@@ -3169,8 +3169,8 @@ compute_cpymem_length (rtx_insn *insn)
const char *
pa_output_block_clear (rtx *operands, int size_is_constant ATTRIBUTE_UNUSED)
{
- int align = INTVAL (operands[3]);
- unsigned long n_bytes = INTVAL (operands[2]);
+ HOST_WIDE_INT align = INTVAL (operands[3]);
+ unsigned HOST_WIDE_INT n_bytes = INTVAL (operands[2]);
/* We can't clear more than a word at a time because the PA
has no longer integer move insns. */
@@ -3275,8 +3275,8 @@ static int
compute_clrmem_length (rtx_insn *insn)
{
rtx pat = PATTERN (insn);
- unsigned int align = INTVAL (XEXP (XVECEXP (pat, 0, 4), 0));
- unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 3), 0));
+ unsigned HOST_WIDE_INT align = INTVAL (XEXP (XVECEXP (pat, 0, 4), 0));
+ unsigned HOST_WIDE_INT n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 3), 0));
unsigned int n_insns = 0;
/* We can't clear more than a word at a time because the PA
@@ -5797,7 +5797,7 @@ pa_som_file_start (void)
static void
pa_linux_file_start (void)
{
- pa_file_start_file (1);
+ pa_file_start_file (0);
pa_file_start_level ();
pa_file_start_mcount ("CODE");
}
@@ -6022,7 +6022,7 @@ pa_emit_hpdiv_const (rtx *operands, int
const char *
pa_output_div_insn (rtx *operands, int unsignedp, rtx_insn *insn)
{
- int divisor;
+ HOST_WIDE_INT divisor;
/* If the divisor is a constant, try to use one of the special
opcodes .*/
Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc:1.1.1.1 Sun Jul 30 05:21:06 2023
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-logue.cc Sun Jul 30 06:15:17 2023
@@ -2277,7 +2277,8 @@ rs6000_savres_routine_name (int regno, i
}
else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
{
-#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
+#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) \
+ && !defined(POWERPC_NETBSD)
/* No out-of-line save/restore routines for GPRs on AIX. */
gcc_assert (!TARGET_AIX || (sel & SAVRES_REG) != SAVRES_GPR);
#endif
@@ -2289,7 +2290,8 @@ rs6000_savres_routine_name (int regno, i
: ((sel & SAVRES_LR) ? "_restgpr0_" : "_restgpr1_"));
else if ((sel & SAVRES_REG) == SAVRES_FPR)
{
-#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
+#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) \
+ || defined(POWERPC_NETBSD)
if ((sel & SAVRES_LR))
prefix = ((sel & SAVRES_SAVE) ? "_savefpr_" : "_restfpr_");
else
Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc:1.2
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc:1.1.1.1 Sun Jul 30 05:21:06 2023
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.cc Sun Jul 30 06:15:17 2023
@@ -97,7 +97,7 @@ extern tree rs6000_builtin_reciprocal (t
of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
properly defined. */
#ifndef TARGET_IEEEQUAD_DEFAULT
-#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
+#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) && !defined(POWERPC_NETBSD)
#define TARGET_IEEEQUAD_DEFAULT 1
#else
#define TARGET_IEEEQUAD_DEFAULT 0
@@ -20755,7 +20755,11 @@ rs6000_elf_reloc_rw_mask (void)
if (flag_pic)
return 3;
else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
+#if defined (POWERPC_NETBSD)
+ return 3;
+#else
return 2;
+#endif
else
return 0;
}
Index: src/external/gpl3/gcc/dist/libcpp/files.cc
diff -u src/external/gpl3/gcc/dist/libcpp/files.cc:1.1.1.1 src/external/gpl3/gcc/dist/libcpp/files.cc:1.2
--- src/external/gpl3/gcc/dist/libcpp/files.cc:1.1.1.1 Sun Jul 30 05:20:39 2023
+++ src/external/gpl3/gcc/dist/libcpp/files.cc Sun Jul 30 06:15:17 2023
@@ -222,20 +222,32 @@ static bool check_file_against_entries (
static bool
open_file (_cpp_file *file)
{
+ const char *cpp_restricted;
+
+ cpp_restricted = getenv ("CPP_RESTRICTED");
+
if (file->path[0] == '\0')
{
file->fd = 0;
set_stdin_to_binary_mode ();
}
else
- file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY, 0666);
+ file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY
+ | ((cpp_restricted != NULL) ? O_NONBLOCK : 0), 0666);
+
if (file->fd != -1)
{
if (fstat (file->fd, &file->st) == 0)
{
if (!S_ISDIR (file->st.st_mode))
+ if (cpp_restricted != NULL
+ ? S_ISREG (file->st.st_mode) : !S_ISDIR (file->st.st_mode))
+
{
+ if (cpp_restricted)
+ fcntl(file->fd, F_SETFL,
+ fcntl(file->fd, F_GETFL, 0) & ~O_NONBLOCK);
file->err_no = 0;
return true;
}
Index: src/external/gpl3/gcc/dist/libcpp/lex.cc
diff -u src/external/gpl3/gcc/dist/libcpp/lex.cc:1.1.1.1 src/external/gpl3/gcc/dist/libcpp/lex.cc:1.2
--- src/external/gpl3/gcc/dist/libcpp/lex.cc:1.1.1.1 Sun Jul 30 05:20:40 2023
+++ src/external/gpl3/gcc/dist/libcpp/lex.cc Sun Jul 30 06:15:17 2023
@@ -2775,6 +2775,8 @@ save_comment (cpp_reader *pfile, cpp_tok
{
unsigned char *buffer;
unsigned int len, clen, i;
+ int convert_to_c = (pfile->state.in_directive || pfile->state.parsing_args)
+ && type == '/';
len = pfile->buffer->cur - from + 1; /* + 1 for the initial '/'. */
@@ -2789,8 +2791,7 @@ save_comment (cpp_reader *pfile, cpp_tok
Note that the only time we encounter a directive here is
when we are saving comments in a "#define". */
- clen = ((pfile->state.in_directive || pfile->state.parsing_args)
- && type == '/') ? len + 2 : len;
+ clen = convert_to_c ? len + 2 : len;
buffer = _cpp_unaligned_alloc (pfile, clen);
@@ -2802,7 +2803,7 @@ save_comment (cpp_reader *pfile, cpp_tok
memcpy (buffer + 1, from, len - 1);
/* Finish conversion to a C comment, if necessary. */
- if ((pfile->state.in_directive || pfile->state.parsing_args) && type == '/')
+ if (convert_to_c)
{
buffer[1] = '*';
buffer[clen - 2] = '*';
Index: src/external/gpl3/gcc/dist/libcpp/macro.cc
diff -u src/external/gpl3/gcc/dist/libcpp/macro.cc:1.1.1.1 src/external/gpl3/gcc/dist/libcpp/macro.cc:1.2
--- src/external/gpl3/gcc/dist/libcpp/macro.cc:1.1.1.1 Sun Jul 30 05:20:40 2023
+++ src/external/gpl3/gcc/dist/libcpp/macro.cc Sun Jul 30 06:15:17 2023
@@ -483,6 +483,61 @@ static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
+static size_t remap_pairs;
+static char **remap_src;
+static char **remap_dst;
+
+void
+add_cpp_remap_path (const char *arg)
+{
+ const char *arg_dst;
+ size_t len;
+
+ arg_dst = strchr(arg, ':');
+ if (arg_dst == NULL) {
+ fprintf(stderr, "Invalid argument for -iremap");
+ exit(1);
+ }
+ len = arg_dst - arg;
+ ++arg_dst;
+
+ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1));
+ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1));
+
+ remap_src[remap_pairs] = (char *) xmalloc(len + 1);
+ memcpy(remap_src[remap_pairs], arg, len);
+ remap_src[remap_pairs][len] = '\0';
+ remap_dst[remap_pairs] = xstrdup(arg_dst);
+ ++remap_pairs;
+}
+
+static const char *
+cpp_remap_file (const char *arg, char **tmp_name)
+{
+ char *result;
+ size_t i, len;
+
+ for (i = 0; i < remap_pairs; ++i) {
+ len = strlen (remap_src[i]);
+ if (strncmp (remap_src[i], arg, len))
+ continue;
+ if (arg[len] == '\0')
+ return remap_dst[i];
+ if (arg[len] != '/')
+ continue;
+ arg += len;
+ len = strlen (remap_dst[i]);
+ result = (char *) xmalloc (len + strlen (arg) + 1);
+ memcpy(result, remap_dst[i], len);
+ strcpy(result + len, arg);
+ *tmp_name = result;
+
+ return result;
+ }
+
+ return arg;
+}
+
/* Helper function for builtin_macro. Returns the text generated by
a builtin macro. */
const uchar *
@@ -547,6 +602,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
{
unsigned int len;
const char *name;
+ char *tmp_name;
uchar *buf;
if (node->value.builtin == BT_FILE
@@ -565,11 +621,14 @@ _cpp_builtin_macro_text (cpp_reader *pfi
}
if (pfile->cb.remap_filename)
name = pfile->cb.remap_filename (name);
+ tmp_name = NULL;
+ name = cpp_remap_file (name, &tmp_name);
len = strlen (name);
buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
result = buf;
*buf = '"';
buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len);
+ free (tmp_name);
*buf++ = '"';
*buf = '\0';
}