aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2021-05-25Daily bump.GCC Administrator1-0/+6
2021-05-24compiler: mark global variables whose address is takenIan Lance Taylor7-184/+276
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
2021-05-18gcc/go/ChangeLog: remove entry for reverted changeIan Lance Taylor1-5/+0
2021-05-18gofrontend: revert startswith changeIan Lance Taylor1-1/+1
This file is copied from a different repo and should not be changed directly in the GCC repo.
2021-05-18libgo: update configure to current sourcesIan Lance Taylor1-1/+1
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>
2021-05-11Daily bump.GCC Administrator1-0/+5
2021-05-10Come up with startswith function.Martin Liska1-1/+1
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.
2021-04-12libgo: update to Go1.16.3 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/309490
2021-03-17compiler: copy receiver argument for go/defer of method callIan Lance Taylor3-2/+29
Test case is https://golang.org/cl/302371. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/302270
2021-03-15libgo: update to Go 1.16.2 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301459
2021-03-12misc/cgo/testcarchive: don't use == for string equality in C codeIan Lance Taylor1-1/+1
Backport of https://golang.org/cl/300993. For PR go/99553 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/301458
2021-03-11compiler: create temporaries for heap variablesIan Lance Taylor6-56/+99
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
2021-03-08runtime: cast SIGSTKSZ to uintptrIan Lance Taylor1-1/+1
In newer versions of glibc it is long, which causes a signed comparison warning. Fixes PR go/99458
2021-03-02compiler: allow //go:embed in files underscore-importing embedMichael Matloob5-21/+14
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
2021-02-25libgo: ensure memmove, memset 8 byte atomicity on ppc64xLynn Boger1-1/+1
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
2021-02-19libgo: update to Go1.16 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/293793
2021-02-16compiler: unalias receiver type in export dataIan Lance Taylor2-2/+2
Test case is https://golang.org/cl/292009. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/291991
2021-02-12compiler: open byte slice and string embeds using the absolute pathMichael Matloob2-4/+3
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
2021-02-03libgo: install new 1.16 packagesIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/289069
2021-01-29internal/cpu: correctly link to getsystemcfgClément Chigot1-1/+1
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
2021-01-29libgo: update to Go1.16rc1Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/287493
2021-01-29Daily bump.GCC Administrator1-0/+5
2021-01-28gccgo driver: always act as though -g is passedIan Lance Taylor1-0/+24
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.
2021-01-19compiler: initialize variables with go:embed directivesIan Lance Taylor4-2/+347
This completes the compiler work for go:embed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281536
2021-01-18compiler: read embedcfg files, parse go:embed directivesIan Lance Taylor9-33/+234
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
2021-01-16Daily bump.GCC Administrator1-0/+4
2021-01-14compiler: add support for reading embedcfg filesIan Lance Taylor4-1/+634
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
2021-01-14libgo: update hurd supportIan Lance Taylor1-1/+1
Patch from Svante Signell. Fixes PR go/98496 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/283692
2021-01-12syscall: ensure openat uses variadic libc wrapperPaul E. Murphy1-1/+1
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
2021-01-06Daily bump.GCC Administrator1-0/+13
2021-01-05syscall: don't define sys_SETREUID and friendsIan Lance Taylor1-1/+1
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
2021-01-05internal/cpu: more build fixes for Go1.16beta1 releaseIan Lance Taylor1-1/+1
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
2021-01-05go: Fix -fgo-embedcfg= option description.Jakub Jelinek1-1/+1
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.
2021-01-04Go frontend: add -fgo-embedcfg optionIan Lance Taylor4-0/+20
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.
2021-01-04Update copyright years.Jakub Jelinek13-13/+13
2021-01-04Update Copyright in ChangeLog filesJakub Jelinek1-1/+1
Do this separately from all other Copyright updates, as ChangeLog files can be modified only separately.
2021-01-02Daily bump.GCC Administrator1-0/+4
2021-01-01internal/cpu: add aarch64 support functionsIan Lance Taylor1-1/+1
Patch from Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281000
2021-01-01runtime: move startupRandomData back to runtime2.goIan Lance Taylor1-1/+1
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
2021-01-01internal/cpu, golang.org/x/sys/cpu: support other GOARCH valuesIan Lance Taylor1-1/+1
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
2021-01-01Update copyright dates.Jakub Jelinek1-1/+1
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.
2020-12-30libgo: update to Go1.16beta1 releaseIan Lance Taylor1-1/+1
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
2020-12-23compiler: parenthesize channel type strings if necessaryIan Lance Taylor2-1/+16
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
2020-12-23compiler: nil-checked pointers and index expressions can trapIan Lance Taylor2-7/+5
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
2020-12-23compiler: remove references to slicecopy and slicestringcopyIan Lance Taylor3-11/+1
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
2020-12-23Daily bump.GCC Administrator1-0/+6
2020-12-22compiler: initialize saw_send_stmt localsIan Lance Taylor2-3/+3
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
2020-12-22runtime: eliminate scase.kind fieldIan Lance Taylor5-63/+129
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
2020-12-22runtime: add "success" field to sudogIan Lance Taylor1-1/+1
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
2020-12-22runtime: omit nil-channel cases from selectgo's ordersIan Lance Taylor1-1/+1
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