Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/link/doc.go

Documentation: cmd/link

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     5  /*
     6  Link, typically invoked as ``go tool link'', reads the Go archive or object
     7  for a package main, along with its dependencies, and combines them
     8  into an executable binary.
    10  Command Line
    12  Usage:
    14  	go tool link [flags] main.a
    16  Flags:
    18  	-B note
    19  		Add an ELF_NT_GNU_BUILD_ID note when using ELF.
    20  		The value should start with 0x and be an even number of hex digits.
    21  	-D address
    22  		Set data segment address.
    23  	-E entry
    24  		Set entry symbol name.
    25  	-H type
    26  		Set executable format type.
    27  		The default format is inferred from GOOS and GOARCH.
    28  		On Windows, -H windowsgui writes a "GUI binary" instead of a "console binary."
    29  	-I interpreter
    30  		Set the ELF dynamic linker to use.
    31  	-L dir1 -L dir2
    32  		Search for imported packages in dir1, dir2, etc,
    33  		after consulting $GOROOT/pkg/$GOOS_$GOARCH.
    34  	-R quantum
    35  		Set address rounding quantum.
    36  	-T address
    37  		Set text segment address.
    38  	-V
    39  		Print linker version and exit.
    40  	-X
    41  		Set the value of the string variable in importpath named name to value.
    42  		This is only effective if the variable is declared in the source code either uninitialized
    43  		or initialized to a constant string expression. -X will not work if the initializer makes
    44  		a function call or refers to other variables.
    45  		Note that before Go 1.5 this option took two separate arguments.
    46  	-a
    47  		Disassemble output.
    48  	-buildid id
    49  		Record id as Go toolchain build id.
    50  	-buildmode mode
    51  		Set build mode (default exe).
    52  	-c
    53  		Dump call graphs.
    54  	-compressdwarf
    55  		Compress DWARF if possible (default true).
    56  	-cpuprofile file
    57  		Write CPU profile to file.
    58  	-d
    59  		Disable generation of dynamic executables.
    60  		The emitted code is the same in either case; the option
    61  		controls only whether a dynamic header is included.
    62  		The dynamic header is on by default, even without any
    63  		references to dynamic libraries, because many common
    64  		system tools now assume the presence of the header.
    65  	-debugtramp int
    66  		Debug trampolines.
    67  	-dumpdep
    68  		Dump symbol dependency graph.
    69  	-extar ar
    70  		Set the external archive program (default "ar").
    71  		Used only for -buildmode=c-archive.
    72  	-extld linker
    73  		Set the external linker (default "clang" or "gcc").
    74  	-extldflags flags
    75  		Set space-separated flags to pass to the external linker.
    76  	-f
    77  		Ignore version mismatch in the linked archives.
    78  	-g
    79  		Disable Go package data checks.
    80  	-importcfg file
    81  		Read import configuration from file.
    82  		In the file, set packagefile, packageshlib to specify import resolution.
    83  	-installsuffix suffix
    84  		Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix
    85  		instead of $GOROOT/pkg/$GOOS_$GOARCH.
    86  	-k symbol
    87  		Set field tracking symbol. Use this flag when GOEXPERIMENT=fieldtrack is set.
    88  	-libgcc file
    89  		Set name of compiler support library.
    90  		This is only used in internal link mode.
    91  		If not set, default value comes from running the compiler,
    92  		which may be set by the -extld option.
    93  		Set to "none" to use no support library.
    94  	-linkmode mode
    95  		Set link mode (internal, external, auto).
    96  		This sets the linking mode as described in cmd/cgo/doc.go.
    97  	-linkshared
    98  		Link against installed Go shared libraries (experimental).
    99  	-memprofile file
   100  		Write memory profile to file.
   101  	-memprofilerate rate
   102  		Set runtime.MemProfileRate to rate.
   103  	-msan
   104  		Link with C/C++ memory sanitizer support.
   105  	-n
   106  		Dump symbol table.
   107  	-o file
   108  		Write output to file (default a.out, or a.out.exe on Windows).
   109  	-pluginpath path
   110  		The path name used to prefix exported plugin symbols.
   111  	-r dir1:dir2:...
   112  		Set the ELF dynamic linker search path.
   113  	-race
   114  		Link with race detection libraries.
   115  	-s
   116  		Omit the symbol table and debug information.
   117  	-shared
   118  		Generated shared object (implies -linkmode external; experimental).
   119  	-tmpdir dir
   120  		Write temporary files to dir.
   121  		Temporary files are only used in external linking mode.
   122  	-u
   123  		Reject unsafe packages.
   124  	-v
   125  		Print trace of linker operations.
   126  	-w
   127  		Omit the DWARF symbol table.
   128  */
   129  package main

View as plain text