Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
To implement this, change the backend to use flag bits for variables.
Fixes https://gcc.gnu.org/PR100537
PR go/100537
* go-gcc.cc (class Gcc_backend): Update methods that create
variables to take a flags parameter.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/322129
|
|
|
|
This file is copied from a different repo and should not be changed
directly in the GCC repo.
|
|
Change-Id: I12766baf02bfdf2233f1c5bde1a270f06b020aa7
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/321076
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
|
|
|
|
gcc/ada/ChangeLog:
* gcc-interface/utils.c (def_builtin_1): Use startswith
function instead of strncmp.
gcc/analyzer/ChangeLog:
* sm-file.cc (is_file_using_fn_p): Use startswith
function instead of strncmp.
gcc/ChangeLog:
* builtins.c (is_builtin_name): Use startswith
function instead of strncmp.
* collect2.c (main): Likewise.
(has_lto_section): Likewise.
(scan_libraries): Likewise.
* coverage.c (coverage_checksum_string): Likewise.
(coverage_init): Likewise.
* dwarf2out.c (is_cxx): Likewise.
(gen_compile_unit_die): Likewise.
* gcc-ar.c (main): Likewise.
* gcc.c (init_spec): Likewise.
(read_specs): Likewise.
(execute): Likewise.
(check_live_switch): Likewise.
* genattrtab.c (write_attr_case): Likewise.
(IS_ATTR_GROUP): Likewise.
* gencfn-macros.c (main): Likewise.
* gengtype.c (type_for_name): Likewise.
(gen_rtx_next): Likewise.
(get_file_langdir): Likewise.
(write_local): Likewise.
* genmatch.c (get_operator): Likewise.
(get_operand_type): Likewise.
(expr::gen_transform): Likewise.
* genoutput.c (validate_optab_operands): Likewise.
* incpath.c (add_sysroot_to_chain): Likewise.
* langhooks.c (lang_GNU_C): Likewise.
(lang_GNU_CXX): Likewise.
(lang_GNU_Fortran): Likewise.
(lang_GNU_OBJC): Likewise.
* lto-wrapper.c (run_gcc): Likewise.
* omp-general.c (omp_max_simt_vf): Likewise.
* omp-low.c (omp_runtime_api_call): Likewise.
* opts-common.c (parse_options_from_collect_gcc_options): Likewise.
* read-rtl-function.c (function_reader::read_rtx_operand_r): Likewise.
* real.c (real_from_string): Likewise.
* selftest.c (assert_str_startswith): Likewise.
* timevar.c (timer::validate_phases): Likewise.
* tree.c (get_file_function_name): Likewise.
* ubsan.c (ubsan_use_new_style_p): Likewise.
* varasm.c (default_function_rodata_section): Likewise.
(incorporeal_function_p): Likewise.
(default_section_type_flags): Likewise.
* system.h (startswith): Define startswith.
gcc/c-family/ChangeLog:
* c-ada-spec.c (print_destructor): Use startswith
function instead of strncmp.
(dump_ada_declaration): Likewise.
* c-common.c (disable_builtin_function): Likewise.
(def_builtin_1): Likewise.
* c-format.c (check_tokens): Likewise.
(check_plain): Likewise.
(convert_format_name_to_system_name): Likewise.
gcc/c/ChangeLog:
* c-aux-info.c (affix_data_type): Use startswith
function instead of strncmp.
* c-typeck.c (build_function_call_vec): Likewise.
* gimple-parser.c (c_parser_gimple_parse_bb_spec): Likewise.
gcc/cp/ChangeLog:
* decl.c (duplicate_decls): Use startswith
function instead of strncmp.
(cxx_builtin_function): Likewise.
(omp_declare_variant_finalize_one): Likewise.
(grokfndecl): Likewise.
* error.c (dump_decl_name): Likewise.
* mangle.c (find_decomp_unqualified_name): Likewise.
(write_guarded_var_name): Likewise.
(decl_tls_wrapper_p): Likewise.
* parser.c (cp_parser_simple_type_specifier): Likewise.
(cp_parser_tx_qualifier_opt): Likewise.
* pt.c (template_parm_object_p): Likewise.
(dguide_name_p): Likewise.
gcc/d/ChangeLog:
* d-builtins.cc (do_build_builtin_fn): Use startswith
function instead of strncmp.
* dmd/dinterpret.c (evaluateIfBuiltin): Likewise.
* dmd/dmangle.c: Likewise.
* dmd/hdrgen.c: Likewise.
* dmd/identifier.c (Identifier::toHChars2): Likewise.
gcc/fortran/ChangeLog:
* decl.c (variable_decl): Use startswith
function instead of strncmp.
(gfc_match_end): Likewise.
* gfortran.h (gfc_str_startswith): Likewise.
* module.c (load_omp_udrs): Likewise.
(read_module): Likewise.
* options.c (gfc_handle_runtime_check_option): Likewise.
* primary.c (match_arg_list_function): Likewise.
* trans-decl.c (gfc_get_symbol_decl): Likewise.
* trans-expr.c (gfc_conv_procedure_call): Likewise.
* trans-intrinsic.c (gfc_conv_ieee_arithmetic_function): Likewise.
gcc/go/ChangeLog:
* gofrontend/runtime.cc (Runtime::name_to_code): Use startswith
function instead of strncmp.
gcc/objc/ChangeLog:
* objc-act.c (objc_string_ref_type_p): Use startswith
function instead of strncmp.
* objc-encoding.c (encode_type): Likewise.
* objc-next-runtime-abi-02.c (has_load_impl): Likewise.
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
|
|
Test case is https://golang.org/cl/302371.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/302270
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301459
|
|
Backport of https://golang.org/cl/300993.
For PR go/99553
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301458
|
|
The compiler generally doesn't create a temporary for an expression
that is a variable, because it's normally valid to simply reload the
value from the variable. However, if the variable is in the heap,
then loading the value is a pointer indirection. The process of
creating GCC IR can cause the variable load and the pointer
indirection to be split, such that the second evaluation only does the
pointer indirection. If there are conditionals in between the two
uses, this can cause the second use to load the pointer from an
uninitialized register.
Avoid this by introducing a new Expression method that returns whether
it is safe to evaluate an expression multiple times, and use it
everywhere.
The test case is https://golang.org/cl/300789.
Fixes golang/go#44383
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/300809
|
|
In newer versions of glibc it is long, which causes a signed
comparison warning.
Fixes PR go/99458
|
|
The embed spec allows for //go:embed to be used in files that
underscore-import package "embed". This is useful for embeds to
[]byte and string vars because the embed.FS type may not be referenced
if those are the only types of embeds in a file. Because the compiler
previously checked whether there were any aliases to the embed
package to decide if //go:embed could be used, it would reject
files with only underscore imports of embed. Instead, record
whether the embed import is encountered at all, similar to what
is done with unsafe, to decide whether //go:embed is allowed.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/297553
|
|
Go requires that pointer moves are done 8 bytes at a time,
but gccgo uses libc's memmove and memset which does not require
that, and there are some cases where an 8 byte move might be
done as 4+4.
To enforce 8 byte moves for memmove and memset, this adds a
C implementation in libgo/runtime for memmove and memset to be
used on ppc64le and ppc64. Asm implementations were considered
but discarded to avoid different implementations for different
target ISAs.
Fixes golang/go#41428
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/294931
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/293793
|
|
Test case is https://golang.org/cl/292009.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291991
|
|
The paths vector contains the names of the files that the embed_files_
map is keyed by. While the code processing embed.FS values looks up
the paths in the embed_files_ map, the code processing string and byte
slice embeds tries opening the files using their names directly. Look
up the full paths in the embed_files_ map when opening them.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291429
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/289069
|
|
Directly set getsystemcfg as //extern in internal/cpu instead of
trying to use the runtime as in Go toolchain.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287932
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287493
|
|
|
|
The go1 compiler always turns on debugging, to support Go stack traces
and functions like runtime.Callers. With the recent switch to turn on
DWARF 5 by default, this caused failures with some versions of gas,
such as 2.35.1, because the assembly code would assume DWARF 5 but the
driver would not pass --gdwarf-5 to gas. gas would then give an
error: "file number less than one".
This change avoids that problem by having the gccgo driver spec add a
-g option to the command line if no other -g option is present. The
newly added -g option is passed to the assembler as --gdwarf-5.
* gospec.c (lang_specific_driver): Add -g if no debugging options
were passed.
|
|
This completes the compiler work for go:embed.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281536
|
|
This change reads go:embed directives and attaches them to variables.
We still don't do anything with the directives.
This change also reads the file passed in the -fgo-embedcfg option.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281533
|
|
|
|
This is the code that parses an embedcfg file, which is a JSON file
created by the go command when it sees go:embed directives. This code
is not yet called, and does not yet do anything. It's being sent as a
separate CL to isolate just the JSON parsing code.
* Make-lang.in (GO_OBJS): Add go/embed.o.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281532
|
|
Patch from Svante Signell.
Fixes PR go/98496
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692
|
|
On powerpc64le, this caused a failure in TestUnshareUidGidMapping
due to stack corruption which resulted in a bogus execve syscall.
Use the existing c wrapper to ensure we respect the ppc abi for
variadic functions.
Fixes PR go/98610
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/282717
|
|
|
|
We don't use them, since we always call the C library functions which do
the right thing anyhow. And they aren't defined on all GNU/Linux variants.
Fixes PR go/98510
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281473
|
|
Some files were missing from the libgo copy of internal/cpu, because they
used to only declare CacheLinePadSize which libgo gets from goarch.sh.
Now they also declare doinit, so copy them over. Adjust cpu_other.go.
Fix the amd64p32 build by adding a build constraint to cpu_no_name.go.
Fixes PR go/98493
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281472
|
|
Description of options should be . terminated, the:
FAIL: compiler driver --help=go option(s): "^ +-.*[^:.]$" absent from output: " -fgo-embedcfg=<file> List embedded files via go:embed"
test even reports that.
2021-01-05 Jakub Jelinek <jakub@redhat.com>
* lang.opt (fgo-embedcfg=): Add full stop at the end of description.
|
|
This option will be used by the go command to implement go:embed directives,
which are new with the upcoming Go 1.16 release.
* lang.opt (fgo-embedcfg): New option.
* go-c.h (struct go_create_gogo_args): Add embedcfg field.
* go-lang.c (go_embedcfg): New static variable.
(go_langhook_init): Set go_create_gogo_args embedcfg field.
(go_langhook_handle_option): Handle OPT_fgo_embedcfg_.
* gccgo.texi (Invoking gccgo): Document -fgo-embedcfg.
|
|
|
|
Do this separately from all other Copyright updates, as ChangeLog files
can be modified only separately.
|
|
|
|
Patch from Andreas Schwab.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281000
|
|
In libgo it's referenced from os_gccgo.go on all platforms.
Fixes go/98496
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280999
|
|
Add support (mostly dummy support) for GOARCH values supported by
gofrontend but not gc. Fix PPC handling.
Fixes https://gcc.gnu.org/PR98493
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280932
|
|
Manual part of copyright year updates.
2021-01-01 Jakub Jelinek <jakub@redhat.com>
gcc/
* gcc.c (process_command): Update copyright notice dates.
* gcov-dump.c (print_version): Ditto.
* gcov.c (print_version): Ditto.
* gcov-tool.c (print_version): Ditto.
* gengtype.c (create_file): Ditto.
* doc/cpp.texi: Bump @copying's copyright year.
* doc/cppinternals.texi: Ditto.
* doc/gcc.texi: Ditto.
* doc/gccint.texi: Ditto.
* doc/gcov.texi: Ditto.
* doc/install.texi: Ditto.
* doc/invoke.texi: Ditto.
gcc/ada/
* gnat_ugn.texi: Bump @copying's copyright year.
* gnat_rm.texi: Likewise.
gcc/d/
* gdc.texi: Bump @copyrights-d year.
gcc/fortran/
* gfortranspec.c (lang_specific_driver): Update copyright notice
dates.
* gfc-internals.texi: Bump @copying's copyright year.
* gfortran.texi: Ditto.
* intrinsic.texi: Ditto.
* invoke.texi: Ditto.
gcc/go/
* gccgo.texi: Bump @copyrights-go year.
libgomp/
* libgomp.texi: Bump @copying's copyright year.
libitm/
* libitm.texi: Bump @copying's copyright year.
libquadmath/
* libquadmath.texi: Bump @copying's copyright year.
|
|
This does not yet include support for the //go:embed directive added
in this release.
* Makefile.am (check-runtime): Don't create check-runtime-dir.
(mostlyclean-local): Don't remove check-runtime-dir.
(check-go-tool, check-vet): Copy in go.mod and modules.txt.
(check-cgo-test, check-carchive-test): Add go.mod file.
* Makefile.in: Regenerate.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280172
|
|
Avoid the ambiguity between "chan <- (chan int)" and "chan (<- chan int)".
This parenthesizes the same way as the gc compiler.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279961
|
|
The compiler was treating indirections through pointers that had been
explicitly checked against nil and slice and string index expressions
as non-trapping memory references. That is true for ordinary Go
programs, but it isn't true if the programs construct their own memory
addresses. In particular it isn't true for the kinds of programs that
want to use runtime.SetPanicOnFault.
The effect of this will be slightly larger binaries, due to additional
exception information, and perhaps slightly less optimization.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279960
|
|
The only calls to the runtime functions were removed in CL 170005.
The slicestringcopy function will be removed in the Go 1.16beta1 release.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279932
|
|
|
|
The C++ compiler wasn't warning because we take their address.
Fixes golang/go#43252
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279752
|
|
This is the gofrontend version of https://golang.org/cl/245125.
Original CL description:
Currently, we include a "kind" field on scase to distinguish the three
kinds of cases in a select statement: sends, receives, and defaults.
This commit removes by kind field by instead arranging for the
compiler to always place sends before receives, and to provide their
counts separately. It also passes an explicit "block bool" parameter
to avoid needing to include a default case in the array.
It's safe to shuffle cases like this because the runtime will
randomize the order they're polled in anyway.
For golang/go#40410.
This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279735
|
|
This is the gofrontend version of https://golang.org/cl/245019.
Original CL description:
The current wakeup protocol for channel communications is that the
second goroutine sets gp.param to the sudog when a value is
successfully communicated over the channel, and to nil when the wakeup
is due to closing the channel.
Setting nil to indicate channel closure works okay for chansend and
chanrecv, because they're only communicating with one channel, so they
know it must be the channel that was closed. However, it means
selectgo has to re-poll all of the channels to figure out which one
was closed.
This commit adds a "success" field to sudog, and changes the wakeup
protocol to always set gp.param to sg, and to use sg.success to
indicate successful communication vs channel closure.
While here, this also reorganizes the chansend code slightly so that
the sudog is still released to the pool if the send blocks and then is
awoken because the channel closed.
For golang/go#40410
This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1, setting up for more compiler changes related to select handling.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279734
|
|
This is the gofrontend version of https://golang.org/cl/245123.
Original CL description:
Currently, selectgo does an initial pass over the cases array to look
for entries with nil channels, so they can be easily recognized and
skipped later on. But this still involves actually visiting the cases.
This commit changes selectgo to omit cases with nil channels when
constructing pollorder, so that they'll be skipped over entirely later
on. It also checks for caseDefault up front, which will facilitate
changing it to use a "block bool" parameter instead.
Updates golang/go#40410
This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1, setting up for more compiler changes related to select handling.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279733
|