aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/doc.go
AgeCommit message (Collapse)Author
2024-01-11cmd/compile: document go:wasmimport directiveMauri de Souza Meneguzzo
Fixes #64972 Change-Id: I784a8728afbdef9736681d56f0a79c82a00609d6 GitHub-Last-Rev: bf158dbeaaa495dc258c590c7a21cf9e25e76ee7 GitHub-Pull-Request: golang/go#64991 Reviewed-on: https://go-review.googlesource.com/c/go/+/554455 Reviewed-by: Achille Roussel <achille.roussel@gmail.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-02-02src/cmd/compile: clarify //go:linkname documentationAlan Donovan
Change-Id: I0407950bfc84082683012944b2051e46dc682ba0 Reviewed-on: https://go-review.googlesource.com/c/go/+/463136 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-07-18cmd/compile: revert "remove -installsuffix flag"Matthew Dempsky
This reverts CL 415236 (commit 558785a0a9df5fbb7e9617c05059cf2892884620). Reason for revert: Google's internal build system uses -installsuffix. Restoring -installsuffix for Go 1.19, and will try again for Go 1.20. Change-Id: Id6571f34f99f01bcf55e8e949e6fe7b6c1896134 Reviewed-on: https://go-review.googlesource.com/c/go/+/418036 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-07-13cmd/compile: remove -installsuffix flagMatthew Dempsky
Obsoleted by -importcfg. cmd/link has a similar flag, but it seems to still be needed at least for misc/cgo/testshared.TestGopathShlib. I can't immediately tell why (has something to do with finding .so files), but it doesn't appear to possibly affect cmd/compile. Updates #51225. Change-Id: I80c6aef860bd162c010ad4a1a4f532b400cf901c Reviewed-on: https://go-review.googlesource.com/c/go/+/415236 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-13cmd/compile: remove -importmap flagMatthew Dempsky
Obsoleted by -importcfg, and no longer used by anything. Updates #51225. Change-Id: I49e646d2728347f862f90805051bb03dd4f4bed2 Reviewed-on: https://go-review.googlesource.com/c/go/+/415235 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-04-21cmd/compile: add //go:uintptrkeepaliveMichael Pratt
This CL exports the existing ir.UintptrKeepAlive via the new directive //go:uintptrkeepalive. This makes the compiler insert KeepAlives for pointers converted to uintptr in calls, keeping them alive for the duration of the call. //go:uintptrkeepalive requires //go:nosplit, as stack growth can't handle these arguments (it cannot know which are pointers). We currently check this on the immediate function, but the actual restriction applies to all transitive calls. The existing //go:uintptrescapes is an extension of //go:uintptrkeepalive which forces pointers to escape to the heap, thus eliminating the stack growth issue. This pragma is limited to the standard library. For #51087 Change-Id: If9a19d484d3561b4219e5539b70c11a3cc09391e Reviewed-on: https://go-review.googlesource.com/c/go/+/388095 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-10-25cmd/compile: add -asan optionfanzha02
The -asan option causes the compiler to add instrumentation for the C/C++ address sanitizer. Every memory read/write will be replaced by a call to asanread/asanwrite. This CL also inserts asan instrumentation during SSA building. This CL passes tests but is not usable by itself. The actual implementation of asanread/asanwrite in the runtime package, and support for -asan in the go tool and tests, will follow in subsequent CLs. Updates #44853. Change-Id: Ia18c9c5d5c351857420d2f6835f0daec2ad31096 Reviewed-on: https://go-review.googlesource.com/c/go/+/298611 Trust: fannie zhang <Fannie.Zhang@arm.com> Run-TryBot: fannie zhang <Fannie.Zhang@arm.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-13cmd/compile: mention that -m can be increased or given multiple timesMichael Schaller
-m can be increased or it can be given up to 4 times to increase the verbosity of the printed optimization decisions: https://github.com/golang/go/search?q=LowerM Change-Id: I0cc304385be052664fad455ff075846a3a63f298 GitHub-Last-Rev: 140f08529024dd17c5ca1cbad52dd1d17c6126c0 GitHub-Pull-Request: golang/go#44857 Reviewed-on: https://go-review.googlesource.com/c/go/+/299709 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2020-06-05cmd/asm, cmd/compile, doc: document -spectre flagsRuss Cox
Most of the docs are in the new wiki page https://golang.org/wiki/Spectre. Updates #37419. Change-Id: I6e8f76670593c089de895e1665b41d874f879df9 Reviewed-on: https://go-review.googlesource.com/c/go/+/236599 Reviewed-by: Austin Clements <austin@google.com>
2020-04-21cmd/compile: detect and diagnose invalid //go: directive placementRuss Cox
Thie CL changes cmd/compile/internal/syntax to give the gc half of the compiler more control over pragma handling, so that it can prepare better errors, diagnose misuse, and so on. Before, the API between the two was hard-coded as a uint16. Now it is an interface{}. This should set us up better for future directives. In addition to the split, this CL emits a "misplaced compiler directive" error for any directive that is in a place where it has no effect. I've certainly been confused in the past by adding comments that were doing nothing and not realizing it. This should help avoid that kind of confusion. The rule, now applied consistently, is that a //go: directive must appear on a line by itself immediately before the declaration specifier it means to apply to. See cmd/compile/doc.go for precise text and test/directive.go for examples. This may cause some code to stop compiling, but that code was broken. For example, this code formerly applied the //go:noinline to f (not c) but now will fail to compile: //go:noinline const c = 1 func f() {} Change-Id: Ieba9b8d90a27cfab25de79d2790a895cefe5296f Reviewed-on: https://go-review.googlesource.com/c/go/+/228578 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2020-03-09cmd/compile: remove -largemodel flag from docsKeith Randall
It does nothing (it can't even be parsed). Change-Id: I29abdddea1955d2ad93a97696f6542fa47cdb954 Reviewed-on: https://go-review.googlesource.com/c/go/+/222672 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-06cmd/compile: make the second argument to go:linkname optionalAustin Clements
The //go:linkname directive can be used to make a symbol accessible to another package (when it wouldn't normally be). Sometimes you want to do this without actually changing the symbol's object file symbol name; for example, in gccgo this makes unexported symbols non-static, and in gc this provides ABI0 wrappers for Go symbols so they can be called from assembly in other packages. Currently, this results in stutter like //go:linkname entersyscall runtime.entersyscall This CL makes the second argument to go:linkname optional for the case where the intent is simply to expose the symbol rather than to rename it in the object file. Updates #31230. Change-Id: Id06d9c4b2ec3d8e27f9b8a0d65212ab8048d734f Reviewed-on: https://go-review.googlesource.com/c/go/+/179861 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2019-01-25cmd/compile, cmd/link: document more flagsyo-tak
Fixes #26533 Change-Id: I5a48d667d474f3f222f9055e51131561a0cf45b6 Reviewed-on: https://go-review.googlesource.com/c/138757 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30cmd/compile: add -lang flag to specify language versionIan Lance Taylor
The default language version is the current one. For testing purposes, added a check that type aliases require version go1.9. There is no consistent support for changes made before 1.12. Updates #28221 Change-Id: Ia1ef63fff911d5fd29ef79d5fa4e20cfd945feb7 Reviewed-on: https://go-review.googlesource.com/c/144340 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-17cmd/compile: remove obsolete "safe" modeMatthew Dempsky
Nowadays there are better ways to safely run untrusted Go programs, like NaCl and gVisor. Change-Id: I20c45f13a50dbcf35c343438b720eb93e7b4e13a Reviewed-on: https://go-review.googlesource.com/c/142717 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2018-10-09cmd/compile: fix Compiler Directives typoQais Patankar
Change-Id: I098b3c627c2142affd4e800a2c1f37e00f3775c5 Reviewed-on: https://go-review.googlesource.com/c/140777 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-06all: fix a bunch of misspellingsIgor Zhilianin
Change-Id: If2954bdfc551515403706b2cd0dde94e45936e08 GitHub-Last-Rev: d4cfc41a5504cf10befefdb881d4c45986a1d1f8 GitHub-Pull-Request: golang/go#28049 Reviewed-on: https://go-review.googlesource.com/c/140299 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-14cmd/compile: document new line directivesRobert Griesemer
Fixes #24183. Change-Id: I5ef31c4a3aad7e05568b7de1227745d686d4aff8 Reviewed-on: https://go-review.googlesource.com/100462 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-04-05cmd/compile: add mutex profiling supportJosh Bleecher Snyder
Updates #15756 Updates #19822 Change-Id: I98b17dcbbfd80e7e164b0523185382175fe2d89b Reviewed-on: https://go-review.googlesource.com/39554 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-03cmd/compile: add block profiling supportJosh Bleecher Snyder
Updates #15756 Change-Id: Ic635812b324af926333122c02908cebfb24d7bce Reviewed-on: https://go-review.googlesource.com/39208 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-09cmd/compile: document -l in godocShenghou Ma
Fixes #15607. Change-Id: I3e68ad00ebe72027d064238d4e77f1ad6a52f533 Reviewed-on: https://go-review.googlesource.com/22940 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-09cmd/compile: add -linkobj flag to allow writing object file in two partsRuss Cox
This flag is experimental and the semantics may change even after Go 1.7 is released. There are no changes to code not using the flag. The first part is for reading by future compiles. The second part is for reading by the final link step. Splitting the file this way allows distributed build systems to ship the compile-input part only to compile steps and the linker-input part only to linker steps. The first part is basically just the export data, and the second part is basically everything else. The overall files still have the same broad structure, so that existing tools will work with both halves. It's just that various pieces are empty in the two halves. This also copies the two bits of data the linker needed from export data into the object header proper, so that the linker doesn't need any export data at all. That eliminates a TODO that was left for switching to the binary export data. (Now the linker doesn't need to know about the switch.) The default is still to write out a combined output file. Nothing changes unless you pass -linkobj to the compiler. There is no support in the go command for -linkobj, since the go command doesn't copy objects around. The expectation is that other build systems (like bazel, say) might take advantage of this. The header adjustment and the option for the split output was intended as part of the zip archives, but the zip archives have been cut from Go 1.7. Doing this to the current archives both unblocks one step in the switch to binary export data and enables alternate build systems to experiment with the new flag using the Go 1.7 release. Change-Id: I8b6eab25b8a22b0a266ba0ac6d31e594f3d117f3 Reviewed-on: https://go-review.googlesource.com/22500 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2015-11-16cmd/compile: document -trimpathRuss Cox
Fixes #8999. Change-Id: I1390605bdf908f59b596975ea51eb04bd03bbae0 Reviewed-on: https://go-review.googlesource.com/16918 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-21cmd/compile: add -msan optionIan Lance Taylor
The -msan option causes the compiler to add instrumentation for the C/C++ memory sanitizer. Every memory read/write will be preceded by a call to msanread/msanwrite. This CL passes tests but is not usable by itself. The actual implementation of msanread/msanwrite in the runtime package, and support for -msan in the go tool and the linker, and tests, will follow in subsequent CLs. Change-Id: I3d517fb3e6e65d9bf9433db070a420fd11f57816 Reviewed-on: https://go-review.googlesource.com/16160 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-21cmd/compile: remove a stray word in the go:nosplit documentationAaron Jacobs
Change-Id: I7a85c0ad8aba2d50032c8faa58c83fb327f360cf Reviewed-on: https://go-review.googlesource.com/16140 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-24cmd/compile: add missing quotation markMatthew Dempsky
Change-Id: I102901e3df76830ccd5ab74d757203d103eef9e8 Reviewed-on: https://go-review.googlesource.com/12657 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-19cmd/compile: add -importmap optionRuss Cox
The -importmap option takes an argument of the form old=new and specifies that import "old" should be interpreted as if it said import "new". The option may be repeated to specify multiple mappings. This option is here to support the go command's new -vendor flag. Change-Id: I31b4ed4249b549982a720bf61bb230462b33c59b Reviewed-on: https://go-review.googlesource.com/10922 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05cmd/compile, cmd/link: add docsRuss Cox
These are the Go 1.4 docs but refreshed for Go 1.5. The most sigificant change is that all references to the Plan 9 toolchain are gone. The tools no longer bear any meaningful resemblance. Change-Id: I44f5cadb832a982323d7fee0b77673e55d761b35 Reviewed-on: https://go-review.googlesource.com/10298 Reviewed-by: Rob Pike <r@golang.org>