Home | History | Annotate | Download | only in 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.
      4 
      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.
      9 
     10 Command Line
     11 
     12 Usage:
     13 
     14 	go tool link [flags] main.a
     15 
     16 Flags:
     17 
     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 the linker version and exit.
     40 	-X importpath.name=value
     41 		Set the value of the string variable in importpath named name to value.
     42 		Note that before Go 1.5 this option took two separate arguments.
     43 		Now it takes one argument split on the first = sign.
     44 	-buildmode mode
     45 		Set build mode (default exe).
     46 	-cpuprofile file
     47 		Write CPU profile to file.
     48 	-d
     49 		Disable generation of dynamic executables.
     50 		The emitted code is the same in either case; the option
     51 		controls only whether a dynamic header is included.
     52 		The dynamic header is on by default, even without any
     53 		references to dynamic libraries, because many common
     54 		system tools now assume the presence of the header.
     55 	-extar ar
     56 		Set the external archive program (default "ar").
     57 		Used only for -buildmode=c-archive.
     58 	-extld linker
     59 		Set the external linker (default "clang" or "gcc").
     60 	-extldflags flags
     61 		Set space-separated flags to pass to the external linker.
     62 	-f
     63 		Ignore version mismatch in the linked archives.
     64 	-g
     65 		Disable Go package data checks.
     66 	-installsuffix suffix
     67 		Look for packages in $GOROOT/pkg/$GOOS_$GOARCH_suffix
     68 		instead of $GOROOT/pkg/$GOOS_$GOARCH.
     69 	-libgcc file
     70 		Set name of compiler support library.
     71 		This is only used in internal link mode.
     72 		If not set, default value comes from running the compiler,
     73 		which may be set by the -extld option.
     74 		Set to "none" to use no support library.
     75 	-linkmode mode
     76 		Set link mode (internal, external, auto).
     77 		This sets the linking mode as described in cmd/cgo/doc.go.
     78 	-linkshared
     79 		Link against installed Go shared libraries (experimental).
     80 	-memprofile file
     81 		Write memory profile to file.
     82 	-memprofilerate rate
     83 		Set runtime.MemProfileRate to rate.
     84 	-msan
     85 		Link with C/C++ memory sanitizer support.
     86 	-o file
     87 		Write output to file (default a.out, or a.out.exe on Windows).
     88 	-pluginpath path
     89 		The path name used to prefix exported plugin symbols.
     90 	-r dir1:dir2:...
     91 		Set the ELF dynamic linker search path.
     92 	-race
     93 		Link with race detection libraries.
     94 	-s
     95 		Omit the symbol table and debug information.
     96 	-shared
     97 		Generated shared object (implies -linkmode external; experimental).
     98 	-tmpdir dir
     99 		Write temporary files to dir.
    100 		Temporary files are only used in external linking mode.
    101 	-v
    102 		Print trace of linker operations.
    103 	-w
    104 		Omit the DWARF symbol table.
    105 */
    106 package main
    107