Source file src/cmd/asm/doc.go
1 // Copyright 2015 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 Asm, typically invoked as “go tool asm”, assembles the source file into an object 7 file named for the basename of the argument source file with a .o suffix. The 8 object file can then be combined with other objects into a package archive. 9 10 # Command Line 11 12 Usage: 13 14 go tool asm [flags] file 15 16 The specified file must be a Go assembly file. 17 The same assembler is used for all target operating systems and architectures. 18 The GOOS and GOARCH environment variables set the desired target. 19 20 Flags: 21 22 -D name[=value] 23 Predefine symbol name with an optional simple value. 24 Can be repeated to define multiple symbols. 25 -I dir1 -I dir2 26 Search for #include files in dir1, dir2, etc, 27 after consulting $GOROOT/pkg/$GOOS_$GOARCH. 28 -S 29 Print assembly and machine code. 30 -V 31 Print assembler version and exit. 32 -debug 33 Dump instructions as they are parsed. 34 -dynlink 35 Support references to Go symbols defined in other shared libraries. 36 -e 37 No limit on number of errors reported. 38 -gensymabis 39 Write symbol ABI information to output file. Don't assemble. 40 -o file 41 Write output to file. The default is foo.o for /a/b/c/foo.s. 42 -p pkgpath 43 Set expected package import to pkgpath. 44 -shared 45 Generate code that can be linked into a shared library. 46 -spectre list 47 Enable spectre mitigations in list (all, ret). 48 -trimpath prefix 49 Remove prefix from recorded source file paths. 50 -v 51 Print debug output. 52 53 Input language: 54 55 The assembler uses mostly the same syntax for all architectures, 56 the main variation having to do with addressing modes. Input is 57 run through a simplified C preprocessor that implements #include, 58 #define, #ifdef/endif, but not #if or ##. 59 60 For more information, see https://golang.org/doc/asm. 61 */ 62 package main 63