| Age | Commit message (Collapse) | Author |
|
|
|
toolchains
Setting Windows 10 as the minimum target version requires setting
the IMAGE_GUARD_SECURITY_COOKIE_UNUSED flag in the PE load config
directory, else the executable will fail to run.
When using an external linker that flag is set by defining a
_load_config_used symbol with the proper value. However, older versions
of the GNU toolchain do not associate the _load_config_used symbol with
the PE load config directory.
To work around this issue, we can fallback to the previous minimum
Windows target version if the external linker doesn't special-case the
_load_config_used symbol.
Change-Id: I36ac7a2968c3576ac788bf192e7614bbae35ad1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/763960
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
We were depending on runtime.etypes immediately following the itabs.
However, on AIX, runtime.etypes, as a zero-sized symbol, can float
when using external linking. It won't necessarily stay right at the
end of the itabs. Rather than worry about this, just record the size
of the itab data.
In practice it almost always works on AIX, but it fails the runtime
test TestSchedPauseMetrics/runtime/debug.WriteHeapDump,
which fails when iterating over all the itabs.
Tested on AIX. This should fix AIX on the build dashboard.
Change-Id: Id3a113b75b93fa8440c047e92f764ab81423df48
Reviewed-on: https://go-review.googlesource.com/c/go/+/760203
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
|
|
Also take them out of the symbol table.
A new symbol runtime.gcmask.* marks where they start in BSS, and can
be used to find them if anybody cares.
Also stop checking for gcprog symbols that we no longer define.
Change-Id: I4060d8e9350c20568f020172caacd0439337cd2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/729880
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Instead of keeping a separate list of pointers to itabs,
just walk through the itabs themselves.
For #6853
Change-Id: If030bd64fbd01d73b0bf8495f6c9826ed2e61568
Reviewed-on: https://go-review.googlesource.com/c/go/+/729201
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Host objects are expected to have their .pdata entries in the correct
order, but the Go internal linker might reorder some of the functions
associated with the .pdata entries. This causes the .pdata section
in the final binary to have entries in the wrong order, and therefore
issues with unwinding on Windows.
The fix is to treat the .pdata entries of host objects as individual
symbols that will be retained only if the function they are associated
with is retained. Also, those entries will be sorted together with the
.pdata entries emitted by the Go compiler, ensuring the correct order
in the final binary.
Fixes #65116
Change-Id: I421471b2aef519b0c20707a40c4b7957db5d2ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/754080
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
The linker hardcoded the calculation for some types, which caused me
some annoyance in CL 711560 because I didn't know it needed to be
updated (and it took me a long time to find the hardcoded value).
Move this calculation over to the abi package, similar to other funcs.
Then update rttype.Init to also check that the function works, like
again like other funcs in this package.
This actually caught a latent bug; decodetypeMethods was incorrectly
calculating the size for the Interface case!
Change-Id: Iaa66055061b68ec93c9912ae6aa6e605260f52a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/749961
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Map groups are currently:
type group struct {
ctrl uint64
slots [8]slot
}
type slot struct {
key K
elem E
}
If the element type is struct{}, the slot will be padded so that the
address of the elem is unique rather than pointing outside the alloc.
This has the effect of map[K]struct{} wasting space due to the extra
byte and padding, making it no better than map[K]bool.
This CL changes the group layout to instead place keys and elems
together, as they used to be before swiss maps:
type group struct {
ctrl uint64
keys [8]K
elems [8]V
}
This is an alternative to CL 701976, which I suspect will have better
performance. Keys placed together should lead to better cache behavior,
at the cost of more expensive elem lookups, since the elems are not a
fixed offset from their keys.
This change is locked behind GOEXPERIMENT=mapsplitgroup.
Updates #70835
Updates #71368
Change-Id: Ide8d1406ae4ab636f86edc40e0640cc80653197c
Reviewed-on: https://go-review.googlesource.com/c/go/+/711560
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
The minimum Windows version has been 10 for a few releases, but the PE
headers weren't updated. Windows sometimes can use these in determining
what kind of subsystem compatibility hacks to apply, which of course we
don't want now, since Go targets Windows 10. This also causes older OSes
to refuse to run the executables, rather than having them crash in some
undefined way.
This isn't trivial to do, because subsystem ≥ 10.0 means that the
Windows loader expects to see either _load_config_used.SecurityCookie
set to the initial magic value, or for IMAGE_GUARD_SECURITY_COOKIE_UNUSED
to be set. Go obviously isn't making use of these features, and neither
does clang/gcc for that matter; libssp doesn't even use SecurityCookie.
Rather, it's exclusively for MSVC's /GS protection. So it seems like the
proper thing to do is signal to the OS that it doesn't need to
initialize SecurityCookie. This check lives in ntdll!LdrInitSecurityCookie.
So, add the _load_config_used structure to the right PE section and give
it the right flag. This lets the Windows 10-marked binaries actually
run.
Change-Id: I91887073c7ad01aeb0237906aafa4ea5574ac8fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/756680
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
With https://github.com/llvm/llvm-project/pull/182943, the race
detector syso has a weak import of __dyld_get_dyld_header, which
is only defined on newer macOS (26.4+). For external linking with
a pre-Xcode 26.4 C toolchain, we need to tell the C linker to
permit that symbol not being defined. Pass a flag to do so.
Change-Id: I95a3cd2c7fd3ad50bc47985b3ecca0d4e8352162
Reviewed-on: https://go-review.googlesource.com/c/go/+/755261
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
|
|
Go 1.27 will require macOS 13 Ventura or later, so macOS 12 will be
unsupported.
For #75836.
For #77944.
Change-Id: I66f858438965c9836d647198d50acf4ca345e498
Reviewed-on: https://go-review.googlesource.com/c/go/+/754620
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
|
|
Write our own load command for macOS builds,
to make sure we can put the versions in.
Builds on older macOS were seeing an LC_VERSION_MIN instead
and scribbling over fields that didn't exist.
Fixes #78070.
Change-Id: If338d0506b1156b133253e496f29818a29a22a91
Reviewed-on: https://go-review.googlesource.com/c/go/+/754241
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
|
|
These are for debugging problems with the build versions
in the load commands. We still want to set them correctly by
default for most users, provided we can determine what that means.
Fixes #58722.
Change-Id: Iccab7044ac7b0c58e7e01258a5e374c4155528fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/751260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
For #76038
Change-Id: I4c30d5854fcaacc7fd7f84b4679a5be30379122d
Reviewed-on: https://go-review.googlesource.com/c/go/+/729200
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Pagol Mon <mpagol707@gmail.com>
|
|
Loosely based on CL 678795.
The PE/COFF spec requires RUNTIME_FUNCTION entries in the .pdata
section to be ordered by their function start address. Previously
the linker emitted them in symbol order.
An unsorted table triggers the MSVC linker error:
fatal error LNK1223: invalid or corrupt file: file contains invalid
.pdata contributions
Fixes #65116.
Change-Id: I589cb4e6787a9edb34400b56e60fe23065b59162
Reviewed-on: https://go-review.googlesource.com/c/go/+/743820
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
This changes modifies Go to allow the -nostdlib++ flag to the list of
allowed flags to be passed to the c compiler invocation when testing flags
in cmd/link.
It is similar to #76858 and complements #76825.
This is needed for hermetic c only toolchains where -nostdlib++ is passed
transitively.
Given prior discussions about security considerations when adding flags to
the whitelist, this particular one may be particularly safe to whitelist.
Change-Id: If2e295f9de544b4498ad37fb07d3f7b3b11bbf6d
GitHub-Last-Rev: e59fd659d7e7e2e057bbb29e5ae12b0fa11fdb60
GitHub-Pull-Request: golang/go#77601
Reviewed-on: https://go-review.googlesource.com/c/go/+/745340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
When internally linking darwin binaries, the linker rejected Mach-O
UNSIGNED (pointer) relocations targeting dynamic import symbols,
producing errors like:
unexpected reloc for dynamic symbol _swift_FORCE_LOAD_$_swiftIOKit
These relocations are legitimate and appear in data sections (e.g.
__DATA/__const) of object files that reference external symbols such as
Swift force-load symbols. The dynamic linker (dyld) needs to bind these
pointers at load time.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64_15,gotip-darwin-amd64_14
Change-Id: I1cc759dec28b8aa076602a45062f403d0d9f45fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/745220
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
|
|
This CL follows from the abandoned CL 722961.
Alan Donovan asked if modernize would catch these changes; it does in part.
Here is how modernize was used:
1. Build the Go compiler from latest master
2. Clone x/tools and build modernize with the newest compiler
3. Then, do:
PATH=PATH_TO_BIN:$PATH go list ./... | xargs env PATH=PATH_TO_BIN:$PATH GOMOD=off MODERNIZE -forvar -fix -test -debug fpstv
4. For assurance, move into a package directory (i.e, cmd), and redo Step 3.
From the obtained result, it seems modernize did not remove the loop variable when:
- the range notation was not used
- the loop variable was not directly under the for directive.
Which does happens here:
# git ls-files | xargs -I {} perl -nE 'print "$ARGV:$.:$_" if /\s+(\w+) := \1$/' {} | grep _test
[...]
cmd/compile/internal/types2/api_test.go:2423: i := i
md/go/internal/modload/query_test.go:182: tt := tt
md/go/internal/web/url_test.go:17: tc := tc
cmd/go/internal/web/url_test.go:49: tc := tc
cmd/internal/par/queue_test.go:54: i := i
runtime/syscall_windows_test.go:781: arglen := arglen
Link: https://go-review.googlesource.com/c/go/+/722961/comments/e8d47866_fc399fa1
Co-authored-by: Plamerdi Makela <plamerdi447@gmail.com>
Fixes #76411
Change-Id: I0c191cdca70dbea6efaf6796dca9c60e2afcd9ea
GitHub-Last-Rev: 77c3e11fc21a4ede70b733b567a1690edb944dc1
GitHub-Pull-Request: golang/go#77694
Reviewed-on: https://go-review.googlesource.com/c/go/+/746502
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
|
|
The bfd linker has been fixed for a while. In the mean time gold got
deprecated and has stopped receiving new features. Add runtime version
checking and only use gold, if bfd ld 2.35 and lower is detected.
This enables using `-buildmode=shared` on arm64 without installing
binutils-gold (on distributions that split package this), as well as
to use external ldflags that ld.bfd supports, and ld.gold does
not. For example, this enables to specify gcs-report-dynamic=none when
building with GCC-15.
Fixes #22040.
Change-Id: I4eb8b3dabb78844ff662332ad63a4625278271b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/740480
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
|
|
For Go files, gofmt already converts CRLF line ending to LF. For C
and assembly files, we don't enforce a format, but most files in
tree are written with LF line ending, and the C toolchain can
handle them file, even on Windows. Convert all to LF line ending
for consistency.
Will look into adding a test for them.
Updates #9281.
Change-Id: Idc0dc13f0ab90b8cd8ea118abf9cb195ec438fe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/746220
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Enable PIE builds on linux/s390x when CGO is disabled by teaching
the linker to handle dynamic relocations against SDYNIMPORT
symbols.
This adds support for TLS_IE and handles R_CALL, R_PCRELDBL, and
R_ADDR relocations by generating the appropriate PLT/GOT entries
instead of rejecting them as unsupported.
Fixes #77449
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x
Change-Id: Ib6586780073fedbcbd42b9a2c554a99dd7386aa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/742342
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
When handling type descriptors, we add some space at the start
to ensure that offset 0 does not refer to a valid type descriptor.
AIX has an initial runtime.types symbol with a non-zero size,
so we used that instead of adding some space.
In some cases Darwin also has a runtime.types symbol with a non-zero size.
Before CL 727021, this was always fine, because the 8 byte size of
runtime.types was swamped by the 32-byte alignment of type descriptors.
That didn't work for AIX with the external linker, because on AIX the
external linker lays out each symbol separately. Darwin doesn't have
that problem, so the layout of the internal linker was preserved.
However, CL 727021 changed the alignment of type descriptors to 8.
That means that on Darwin the 8 byte size of runtime.types was no
longer hidden by the alignment. In effect we were skipping twice:
once for runtime.types, and then again explicitly. This only failed
when runtime.types has a non-zero size, which is only in a few
specific cases.
This CL cleans this up by not skipping explicitly in any case
where runtime.types has a non-zero size. That handles both AIX
and Darwin consistently.
To make this clearer, I changed the skip from a single byte to
the size of a pointer in all cases.
I considered always giving runtime.types a non-zero size,
but that is a bigger change, and potentially confusing since
there really isn't any data associated with runtime.types.
The cases where we must give it a non-zero size are special,
and I think it's simpler to keep it that way.
For #6853
For #36313
Fixes #77569
Change-Id: I22ebbd0194527ecca96d48849aa00a4fc899e55c
Reviewed-on: https://go-review.googlesource.com/c/go/+/744820
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Running these tests on other systems is a pointless waste of time.
This runs cmd/link/internal/ld/elf_test.go in the same cases that
we run cmd/link/elf_test.go.
Change-Id: I318fb5c2de9e4cfdb976bc2389c72cede6661b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/740782
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
CL 724261 changed the linker to put all type descriptors that
are used for typelinks in a single list. This caused trouble on AIX when
linking externally, because the AIX linker aligns symbols individually,
rather than honoring the layout of the object file generated by the
internal linker.
I fixed internal linking problems with CL 740220,
but that just made things worse for the external linker.
This CL rolls back 740220, and adds commentary.
With this CL we force a smaller alignment for type descriptors,
use the same alignment for runtime.types and type:*,
and use a consistent size for runtime.types in all cases.
With this change all the type descriptor related code
passes again on AIX, except for the new TestTypePlacement test
which I will fix in a followup CL.
Fixes #77400
Change-Id: I9f25847eb0588001cb4ce453f211a655400d6a59
Reviewed-on: https://go-review.googlesource.com/c/go/+/740820
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
If we start the covctrs blob at an odd alignment, then covctrs will
not be correctly aligned. Each individual entry is aligned properly,
but the start marker may be before any padding inserted to enforce
that alignment.
Fixes #58936
Change-Id: I802fbe40eacfa5a3c8c4864e078b0e078da956d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/733740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
|
|
This changes does 2 things:
- Move `-L` to `prefixesToKeep` since it allows providing a custom
default libs search path.
- Allow various flags that impact the behaviour of the clang driver.
The latter allows for LLVM only toolchains to be compatible with
linkerFlagSupported checks.
The end goal of this PR is to allow fully hermetic toolchains,
especially pure LLVM ones, to be used to cross-compile CGO.
Fixes #76825
Change-Id: I2311c9566ce9c7e8f6b325258af58eb333663cf0
GitHub-Last-Rev: 74342aae35124cf174a3f8b888999ffd4cea191f
GitHub-Pull-Request: golang/go#76858
Reviewed-on: https://go-review.googlesource.com/c/go/+/730561
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Go is only capable of producing internally linked, static binaries
on linux-ppc64. As such, binaries should run in either ELFv1 or
ELFv2 ppc64 userspaces today.
This opens the door to enabling cgo and external linking which
will require ELFv2 support and userspace, eventually.
Fixes #76244
Change-Id: I5ca15037cbe546f352e8693dcf14da51a308b8ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/734540
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
That used to happen naturally because the symbol had zero size.
After CL 724261 we need to force it.
Fixes #77372
Change-Id: Ia8eef989bc9cbad5459b60ff6535136e7e0c6cab
Reviewed-on: https://go-review.googlesource.com/c/go/+/740400
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
It doesn't seem to be necessary, and removing it seems cleaner
than adding an AIX case to the code in runtime.moduleTypelinks.
Fixes #77365
Change-Id: I59fa56abf42e18017bd112481ea09d0cca47d105
Reviewed-on: https://go-review.googlesource.com/c/go/+/740220
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
This XCOFF symkind comparison broke when STYPE moved in CL 723580.
These comparisons are unmaintainable, but at least the new code
is no worse than the old code.
Change-Id: I1be9de6afdf1814aaadcd2105e6247a4b66b46fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/740200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Storing the type descriptor length lets us save a relocation.
It also avoids a problem for Darwin dynamic linking.
For #6853
Fixes #77350
Change-Id: If5c94330fe10d75690325f3d0b0658060ef3eb2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/739681
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Instead of adding a typelinks section to a Go binary,
mark the start and end of the typelinked type descriptors.
The runtime can then step through the descriptors to find them all,
rather than relying on the extra linker-generated offset list.
The runtime steps through the type descriptors lazily,
as many Go programs don't need the typelinks list at all.
This reduces the size of cmd/go by 15K bytes, which isn't much
but it's not nothing.
A future CL will change the reflect package to use the type pointers
directly rather than converting to offsets and then back to type pointers.
For #6853
Change-Id: Id0af4ce81c5b1cea899fc92b6ff9d2db8ce4c267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724261
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Change-Id: Ica7201dabe7f72b9470d8acbad043a34a20345a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/724121
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
This is a followup to CL 723580. This fixes cgo builds on AIX.
For #76038
Change-Id: Idea959615891f3f6e33932fae7a9043778db3366
Reviewed-on: https://go-review.googlesource.com/c/go/+/738920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Instead of generating an equality function for each type that
needs it, generate one per "signature". A "signature" is a
summary of the comparisons needed to check a type for equality.
For instance, the type
type S struct {
i int32
j uint32
s string
e error
}
Will have the signature "M8SI".
M8 = 8 bytes of regular memory
S = string
I = nonempty interface
This way, potentially many types that have the same signature
can share the same equality function.
The number of generated equality functions in the go binary
is reduced from 634 to 286. The go binary is ~1% smaller.
The generation of equality functions gets simpler (particularly, how
we do inlining of sub-types, unrolling, etc.) and the generated code
is probably a bit more efficient.
The new function names are kind of weird, but will seldom show up
for users. They will appear in cpu profiles, and in tracebacks in the
situation where comparisons panic because an interface somewhere in
the type being compared contains an uncomparable type (e.g. a slice).
Note that this CL only affects generated comparison functions. It does
not generally affect generated code for == (except when that code decides
to call a comparison function as a subtask). Maybe a TODO for the future.
Update #6853
Change-Id: I202bd6424cb6bf7c745a62c9603d4f01dc1a1fc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/725380
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
|
|
This change rewrites and simplifies the relro handling.
We eliminate the separate relro SymKind values and the complex
shifting of symbol kinds. Instead, we put the possible relro data
into their own sections, and make those sections relro when appropriate.
We put type descriptors and their associated data into a
new .go.type section. As part of this we change the runtime.etypes
symbol to be the end of the new section, rather than the end of
rodata as it was before.
We put function descriptors into a new .go.func section.
Ordinary rodata relro stays in the .data.rel.ro section.
We stop making the typelink section relro, as it only contains
offsets and never has dynamic relocations.
We drop the typerel:* and go:funcdescrel symbols.
For #76038
Change-Id: I7aab7cfad3f2623ff06c09a70b756fe1e43f4169
Reviewed-on: https://go-review.googlesource.com/c/go/+/723580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
If a program imports the plugin package, but the plugin build mode
is not supported on the platform, it still cannot use plugin. Don't
treat it like so.
Updates #76815.
Change-Id: I0fd719427d7c3cc96a94ce1f92d6e4457da92a90
Reviewed-on: https://go-review.googlesource.com/c/go/+/730164
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
A stackObjectRecord should always be in funcdata, between gofunc
and the end of pclntab, except for the special case of
methodValueCallFrameObjs, which should always be in noptrbss.
Adjust the two loops that look for the moduledata corresponding
to a stackObjectRecord to search more precisely, rather than
relying on datap.end.
Closely based on a patch by Michael Stapelberg.
For #76038
Change-Id: I751801d8fd030af751825a67905b2a343280e7d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/728840
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Change-Id: Id2c4152b43c7ee1a687e49da7dda5a690e554231
Reviewed-on: https://go-review.googlesource.com/c/go/+/727900
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
|
|
This updates XCOFF-specific code for the recent addition
of funcdata to pclntab.
Because XCOFF puts separate symbols into separate csects,
each with their own alignment, it's important to tell the
external linker the expected alignment of each part of pclntab.
Otherwise the offsets within pclntab may change as the external
linker aligns symbols. This CL sets the correct alignment for
each pclntab child symbol, and sets pclntab's alignment to the
max of that of its children.
Tested on the GCC compile farm.
Fixes #76486
Change-Id: I77d8a90c4b4b79d80ca11ede8d9a2aa9cc89f53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/725603
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
Fixes #76731
Change-Id: I5c686c91af8543b57880a89d30393912ef1958ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/727760
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Fixes #76656
Change-Id: If2e823ba1577700af00f5883e4ea5c139e4749c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/726100
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
There is a test for this in CL 721480 later in this series.
For #76038
Change-Id: Ib7ed1f0b0aed2d929ca0f135b54d6b62112cae30
Reviewed-on: https://go-review.googlesource.com/c/go/+/720660
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
Change-Id: I2d3c41b0e61b994d7b04bd16a791fd226dc45269
Reviewed-on: https://go-review.googlesource.com/c/go/+/720302
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
There is a test for this in CL 721461 later in this series.
For #76038
Change-Id: I15f9a8d0d5bd9424702a9ca7febb2fa76035aaf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719743
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
There is a test for this in CL 721460 later in this series.
For #76038
Change-Id: Icd7a52cbabde5162139dbc4b2c61306c0c748545
Reviewed-on: https://go-review.googlesource.com/c/go/+/719440
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Since before Go 1 the Go linker has handled ELF by first building the
ELF section string table, and then pointing ELF section headers to it.
This duplicates code as sections are effectively created twice,
once with the name and then again with the full section header.
The code duplication also means that it's easy to create unnecessary
section names; for example, every internally linked Go program
currently contains the string ".go.fuzzcntrs" although most do not
have a section by that name.
This CL changes the linker to simply build the section string table
after all the sections are known.
Change-Id: I27ba15b2af3dc1b8d7436b6c409f818aa8e6bfb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718840
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Change-Id: I293e50e3a6ab19fb927099e106095d6aa1241b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718820
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
For an executable, emit the allocated section headers in address order,
so that section headers are easier for humans to read.
Change-Id: Ib5efb4734101e4a1f6b09d0e045ed643c79c7c0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/718620
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
After DWARF compression, we recompute the symbol and section
addresses. On Windows, we need to align the sections to
PEFILEALIGN. But the code actually apply the alignment to every
symbol. This works mostly fine as after compression a section
usually contains a single symbol (the compressed data). But if the
compression is not beneficial, it leaves with the original set of
symbols, which could be more than one. Applying alignment to every
symbol causing the section size too big, no longer matching the
size we computed before compression.
Fixes #76022.
Change-Id: I2246045955405997c77e54001bbb83f9ccd1ee7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/721340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
|