GCCGO(1)
π gccgo β the GCC-based compiler for the Go language π
welcome to the gccgo(1) page bestie, straight from the GNU squad π
NAME
gccgo β a GCC-based compiler for the Go language πΉβ¨
SYNOPSIS
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
ngl this is only the most useful options β the rest are down below. keep scrolling π
DESCRIPTION
okay so here's the tea: the gccgo command is a frontend to gcc, and it supports many of the same options. but this manual only documents the options specific to gccgo, so don't come for me about the shared ones. π
You can use gccgo to compile Go source code into an object file, to link a collection of object files together, or to do both β one after the other, in sequence. versatile queen π
Go source code gets compiled as packages. A package is made up of one or more Go source files. Every file in a single package has to be compiled together, which means you pass all the files as arguments to gccgo. And a single invocation of gccgo can only compile a single package β no multitasking, she's focused. π§
One Go package can "import" a different Go package. That imported package must have already been compiled β gccgo reads the import data directly from the compiled package. So when you later link this package, the compiled form of the imported one has to be included in the link command. don't forget it fr fr π
Go programs must generally be compiled with debugging information, and -g1 is the default, as described below. Stripping a Go program will generally cause it to misbehave or fail. like, do not do that. it's giving chaos π
β¨ OPTIONS β¨
-Idirβ tell it which directory to search when it's hunting for an import package at compile time. π-Ldirβ when linking, this specifies a library search directory, exactly like withgcc.-fgo-pkgpath=stringβ sets the package path to use. This sets the value returned by thePkgPathmethod ofreflect.Typeobjects. It's also used for the names of globally visible symbols. The argument here should normally be the string you'll use to import this package after it's been installed β in other words, a pathname within the directories you specified with the-Ioption. π-fgo-prefix=stringβ an alternative to-fgo-pkgpath. The argument gets combined with the package name from the source file to produce the package path. If-fgo-pkgpathis used,-fgo-prefixwill be ignored.
So here's why this matters: Go lets a single program include more than one package with the same name in the "package" clause in the source file β though obviously those two packages have to be imported using different pathnames. For that to work with gccgo, you must specify either -fgo-pkgpath or -fgo-prefix when compiling a package.
Also: using either -fgo-pkgpath or -fgo-prefix disables the special treatment of the "main" package and lets that package be imported like any other. slay π«Ά
-fgo-relative-import-path=dirβ a relative import is an import that starts with./or../. If you use this option,gccgowill usediras a prefix for the relative import while searching for it. π-frequire-return-statement-fno-require-return-statementβ by defaultgccgowarns about functions that have one or more return parameters but lack an explicit"return"statement. That warning can be turned off with-fno-require-return-statement. π-fgo-check-divide-zeroβ adds explicit checks for division by zero. In Go, a division (or modulo) by zero causes a panic. On Unix systems this gets detected in the runtime by catching the"SIGFPE"signal. But some processors, like PowerPC, don't generate aSIGFPEon division by zero, and some runtimes don't generate a signal that can be caught at all. On those systems, you can use this option. Or you can remove the checks with-fno-go-check-divide-zero. This option is currently on by default, but in the future it may be off by default on systems that don't need it. π-fgo-check-divide-overflowβ adds explicit checks for division overflow. For example, division overflow happens when computing"INT_MIN / -1". In Go this should be wrapped, producing"INT_MIN". Some processors, like x86, generate a trap on division overflow β on those systems, this option may be used. Or the checks can be removed with-fno-go-check-divide-overflow. This option is currently on by default, but in the future it may be off by default on systems that don't require it. β-fno-go-optimize-allocsβ disables escape analysis, which tries to allocate objects on the stack instead of the heap. π-fgo-debug-escapenβ outputs escape analysis debugging information. Larger values ofngenerate more information.-fgo-debug-escape-hash=nβ a hash value used to debug escape analysis.nis a binary string. This runs escape analysis only on functions whose names hash to values matching the given suffixn. Perfect for binary searching across functions to uncover escape analysis bugs π₯-fgo-debug-optimizationβ outputs optimization diagnostics. π-fgo-c-header=fileβ writes top-level named Go struct definitions tofileas C code. This is used when compiling the runtime package. π-fgo-compiling-runtimeβ applies special rules for compiling the runtime package. Implicit memory allocation is forbidden. Some additional compiler directives are supported. π-fgo-embedcfg=fileβ identifies a JSON file used to map patterns used with special"//go:embed"comments to the files named by those patterns. The JSON file should have two components:"Patterns"maps each pattern to a list of file names, and"Files"maps each file name to a full path to the file. This option is intended for use by thegocommand to implement"//go:embed". π¦-fgo-importcfg=fileβ identifies a file that provides mappings for import package paths found in the Go source files. The file can contain two commands:"importpath"to rename import paths for vendoring, and"packagefile"to map from package path to files containing export data. This option is intended for use by thegocommand. πΊοΈ-gβ this is the standardgccoption, but it gets a shoutout here because by defaultgccgoturns on debugging information generation with the equivalent of the standard option-g1. Why? Because Go programs require debugging information to be available in order to get backtrace information. An explicit-g0may be used to disable the generation of debugging information β but in that case, certain standard library functions, such as"runtime.Callers", will not operate correctly. π choose wisely bestie
SEE ALSO
gpl(7), gfdl(7), fsf-funding(7), gcc(1), and the Info entries for gccgo and gcc. π¦
COPYRIGHT
Copyright (c) 2010-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the man page gfdl(7).
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
and that's the whole page, bestie π this one's from gcc-16, dated 2026-08-10 β iconic, no cap, periodt πβ¨
π¦ where this page comes from
- arch rolling: gcc-go 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms