GCCGO(1)
GCCGO(1) ๐ the GNU manual page, bestie, and it's about the Go compiler ๐
โจ NAME โจ
okay so gccgo is a GCC-based compiler for the Go language ๐ฅ it's giving "compiler that actually works with Go" and I'm obsessed
โจ SYNOPSIS โจ
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
only the most useful options are listed up there ๐ฆ scroll down for the rest, babe
โจ DESCRIPTION โจ
the gccgo command is a frontend to gcc and it supports a lot of the same options ๐ this manual only covers the gccgo-specific ones, so don't stress about the rest
gccgo can compile Go source code into an object file, link a bunch of object files together, or do both in sequence โจ main character energy
Go source code gets compiled as packages ๐ฆ a package is one or more Go source files. all the files in a single package have to be compiled together, which means you pass every single file as an argument to gccgo ๐ซถ one invocation of gccgo can only compile a single package, no cap
one Go package can "import" a different Go package ๐ธ the imported one has to be compiled already, and gccgo reads the import data straight from the compiled package. when you link this package later, the compiled form of the imported package has to be in the link command too ๐
Go programs generally need to be compiled with debugging info, and -g1 is the default (more on that below) ๐ง
stripping a Go program will generally make it misbehave or fail ๐ so don't do it, bestie
โจ OPTIONS โจ
-Idirโ tells gccgo where to look for an import package at compile time ๐-Ldirโ when linking, adds a library search directory, just like gcc does ๐-fgo-pkgpath=stringโ sets the package path โจ this is the value you get back from thePkgPathmethod ofreflect.Typeobjects, and it's also used for the names of globally visible symbols. the argument should normally be the same string you'll use to import this package after it's installed, aka a pathname inside the directories you gave with-I๐ค๏ธ-fgo-prefix=stringโ an alternative to-fgo-pkgpath๐ the argument gets combined with the package name from the source file to make the package path. if you use-fgo-pkgpathtoo, then-fgo-prefixgets ignored
Go lets one program include more than one package with the same name in the "package" clause ๐ the two packages obviously have to be imported using different pathnames though. for this to work with gccgo, you need either -fgo-pkgpath or -fgo-prefix when compiling a package. using either one also turns off the special treatment of the "main" package and lets it be imported like any other ๐
-fgo-relative-import-path=dirโ a relative import is one that starts with./or../๐งญ if you use this option, gccgo usesdiras a prefix for the relative import when it searches for it-frequire-return-statement,-fno-require-return-statementโ by default gccgo warns about functions that have one or more return parameters but no explicit "return" statement ๐ซ you can turn that warning off with-fno-require-return-statement-fgo-check-divide-zeroโ adds explicit checks for division by zero โ๐ฅ in Go, a division (or modulus) by zero causes a panic. on Unix systems the runtime catches that by catching the "SIGFPE" signal. some processors, like PowerPC, don't generate a SIGFPE on division by zero, and some runtimes don't generate a signal that can be caught. on those systems, 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, overflow happens when computingINT_MIN / -1. in Go that should wrap around toINT_MIN. some processors, like x86, trap on division overflow, so on those systems you can use this option. or remove the checks 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 is the thing that tries to allocate objects on the stack instead of the heap ๐ฅ-fgo-debug-escapenโ outputs escape analysis debugging info ๐ต๏ธโโ๏ธ larger values ofngenerate more info-fgo-debug-escape-hash=nโ a hash value to debug escape analysis ๐nis a binary string. this runs escape analysis only on functions whose names hash to values that match the given suffixn. you can binary search across functions with this 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 ๐ซ and some additional compiler directives are supported-fgo-embedcfg=fileโ identifies a JSON file that maps the 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 meant for the go command to use when it implements "//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 a package path to the files containing export data. this option is meant for the go command-gโ this is the standard gcc option, and it's mentioned here because gccgo turns on debugging info generation by default, which is the equivalent of the standard-g1๐ that's because Go programs need debugging info to get backtrace info. you can use an explicit-g0to disable debugging info generation, but then certain standard library functions, like "runtime.Callers", won't operate correctly ๐ฅฒ
โจ 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.
okay the legal part, but make it cute ๐ you're allowed to copy and 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. there are no Invariant Sections, the Front-Cover Texts are (a) (see below), and the Back-Cover Texts are (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.
that's the whole tea, bestie ๐ this page is from gcc-16, dated 2026-03-22, and you're officially a gccgo expert now ๐ฆโจ
๐ฆ where this page comes from
- ubuntu resolute: gccgo-16-s390x-linux-gnu 16-20260322-1ubuntu1cross1
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms