Go: cmd/asm Files

Command asm

Asm, typically invoked as “go tool asm”, assembles the source file into an object file named for the basename of the argument source file with a .o suffix. The object file can then be combined with other objects into a package archive.

Command Line


go tool asm [flags] file

The specified file must be a Go assembly file. The same assembler is used for all target operating systems and architectures. The GOOS and GOARCH environment variables set the desired target.


-D value
	predefined symbol with optional simple value -D=identifier=value;
	can be set multiple times
-I value
	include directory; can be set multiple times
-S	print assembly and machine code
	dump instructions as they are parsed
	support references to Go symbols defined in other shared libraries
-o string
	output file; default foo.o for /a/b/c/foo.s
	generate code that can be linked into a shared library
-trimpath string
	remove prefix from recorded source file paths

Input language:

The assembler uses mostly the same syntax for all architectures, the main variation having to do with addressing modes. Input is run through a simplified C preprocessor that implements #include, #define, #ifdef/endif, but not #if or ##.

For more information, see https://golang.org/doc/asm.

Package Files

doc.go main.go

Package main imports 12 packages (graph). Updated 2017-08-25. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: