Age | Commit message (Collapse) | Author | Files | Lines |
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Fixes golang/go#53639
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415936
|
|
Fixes golang/go#51237
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415994
|
|
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
|
|
As of C++20 "requires" is a C++ keyword.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415754
|
|
Patches for musl support, from Sören Tempel.
Fixes PR go/105225
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415294
|
|
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
|
|
The test case is https://go.dev/cl/414235.
Fixes golang/go#52856
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414294
|
|
Fixes golang/go#51850
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414734
|
|
Test case is https://go.dev/cl/414755.
Fixes golang/go#51475
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414735
|
|
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
|
|
Test case is https://go.dev/cl/413980.
Fixes golang/go#52862
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413981
|
|
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
|
|
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
|
|
Test case is https://go.dev/cl/413694.
Fixes golang/go#52846
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413660
|
|
PR go/106033
Fixes golang/go#53469
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413214
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Fixes golang/go#52811
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405617
|
|
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
|
|
As of CL 77510 it is never true.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/394695
|
|
For golang/go#35945
Fixes golang/go#28104
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/403954
|
|
One of these days we will get this right.
Fixes PR go/105315
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401374
|
|
Patch from Jonathan Wakely.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/401054
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/397394
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/393377
|
|
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
|
|
We don't need it, and it breaks uclibc.
PR go/101246
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/390021
|
|
golang/x/sync/semaphore is required by gofmt.go.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388634
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/388635
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/387514
|
|
Fixes libgo build on non-Linux systems.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/387134
|
|
Patches from Svante Signell for PR go/104290.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386797
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386594
|