aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2019-12-11compiler: generate type descriptor for pointer to alias defined in another ↵Ian Lance Taylor2-4/+4
package When a type descriptor is needed (for e.g. interface conversion), if the type is a pointer to a named type defined in another package, we don't generate the definition of the type descriptor because it is generated in the package where the type is defined. However, if the named type is an alias to an unnamed type, its descriptor is not generated in the other package, and we need to generate it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210787 From-SVN: r279207
2019-12-09re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd)Ian Lance Taylor1-1/+1
PR go/92861 runtime: don't define CLOCK_REALTIME in os_hurd.go It's already defined in sysinfo.go. Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210538 From-SVN: r279136
2019-12-09re PR go/92861 (Passes relative time to sem_timedwait on GNU/Hurd)Ian Lance Taylor1-1/+1
PR go/92861 runtime: use absolute time for sem_timedwait Patch by Samuel Thibault. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210457 From-SVN: r279106
2019-12-06re PR go/92820 (libgo.so.15 has executable stack)Ian Lance Taylor1-1/+1
PR go/92820 runtime: only build go-context for x86 GNU/Linux Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210258 From-SVN: r279063
2019-12-06re PR other/29842 ([meta-bug] outstanding patches / issues from ↵Ian Lance Taylor1-1/+1
STMicroelectronics) PR go/29842 runtime: update HURD support for mOS now being embedded Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210285 From-SVN: r279062
2019-12-06re PR go/92810 (Compiling GCC go for aarch64_be-marvell-linux-gnu fails)Ian Lance Taylor1-1/+1
PR go/92810 libgo: recognize aarch64_be as arm64be Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210038 From-SVN: r279032
2019-12-05re PR go/92820 (libgo.so.15 has executable stack)Ian Lance Taylor1-1/+1
PR go/92820 runtime: always mark assembly file as non-executable stack Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210037 From-SVN: r279010
2019-11-21re PR go/92605 (r278509 causes/reveals issue in building go library)Ian Lance Taylor1-1/+1
PR go/92605 runtime: declare runtime_usestackmaps in stack.c, not runtime.h Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/208161 From-SVN: r278540
2019-11-21mksysinfo: use type aliases for time struct field typesIan Lance Taylor1-1/+1
Also fix a case where grep wasn't redirecting to /dev/null. Fixes golang/go#35713 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/208160 From-SVN: r278539
2019-11-19libgo: better cmd/cgo handling for '.' in pkgpathIan Lance Taylor1-1/+1
Updates cgo's gccgoPkgpathToSymbolNew() to bring it into conformance with the way that gccgo now handles package paths with embedded dots (see CL 200838). See also https://gcc.gnu.org/PR61880, a related bug. This CL is a copy of CL 207957 in the main Go repo. Updates golang/go#35623. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207977 From-SVN: r278470
2019-11-15testmain.exp: link against GOLIBSIan Lance Taylor1-1/+1
Patch by Maciej W. Rozycki. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207458 From-SVN: r278316
2019-11-15compiler: fix buglet in function inlining related to sink namesIan Lance Taylor2-2/+4
When the compiler writes an inlinable function to the export data, parameter names are written out (in Export::write_name) using the Gogo::message_name as opposed to a raw/encoded name. This means that sink parameters (those named "_") get created with the name "_" instead of "._" (the name created by the lexer/parser). This confuses Gogo::is_sink_name, which looks for the latter sequence and not just "_". This can cause issues later on if an inlinable function is imported and fed through the rest of the compiler (things that are sinks are no recognized as such). To fix these issues, change Gogo::is_sink_name to return true for either variants ("_" or "._"). Fixes golang/go#35586. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207259 From-SVN: r278275
2019-11-12Use more SET_OPTION_IF_UNSET.Martin Liska2-10/+15
2019-11-12 Martin Liska <mliska@suse.cz> * config/i386/i386-options.c (ix86_recompute_optlev_based_flags): Use SET_OPTION_IF_UNSET. (ix86_option_override_internal): Likewise. * opts.c (default_options_optimization): Likewise. (finish_options): Likewise. (enable_fdo_optimizations): Likewise. (common_handle_option): Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_post_options): Use SET_OPTION_IF_UNSET. 2019-11-12 Martin Liska <mliska@suse.cz> * options.c (gfc_init_options): Use SET_OPTION_IF_UNSET. 2019-11-12 Martin Liska <mliska@suse.cz> * go-lang.c (go_langhook_post_options): Use SET_OPTION_IF_UNSET. From-SVN: r278091
2019-10-14compiler: revise exportdata fix for processing constant typesIan Lance Taylor2-2/+2
This patch is an addendum to the fix for issue 34577, which was not sufficiently general. During export data processing, when looking at the types of constants mentioned in inlinable function bodies, include both locally defined constants and constant imported from other packages. Testcase for this bug is in CL 201017. Fixes golang/go#34852. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201018 From-SVN: r276976
2019-10-14runtime: correct facilities names in s390 CPU supportIan Lance Taylor1-1/+1
Patch from Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201038 From-SVN: r276964
2019-10-14internal/cpu: define kdsaQuery for s390Ian Lance Taylor1-1/+1
Patch from Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201037 From-SVN: r276962
2019-10-12compiler: mangle dots in pkgpathIan Lance Taylor4-3/+25
We need to mangle dots to avoid problems with -fgo-pkgpath=a.0. That will confuse the name mangling, which assumes that names entering the mangling cannot contain arbitrary dot characters. We don't need to mangle other characters; go_encode_id will handle them. Fixes golang/go#33871 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/200838 From-SVN: r276913
2019-10-04compiler: include selected constant types during export processingIan Lance Taylor4-1/+31
The machinery that collects types referenced by expressions that are part of inlinable function bodies was missing the types of local named constants in certain cases. This patch updates the Collect_export_references::expression() hook to look for references to local named constants and include their types in the exported set. Fixes golang/go#34577. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198017 From-SVN: r276594
2019-10-04compiler: adjust code to avoid shadowing local variablesIan Lance Taylor8-91/+85
Also add a couple of missing calls to free after mpz_get_str. This should make the code clean with respect to -Wshadow=local. Based on patch by Bernd Edlinger. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198837 From-SVN: r276579
2019-10-02runtime: mark go-context.S as no-executable-stack and split-stack supportedIan Lance Taylor1-1/+1
The .note.GNU-stack section tells the linker that this object does not require an executable stack. The .note.GNU-split-stack section tells the linker that functions in this object can be called directly by split-stack functions, without require a large stack. The .note.GNU-no-split-stack section tells the linker that functions in this object do not have a split-stack prologue. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198440 From-SVN: r276488
2019-09-30compiler: change escape maps to hash tablesIan Lance Taylor3-31/+31
Also use just one table lookup, not two. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197759 From-SVN: r276382
2019-09-28compiler: resolve importing ambiguity for more complex function callsIan Lance Taylor2-1/+6
Tweak the exporter for inlinable function bodies to work around a problem with importing of function calls whose function expressions are not simple function names. In the bug in question, the function body exporter was writing out a function call of the form (*(*FuncTyp)(var))(arg) which produced an export data representation of *$convert(<type 5>, var)(x) which is hard to parse unambiguously. Fix: change the export data emitter to introduce parens around the function expression for more complex calls. Testcase for this bug is in CL 197217. Fixes golang/go#34503. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197122 From-SVN: r276228
2019-09-27compiler: don't read known type, simplify Import::finalize_methodsIan Lance Taylor3-23/+23
With the current export format, if we already know the type, we don't have to read and parse the definition. We only use the finalizer in Import::finalize_methods, so make it a local variable. To match Finalize_methods::type, only put struct types into real_for_named. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197700 From-SVN: r276188
2019-09-27compiler: only check whether struct or array types are bigIan Lance Taylor2-6/+18
Fetching the size of a type typically involves a hash table lookup, and is generally non-trivial. The escape analysis code calls is_big more than one might expect. So only fetch the size if we need it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197699 From-SVN: r276187
2019-09-27compiler: fix brace formattingIan Lance Taylor2-7/+8
Just happened to notice this one. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197698 From-SVN: r276186
2019-09-19libgo: support gollvm build on arm64 linuxIan Lance Taylor1-1/+1
This CL serves as part of an initial change for enabling gollvm building on arm64 linux, the rest of the change will be covered by another one to the gollvm repo. Incorporate type definition of 'uint128' to 'runtime' and 'syscall' packges, the change is not specific to arm64 linux but made available for all platforms. Verified by building and unit-testing gollvm on linux x86-64 and arm64. Verified by building and checking gccgo on linux x86-64 and arm64. Fixes golang/go#33711 Change-Id: I4720c7d810cfd4ef720962fb4104c5641b2459c0 From-SVN: r275919
2019-09-17runtime: for FFI, treat directIface types as pointersIan Lance Taylor1-1/+1
This only matters on systems that pass a struct with a single pointer field differently than passing a single pointer. I noticed it on 32-bit PPC, where the reflect package TestDirectIfaceMethod failed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195878 From-SVN: r275814
2019-09-17re PR go/91781 (r275691 breaks go test "reflect")Ian Lance Taylor1-1/+1
PR go/91781 reflect: promote integer closure return to full word The libffi library expects an integer return type to be promoted to a full word. Implement that when returning from a closure written in Go. This only matters on big-endian systems when returning an integer smaller than the pointer size, which is why we didn't notice it until now. Fixes https://gcc.gnu.org/PR91781. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195858 From-SVN: r275813
2019-09-17reflect: unexport FFICallbackGo; use go:linkname insteadIan Lance Taylor1-1/+1
The function was always intended to be internal-only, but was exported so that C code could call it. Now that have go:linkname for that, use it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195857 From-SVN: r275809
2019-09-16compiler: fix quoting of //go:linkname in error messageIan Lance Taylor2-2/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195718 From-SVN: r275758
2019-09-13libgo: don't use \? in grep patternIan Lance Taylor1-1/+1
It's not supported by Solaris grep. Just use * instead; it matches more but it shouldn't matter. Fixes https://gcc.gnu.org/PR91764 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195238 From-SVN: r275700
2019-09-12libgo: update to Go1.13Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194698 From-SVN: r275691
2019-09-11compiler: suppress type descriptor generation for aliasesIan Lance Taylor2-2/+8
Change Named_object::get_backend to ignore aliases when creating type descriptors for types, to be consistent with Type::needs_specific_type_functions and the Specific_type_functions traversal class. For example, when compiling a package that creates an alias to an an externally defined type, e.g. import "foo" type MyFoo = foo.Foo it makes sense to skip the alias (not try to generate type specific functions for it) and let the normal mechanisms take care of the alias target, depending on whether the target is defined locally or defined elsewhere. Testcase for this problen can be found in CL 193261. Fixes golang/go#33866. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191961 From-SVN: r275651
2019-09-11golang.org/x/sys/cpu: define doinit when neededIan Lance Taylor1-1/+1
Should fix the build on riscv64 and other systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194641 From-SVN: r275650
2019-09-11gotest: force test package to be imported firstIan Lance Taylor1-1/+1
When compiling the x_test package, force the test package to be imported first. That ensures that we will see the types defined in the test package before the types defined in the non-test version of the package. This matters if the types differ in some way, such as by adding a new method. This avoids a failure in internal/poll on Solaris, in which the test package adds a method to a type (FD.EOFError). I think it was Solaris- specific because files are sorted in a different order by default. The go tool handles this kind of thing correctly, by rebuilding dependent packages. This is just a hack sufficient to run the libgo testsuite without using the go tool. Fixes https://gcc.gnu.org/PR91712 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194637 From-SVN: r275648
2019-09-10libgo: Solaris and x/sys/cpu compatibility fixesIan Lance Taylor1-1/+1
Restore Solaris compatibility fixes lost when internal/x/net/lif moved to golang.org/x/net/lif. Also fix the Makefile for x/net/lif and x/net/route. Change x/sys/cpu to get the cache line size from goarch.sh as the gofrontend version of internal/cpu does. Partially based on work by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194438 From-SVN: r275611
2019-09-10re PR go/91621 (libgo/mksysinfo.sh: please avoid test ==)Ian Lance Taylor1-1/+1
PR go/91621 mksysinfo: change test == to test = Fixes https://gcc.gnu.org/PR91621 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194569 From-SVN: r275608
2019-09-10go/internal/gccgoimporter: support embedded field in pointer loopIan Lance Taylor1-1/+1
Backport of https://golang.org/cl/194440. Original description: If an embedded field refers to a type via a pointer, the parser needs to know the name of the embedded field. It is possible that the pointer type is not yet resolved. This CL fixes the parser to handle that case by setting the pointer element type to the unresolved named type while the pointer is being resolved. Updates golang/go#34182 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194562 From-SVN: r275606
2019-09-10cmd/go: look for tool build ID before hashing entire fileIan Lance Taylor1-1/+1
Also fix the key used to store the ID. This is a significant speedup in cmd/go run time. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194257 From-SVN: r275559
2019-09-10compiler: permit inlining constant expressions and expression statementsIan Lance Taylor4-1/+24
This relatively minor change increases the number of inlinable functions/methods in the standard library from 983 to 2179. In particular it permits inlining math/bits/RotateLeftNN. This restores the speed of crypto/sha256 back to what it was before the update to 1.13beta1. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194340 From-SVN: r275558
2019-09-09misc/cgo/testcshared: restore gofrontend-local changesIan Lance Taylor1-1/+1
They were lost when the files were moved in the update to Go1.13beta1. These changes should be made in the master repo for the 1.14 release, as riscv64 support is added there. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194343 From-SVN: r275551
2019-09-09libgo: only build x/sys/cpu/cpu_gccgo.c on x86 systemsIan Lance Taylor1-1/+1
The C file has a build tag, but the procedure we use for building C files ignores build tags. This should fix the libgo build on non-x86 systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194378 From-SVN: r275544
2019-09-09compiler: don't use predeclared location for implicit runtime importIan Lance Taylor2-3/+5
For the main package we add an implicit import of the runtime package, to ensure that it is initialized. That import used the predeclared location, which caused various tests, notably Named_type::is_builtin, to treat these imported names as builtin. Start using a real location, so that those tests do the right thing. By the way, this implicit import is a partial cause of golang/go#19773. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194337 From-SVN: r275540
2019-09-09compiler: traverse types of constant expressionsIan Lance Taylor3-1/+71
We forgot to ever traverse types of constant expressions. This rarely makes a difference--evidently, since nobody noticed--but it does matter when we inline constant expressions: we need to ensure that the type is visible to the importing code. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194317 From-SVN: r275539
2019-09-06libgo: update to Go 1.13beta1 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
2019-09-05re PR tree-optimization/91663 (split function can be re-inlined, leaving bad ↵Ian Lance Taylor2-0/+11
stack trace) PR tree-optimization/91663 * go-lang.c (go_langhook_post_options): Clear flag_partial_inlining. From-SVN: r275396
2019-09-03compiler: only import variable into . if same packageIan Lance Taylor2-2/+2
If we dot-import a package, we should only add an imported variable to the package bindings if the variable is in the package being imported. A test case for this is the 1.13 os package, in which ErrClosed and friends are defined both locally and in the imported internal/oserror package. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192718 From-SVN: r275358
2019-08-31compiler: check for notinheap struct at each struct fieldIan Lance Taylor2-26/+26
When generating write barriers, we were only checking for a notinheap struct at the outermost struct. That mishandled the case of setting a pointer to a notinheap struct as a field of another struct that is not notinheap. This caused an invalid write barrier error when building the 1.13 version of the runtime. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192279 From-SVN: r275240
2019-08-31compiler, runtime: support and use single argument go:linknameIan Lance Taylor5-9/+38
The gc compiler has started permitting go:linkname comments with a single argument to mean that a function should be externally visible outside the package. Implement this in the Go frontend. Change the libgo runtime package to use it, rather than repeating the name just to export a function. Remove a couple of unnecessary go:linkname comments on declarations. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192197 From-SVN: r275239
2019-08-31compiler: don't report runtime escapes if we've seen errorsIan Lance Taylor2-2/+4
If we get errors during compilation, we skip the escape analysis pass. If we are compiling the runtime package, we report an error if a bound method expression escapes. The effect is that if we get an error while compiling the runtime package, we would report confusing and meaningless errors about bound method expressions escaping. This CL stops doing that. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192720 From-SVN: r275238