aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend
AgeCommit message (Collapse)AuthorFilesLines
2022-12-22compiler: remove unused fieldsIan Lance Taylor8-34/+19
This avoids clang warnings: gcc/go/gofrontend/escape.cc:1290:17: warning: private field 'fn_' is not used [-Wunused-private-field] gcc/go/gofrontend/escape.cc:3478:19: warning: private field 'context_' is not used [-Wunused-private-field] gcc/go/gofrontend/lex.h:564:15: warning: private field 'input_file_name_' is not used [-Wunused-private-field] gcc/go/gofrontend/types.cc:5788:20: warning: private field 'call_' is not used [-Wunused-private-field] gcc/go/gofrontend/wb.cc:206:9: warning: private field 'gogo_' is not used [-Wunused-private-field] Path by Martin Liška. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458975
2022-12-20libgo: check for makecontext in -lucontextIan Lance Taylor1-1/+1
Patch from Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
2022-12-12libgo: bump major versionIan Lance Taylor1-1/+1
PR go/108057 The current version is the same as for the previous GCC release, but there have been minor changes like new type descriptors that make it impossible to run Go programs built with the previous GCC release with the current libgo. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/456976
2022-11-30runtime: force XSI strerror on hurdIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454275
2022-11-29syscall, runtime: always call XSI strerror_rIan Lance Taylor1-1/+1
This does the right thing for either glibc or musl on GNU/Linux. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
2022-10-27runtime: use _libgo_off_t_type when calling C mmapIan Lance Taylor1-1/+1
The last argument to the C mmap function is type off_t, not uintptr. On some 32-bit systems, off_t is larger than uintptr. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
2022-10-10compiler: treat S("") as a string constantIan Lance Taylor2-1/+4
The compiler neglected to notice that a conversion from a string constant to a string type was a valid string constant. No test case because this only caused a compiler failure when compiling without optimization, which is not the normal case, and is not a case that we test. Fixes golang/go#56113 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/441555
2022-10-10compiler: only build thunk struct type when it is neededIan Lance Taylor3-30/+11
Instead of building the thunk struct type in the determine_types pass, build it when we need it. That ensures that we are consistent in determining whether an argument is constant. We no longer need to add a field for a call to recover, as the simplify_thunk_statements pass runs after the build_recover_thunks pass, so the additional argument will already have been added to the call. The test case is https://go.dev/cl/440297. Fixes golang/go#56109 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/440298
2022-10-06compiler: better arg type checking for selected builtinsThan McIntosh2-2/+7
Tighten up the argument type checking for Builtin_call_expression to catch erroneous cases such as panic(panic("bad"))) where an argument void type is being passed to panic/alignof/sizeof. Fixes golang/go#56071. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/439815
2022-09-27runtime: portable access to sigev_notify_thread_idIan Lance Taylor1-1/+1
Previously, libgo relied on the _sigev_un implementation-specific field in struct sigevent, which is only available on glibc. This patch uses the sigev_notify_thread_id macro instead which is mandated by timer_create(2). In theory, this should work with any libc implementation for Linux. Unfortunately, there is an open glibc bug as glibc does not define this macro. For this reason, a glibc-specific workaround is required. Other libcs (such as musl) define the macro and don't require the workaround. See https://sourceware.org/bugzilla/show_bug.cgi?id=27417 This makes libgo compatible with musl libc. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/434755
2022-09-27runtime: synchronize empty struct field handlingmelonedo1-1/+1
In GCCGO and gollvm, the logic for allocating one byte for the last field is: 1. the last field has zero size 2. the struct itself does not have zero size 3. the last field is not blank this commit adds the last two conditions to runtime.structToFFI. For golang/go#55146 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
2022-09-22cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheapIan Lance Taylor1-1/+1
This ports https://go.dev/cl/421879 to libgo. This is a quick port to update gofrontend to work with the version of cgo in gc mainline. A more complete port will follow, changing the gc version of cmd/cgo to choose an approach based on feature testing the gccgo in use. Updates golang/go#46731 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/432338
2022-09-06runtime: ignore __morestack function in runtime.CallersIan Lance Taylor1-1/+1
We were ignoring all functions starting with "__morestack_", but not the function "__morestack" itself. Without this change, some tests such as recover.go started failing recently, though I'm not sure exactly what changed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/427935
2022-07-30libgo: use SYS_timer_settime32Ian Lance Taylor1-1/+1
Musl defines SYS_timer_settime32, not SYS_timer_settime, on 32-bit systems. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/420222
2022-07-22libgo: use POSIX shell arithmetic expansionIan Lance Taylor1-1/+1
Avoid bash-specific ((expression)) syntax. As the bash syntax converts a non-zero value to a zero status (and a zero value to a 1 status), and POSIX arithmetic expansion does not, we have to negate the result. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/419154
2022-07-13libgo: don't include <linux/fs.h> when building gen-sysinfo.goIan Lance Taylor1-1/+1
Removing this doesn't change anything at least with glibc 2.33. The include was added in https://go.dev/cl/6100049 but it's not clear why. Fixes PR go/106266 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294
2022-07-05compiler: propagate array length error marker fartherIan Lance Taylor3-2/+11
Fixes golang/go#53639 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415936
2022-07-05compiler: better error message for unknown package nameIan Lance Taylor2-2/+6
Fixes golang/go#51237 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415994
2022-07-01compiler: use correct init order for multi-value initializationIan Lance Taylor5-98/+150
Use the correct initialization order for var a = c var b, c = x.(bool) The global c is initialized by the preinit of b, but were missing a dependency of c on b, so a would be initialized to the zero value of c rather than the correct value. Simply adding the dependency of c on b didn't work because the preinit of b refers to c, so that appeared circular. So this patch changes the init order to skip dependencies that only appear on the left hand side of assignments in preinit blocks. Doing that didn't work because the write barrier pass can transform "a = b" into code like "gcWriteBarrier(&a, b)" that is not obviously a simple assigment. So this patch moves the collection of dependencies to just after lowering, before the write barriers are inserted. Making those changes permit relaxing the requirement that we don't warn about self-dependency in preinit blocks, so now we correctly warn for var a, b any = b.(bool) The test case is https://go.dev/cl/415238. Fixes golang/go#53619 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415594
2022-07-01compiler: rename "requires" to "needs"Ian Lance Taylor3-17/+17
As of C++20 "requires" is a C++ keyword. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415754
2022-06-30libgo: handle stat st_atim32 field and SYS_SECCOMPIan Lance Taylor1-1/+1
Patches for musl support, from Sören Tempel. Fixes PR go/105225 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415294
2022-06-29compiler: check repeated const expressions in new scopeIan Lance Taylor5-92/+215
Test case is const8.go in https://go.dev/cl/414795. Fixes golang/go#53585 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414914
2022-06-28compiler: use package path with embedded builtin typeIan Lance Taylor2-9/+22
The test case is https://go.dev/cl/414235. Fixes golang/go#52856 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414294
2022-06-28libgo: make runtime.Version return a meaningful stringIan Lance Taylor1-1/+1
Fixes golang/go#51850 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414734
2022-06-28compiler: permit expressions of abstract bool to remain abstractIan Lance Taylor2-5/+6
Test case is https://go.dev/cl/414755. Fixes golang/go#51475 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414735
2022-06-27compiler: don't use sink as parameter in method expression thunkIan Lance Taylor3-5/+13
Also fix a couple of cases where the error led to a later compiler crash. Test case is https://go.dev/cl/414336. Fixes golang/go#52871 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414354
2022-06-27compiler: always initialize mpfr in integer importIan Lance Taylor2-2/+2
Test case is https://go.dev/cl/413980. Fixes golang/go#52862 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413981
2022-06-24compiler: use bool for comma-ok if not already booleanIan Lance Taylor2-8/+12
If a comma-ok variable already has a type, and that type is not a boolean type, then set the type of the temporary variable to bool. Otherwise we may try to convert an unnamed bool type to an interface type, which will fail. But we don't want to always use bool, because the type of the comma-ok variable may be a named bool type, in which case the assignment would fail (or need an explicit conversion). The test case is https://go.dev/cl/404496. Fixes golang/go#52535 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413894
2022-06-23compiler: in Sort_bindings return false if comparing value to itselfzhangjian2-1/+4
Some versions of std::sort may pass elements at the same iterator location. Fixes golang/go#53483 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413434
2022-06-23compiler: unalias types for hash/equality functionsIan Lance Taylor3-7/+14
Test case is https://go.dev/cl/413694. Fixes golang/go#52846 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413660
2022-06-21libgo: #include <sys/types.h> when checking for loff_tIan Lance Taylor1-1/+1
PR go/106033 Fixes golang/go#53469 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413214
2022-06-17libgo: permit loff_t and off_t to be macrosIan Lance Taylor1-1/+1
They are macros in musl libc, rather than typedefs, and -fgo-dump-spec doesn't handle that case. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412075
2022-06-16compiler: don't generate stubs for ambiguous direct interface methodsMikhail Ablakatov2-2/+2
Current implementation checks whether it has to generate a stub method for a promoted method of an embedded struct field in Type::build_stub_methods(). If the promoted method is ambiguous it's simply skipped. But struct types that can fit in an interface value (e.g. structs that consist of a single pointer field) get a second chance in Type::build_direct_iface_stub_methods(). This patch adds the same check used by Type::build_stub_methods() to Type::build_direct_iface_stub_methods(). Fixes golang/go#52870 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405974
2022-06-14syscall: gofmtIan Lance Taylor1-1/+1
Add blank lines after //sys comments where needed, and then run gofmt on the syscall package with the new formatter. This is the libgo version of CL 407136. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412074
2022-05-18compiler: traverse expressions when exporting constantsJulia Lapenko2-1/+29
When exporting a constant A that is expressed through a constant B from another package, it is necessary to traverse an expression representing the constant A to generate a sequence of type casts from the constant B. Current implementation doesn't collect types of constants contained in such expressions. This change fetches these types. Fixes golang/go#51291 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405976
2022-05-17compiler: load LHS subexpressions of op= assignment only onceIan Lance Taylor2-1/+11
Fixes golang/go#52811 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405617
2022-05-13compiler: always sort interface parse methodsIan Lance Taylor4-52/+289
The exporter relies on sorting interface parse methods. It would sort them as it encountered interface types. However, when an interface type is an element of a struct or array type, the exporter might encounter that interface type before sorting the parse methods. If it then encountered an identical interface type again, it could get confused about whether the two types are identical or not. Fix the problem by always sorting the parse methods in the finalize_methods pass. Also firm up the export type sorting to make sure we never have this kind of confusion again. Doing this revealed that we need to be more careful about sorting in order to handle aliases correctly. Also fix the interface type hash computation to use the right hash value when looking at parse methods rather than all methods. The test case for this is https://go.dev/cl/405759. Fixes golang/go#52841 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405556
2022-05-06compiler: remove Array_index_expression::is_lvalue_Ian Lance Taylor5-45/+9
As of CL 77510 it is never true. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/394695
2022-05-06compiler: error for duplicate bool map keysIan Lance Taylor2-1/+17
For golang/go#35945 Fixes golang/go#28104 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/403954
2022-04-20runtime: use correct field name for PPC32 GLIBC registersIan Lance Taylor1-1/+1
One of these days we will get this right. Fixes PR go/105315 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401374
2022-04-19libgo: make a couple of sed uses POSIX compliantIan Lance Taylor1-1/+1
Patch from Jonathan Wakely. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401054
2022-04-18libgo: only add signum to siglist if it doesn't exist yetSören Tempel1-1/+1
This fixes a build issue on musl libc where the same signal number is used for SIGIO and SIGPOLL. This causes a compilation error since the signal numbers must be unique for the signal table. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400595
2022-04-18runtime: add special handling for signal 34A. Wilcox1-1/+1
The musl libc uses signal 34 internally for setgid (similar to how glibc uses signal 32 and signal 33). For this reason, special handling is needed for this signal in the runtime. The gc implementation already handles the signal accordingly. As such, this commit intends to simply copy the behavior of the Google Go implementation to libgo. See https://go.dev/issues/39343 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400594
2022-04-15compiler: revert `for package-scope "a = b; b = x" just set "a = x"`Ian Lance Taylor2-31/+8
Revert CL 245098. It caused incorrect initialization ordering. Adjust the runtime package to work even with the CL reverted. Original description of CL 245098: This avoids requiring an init function to initialize the variable. This can only be done if x is a static initializer. The go1.15rc1 runtime package relies on this optimization. The package has a variable "var maxSearchAddr = maxOffAddr". The maxSearchAddr variable is used by code that runs before package initialization is complete. For golang/go#51913 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/395994
2022-04-14runtime: use regset indexes for PPC register valuesIan Lance Taylor1-1/+1
Using names depended on <asm/ptrace.h>, which glibc includes somewhere but musl did not. Change to just always use indexes. Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400214
2022-03-31runtime: support PPC32 MUSL register accessIan Lance Taylor1-1/+1
Based on patch by Sören Tempel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394
2022-03-16libgo: update to final Go 1.18 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/393377
2022-03-08compiler: ignore function type result name in export dataIan Lance Taylor2-2/+2
This change ensures that we never output a result name in the export data if there is only a single result. Previously we would output a ? if the single result had a name. That made the output unstable, because the hashing ignores the result name, so whether we output a ? or not depended on how equal hash elements were handled. For https://gcc.gnu.org/PR104832 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390874
2022-03-04mkruntimeinc: skip _FILEIan Lance Taylor1-1/+1
We don't need it, and it breaks uclibc. PR go/101246 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390021
2022-03-04libgo: move golang.org/x/sync/semaphore to gotool packagesClément Chigot1-1/+1
golang/x/sync/semaphore is required by gofmt.go. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388634