github.com/rohankumardubey/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/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, or .8 files) and writes a binary named for the
    14  architecture (5.out, 6.out, 8.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 8l or 5l 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 windows    (only in 6l/8l)
    47  		Write Windows PE32+ Console binaries (default when $GOOS is windows)
    48  	-H windowsgui (only in 6l/8l)
    49  		Write Windows PE32+ GUI binaries
    50  	-I interpreter
    51  		Set the ELF dynamic linker to use.
    52  	-L dir1 -L dir2
    53  		Search for libraries (package files) in dir1, dir2, etc.
    54  		The default is the single location $GOROOT/pkg/$GOOS_$GOARCH.
    55  	-r dir1:dir2:...
    56  		Set the dynamic linker search path when using ELF.
    57  	-s
    58  		Omit the symbol table and debug information.
    59  	-V
    60  		Print the linker version.
    61  	-X symbol value
    62  		Set the value of an otherwise uninitialized string variable.
    63  		The symbol name should be of the form importpath.name,
    64  		as displayed in the symbol table printed by "go tool nm".
    65  	-race
    66  		Link with race detection libraries.
    67  	-B value
    68  		Add a NT_GNU_BUILD_ID note when using ELF.  The value
    69  		should start with 0x and be an even number of hex digits.
    70  	-Z
    71  		Zero stack on function entry. This is expensive but it might
    72  		be useful in cases where you are suffering from false positives
    73  		during garbage collection and are willing to trade the CPU time
    74  		for getting rid of the false positives.
    75  		NOTE: it only eliminates false positives caused by other function
    76  		calls, not false positives caused by dead temporaries stored in
    77  		the current function call.
    78  	-linkmode argument
    79  		Set the linkmode.  The argument must be one of
    80  		internal, external, or auto.  The default is auto.
    81  		This sets the linking mode as described in
    82  		../cgo/doc.go.
    83  	-tmpdir dir
    84  		Set the location to use for any temporary files.  The
    85  		default is a newly created directory that is removed
    86  		after the linker completes.  Temporary files are only
    87  		used in external linking mode.
    88  	-extld name
    89  		Set the name of the external linker to use in external
    90  		linking mode.  The default is "gcc".
    91  	-extldflags flags
    92  		Set space-separated trailing flags to pass to the
    93  		external linker in external linking mode.  The default
    94  		is to not pass any additional trailing flags.
    95  */
    96  package main