github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/ld/doc.go (about)

     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  // +build ignore
     6  
     7  /*
     8  
     9  Ld is the portable code for a modified version of the Plan 9 linker.  The original is documented at
    10  
    11  	http://plan9.bell-labs.com/magic/man2html/1/8l
    12  
    13  It reads object files (.5, .6, .8, .9 files) and writes a binary named for the
    14  architecture (5.out, 6.out, 8.out, 9.out) by default (if $GOOS is windows, a .exe suffix
    15  will be appended).
    16  
    17  Major changes include:
    18  	- support for ELF, Mach-O and PE binary files
    19  	- support for segmented stacks (this feature is implemented here, not in the compilers).
    20  
    21  Original options are listed on the manual page linked above.
    22  
    23  Usage:
    24  	go tool 6l [flags] mainObj
    25  Substitute 6l with 5l, 8l or 9l as appropriate.
    26  
    27  Options new in this version:
    28  
    29  	-d
    30  		Elide the dynamic linking header.  With this option, the binary
    31  		is statically linked and does not refer to a dynamic linker.  Without this option
    32  		(the default), the binary's contents are identical but it is loaded with a dynamic
    33  		linker. This flag cannot be used when $GOOS is windows.
    34  	-H darwin     (only in 6l/8l)
    35  		Write Apple Mach-O binaries (default when $GOOS is darwin)
    36  	-H dragonfly  (only in 6l/8l)
    37  		Write DragonFly ELF binaries (default when $GOOS is dragonfly)
    38  	-H linux
    39  		Write Linux ELF binaries (default when $GOOS is linux)
    40  	-H freebsd
    41  		Write FreeBSD ELF binaries (default when $GOOS is freebsd)
    42  	-H netbsd
    43  		Write NetBSD ELF binaries (default when $GOOS is netbsd)
    44  	-H openbsd    (only in 6l/8l)
    45  		Write OpenBSD ELF binaries (default when $GOOS is openbsd)
    46  	-H solaris    (only in 6l)
    47  		Write Solaris ELF binaries (default when $GOOS is solaris)
    48  	-H windows    (only in 6l/8l)
    49  		Write Windows PE32+ Console binaries (default when $GOOS is windows)
    50  	-H windowsgui (only in 6l/8l)
    51  		Write Windows PE32+ GUI binaries
    52  	-I interpreter
    53  		Set the ELF dynamic linker to use.
    54  	-L dir1 -L dir2
    55  		Search for libraries (package files) in dir1, dir2, etc.
    56  		The default is the single location $GOROOT/pkg/$GOOS_$GOARCH.
    57  	-r dir1:dir2:...
    58  		Set the dynamic linker search path when using ELF.
    59  	-s
    60  		Omit the symbol table and debug information.
    61  	-V
    62  		Print the linker version.
    63  	-w
    64  		Omit the DWARF symbol table.
    65  	-X symbol value
    66  		Set the value of a string variable. The symbol name
    67  		should be of the form importpath.name, as displayed
    68  		in the symbol table printed by "go tool nm".
    69  	-race
    70  		Link with race detection libraries.
    71  	-B value
    72  		Add a NT_GNU_BUILD_ID note when using ELF.  The value
    73  		should start with 0x and be an even number of hex digits.
    74  	-Z
    75  		Zero stack on function entry. This is expensive but it might
    76  		be useful in cases where you are suffering from false positives
    77  		during garbage collection and are willing to trade the CPU time
    78  		for getting rid of the false positives.
    79  		NOTE: it only eliminates false positives caused by other function
    80  		calls, not false positives caused by dead temporaries stored in
    81  		the current function call.
    82  	-linkmode argument
    83  		Set the linkmode.  The argument must be one of
    84  		internal, external, or auto.  The default is auto.
    85  		This sets the linking mode as described in
    86  		../cgo/doc.go.
    87  	-tmpdir dir
    88  		Set the location to use for any temporary files.  The
    89  		default is a newly created directory that is removed
    90  		after the linker completes.  Temporary files are only
    91  		used in external linking mode.
    92  	-extld name
    93  		Set the name of the external linker to use in external
    94  		linking mode.  The default is "gcc".
    95  	-extldflags flags
    96  		Set space-separated trailing flags to pass to the
    97  		external linker in external linking mode.  The default
    98  		is to not pass any additional trailing flags.
    99  */
   100  package main