Commit 8b7cf898 authored by yo-tak's avatar yo-tak Committed by Ian Lance Taylor

cmd/compile, cmd/link: document more flags

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: 's avatarIan Lance Taylor <iant@golang.org>
parent 9d23975d
...@@ -44,8 +44,12 @@ Flags: ...@@ -44,8 +44,12 @@ Flags:
Print compiler version and exit. Print compiler version and exit.
-asmhdr file -asmhdr file
Write assembly header to file. Write assembly header to file.
-buildid id
Record id as the build id in the export metadata.
-blockprofile file -blockprofile file
Write block profile for the compilation to file. Write block profile for the compilation to file.
-c int
Concurrency during compilation. Set 1 for no concurrency (default is 1).
-complete -complete
Assume package has no non-Go components. Assume package has no non-Go components.
-cpuprofile file -cpuprofile file
...@@ -54,8 +58,14 @@ Flags: ...@@ -54,8 +58,14 @@ Flags:
Allow references to Go symbols in shared libraries (experimental). Allow references to Go symbols in shared libraries (experimental).
-e -e
Remove the limit on the number of errors reported (default limit is 10). Remove the limit on the number of errors reported (default limit is 10).
-goversion string
Specify required go tool version of the runtime.
Exits when the runtime go version does not match goversion.
-h -h
Halt with a stack trace at the first error detected. Halt with a stack trace at the first error detected.
-importcfg file
Read import configuration from file.
In the file, set importmap, packagefile to specify import resolution.
-importmap old=new -importmap old=new
Interpret import "old" as import "new" during compilation. Interpret import "old" as import "new" during compilation.
The option may be repeated to add multiple mappings. The option may be repeated to add multiple mappings.
...@@ -74,6 +84,8 @@ Flags: ...@@ -74,6 +84,8 @@ Flags:
object to usual output file (as specified by -o). object to usual output file (as specified by -o).
Without this flag, the -o output is a combination of both Without this flag, the -o output is a combination of both
linker and compiler input. linker and compiler input.
-m
Print optimization decisions.
-memprofile file -memprofile file
Write memory profile for the compilation to file. Write memory profile for the compilation to file.
-memprofilerate rate -memprofilerate rate
...@@ -93,11 +105,50 @@ Flags: ...@@ -93,11 +105,50 @@ Flags:
Write a package (archive) file rather than an object file Write a package (archive) file rather than an object file
-race -race
Compile with race detector enabled. Compile with race detector enabled.
-s
Warn about composite literals that can be simplified.
-shared
Generate code that can be linked into a shared library.
-traceprofile file
Write an execution trace to file.
-trimpath prefix -trimpath prefix
Remove prefix from recorded source file paths. Remove prefix from recorded source file paths.
There are also a number of debugging flags; run the command with no arguments Flags related to debugging information:
for a usage message.
-dwarf
Generate DWARF symbols.
-dwarflocationlists
Add location lists to DWARF in optimized mode.
-gendwarfinl int
Generate DWARF inline info records (default 2).
Flags to debug the compiler itself:
-E
Debug symbol export.
-K
Debug missing line numbers.
-d list
Print debug information about items in list. Try -d help for further information.
-live
Debug liveness analysis.
-v
Increase debug verbosity.
-%
Debug non-static initializers.
-W
Debug parse tree after type checking.
-f
Debug stack frames.
-i
Debug line number stack.
-j
Debug runtime-initialized variables.
-r
Debug generated wrappers.
-w
Debug type checking.
Compiler Directives Compiler Directives
......
...@@ -43,8 +43,16 @@ Flags: ...@@ -43,8 +43,16 @@ Flags:
or initialized to a constant string expression. -X will not work if the initializer makes or initialized to a constant string expression. -X will not work if the initializer makes
a function call or refers to other variables. a function call or refers to other variables.
Note that before Go 1.5 this option took two separate arguments. Note that before Go 1.5 this option took two separate arguments.
-a
Disassemble output.
-buildid id
Record id as Go toolchain build id.
-buildmode mode -buildmode mode
Set build mode (default exe). Set build mode (default exe).
-c
Dump call graphs.
-compressdwarf
Compress DWARF if possible (default true).
-cpuprofile file -cpuprofile file
Write CPU profile to file. Write CPU profile to file.
-d -d
...@@ -54,6 +62,10 @@ Flags: ...@@ -54,6 +62,10 @@ Flags:
The dynamic header is on by default, even without any The dynamic header is on by default, even without any
references to dynamic libraries, because many common references to dynamic libraries, because many common
system tools now assume the presence of the header. system tools now assume the presence of the header.
-debugtramp int
Debug trampolines.
-dumpdep
Dump symbol dependency graph.
-extar ar -extar ar
Set the external archive program (default "ar"). Set the external archive program (default "ar").
Used only for -buildmode=c-archive. Used only for -buildmode=c-archive.
...@@ -65,9 +77,14 @@ Flags: ...@@ -65,9 +77,14 @@ Flags:
Ignore version mismatch in the linked archives. Ignore version mismatch in the linked archives.
-g -g
Disable Go package data checks. Disable Go package data checks.
-importcfg file
Read import configuration from file.
In the file, set packagefile, packageshlib to specify import resolution.
-installsuffix suffix -installsuffix suffix
Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix
instead of $GOROOT/pkg/$GOOS_$GOARCH. instead of $GOROOT/pkg/$GOOS_$GOARCH.
-k symbol
Set field tracking symbol. Use this flag when GOEXPERIMENT=fieldtrack is set.
-libgcc file -libgcc file
Set name of compiler support library. Set name of compiler support library.
This is only used in internal link mode. This is only used in internal link mode.
...@@ -85,6 +102,8 @@ Flags: ...@@ -85,6 +102,8 @@ Flags:
Set runtime.MemProfileRate to rate. Set runtime.MemProfileRate to rate.
-msan -msan
Link with C/C++ memory sanitizer support. Link with C/C++ memory sanitizer support.
-n
Dump symbol table.
-o file -o file
Write output to file (default a.out, or a.out.exe on Windows). Write output to file (default a.out, or a.out.exe on Windows).
-pluginpath path -pluginpath path
...@@ -100,6 +119,8 @@ Flags: ...@@ -100,6 +119,8 @@ Flags:
-tmpdir dir -tmpdir dir
Write temporary files to dir. Write temporary files to dir.
Temporary files are only used in external linking mode. Temporary files are only used in external linking mode.
-u
Reject unsafe packages.
-v -v
Print trace of linker operations. Print trace of linker operations.
-w -w
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment