GCCGO(1)
π¦ GCCGO(1) β the GNU manual, bestie edition π¦
okay so you picked up the GNU manual page for gccgo, and honestly? iconic choice. let's get into it π
β¨ NAME β¨
gccgo β a GCC-based compiler for the Go language. that's it, that's the tweet π
πΈ SYNOPSIS πΈ
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
lowkey important disclaimer bestie: only the most useful options are listed up here. the rest? scroll down, they're all there, i promise π
π DESCRIPTION π
so the gccgo command is a frontend to gcc, and it supports a whole bunch of the same options. but heads up β this manual only documents the options that are specific to gccgo. the rest live in gcc's own docs, iykyk.
what can you actually do with it? three things, pick your fighter:
- compile Go source code into an object file
- link a bunch of object files together
- or do both, one after the other, in sequence β¨
Go source code gets compiled as packages. a package = one or more Go source files. and likeβ¦ all the files in a single package have to be compiled together, by passing all of them as arguments to gccgo. one single invocation of gccgo may only compile a single package. no multitasking, no cap π«Ά
one Go package may "import" a different Go package. the imported package must have already been compiled β gccgo will read the import data directly from the compiled package. and when that package is later linked, the compiled form of the package must be included in the link command. don't forget it, bestie π
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. so likeβ¦ don't do that π
π₯ OPTIONS π₯
-Idirβ tells the compiler which directory to search when it's looking for an import package at compile time. your "where are my imports" directory, basically π-Ldirβ when linking, this specifies a library search directory, just like with gcc. same energy as gcc's-L, because it literally is π-fgo-pkgpath=stringβ sets the package path to use. this sets the value returned by thePkgPathmethod ofreflect.Typeobjects, and it's also used for the names of globally visible symbols. the argument to this option should normally be the string that will be used to import this package after it has been installed β in other words, a pathname within the directories specified by the-Ioption. so it's giving "future import path main character energy" π-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. and fr fr: if-fgo-pkgpathis used,-fgo-prefixwill be ignored. bye girl π
Go permits a single program to include more than one package with the same name in the "package" clause in the source file β though obviously the two packages must be imported using different pathnames. for that to work with gccgo, either -fgo-pkgpath or -fgo-prefix must be specified when compiling a package. no option, no vibes β
also: using either -fgo-pkgpath or -fgo-prefix disables the special treatment of the "main" package and permits that package to be imported like any other. main character no more π
-fgo-relative-import-path=dirβ a relative import is an import that starts with./or../. if this option is used,gccgowill use dir as a prefix for the relative import when searching for it. it's giving "home address for your relative imports" π‘-frequire-return-statement,-fno-require-return-statementβ by defaultgccgowill warn about functions which have one or more return parameters but lack an explicit"return"statement. this warning may be disabled using-fno-require-return-statement. so if the warnings are jumping you, you know what to do π«£-fgo-check-divide-zeroβ adds explicit checks for division by zero. in Go a division (or modulos) by zero causes a panic. on Unix systems this is detected in the runtime by catching the"SIGFPE"signal. some processors, such as PowerPC, do not generate aSIGFPEon division by zero. some runtimes do not generate a signal that can be caught. on those systems, this option may be used. or the checks may be removed via-fno-go-check-divide-zero. this option is currently on by default, but in the future may be off by default on systems that do not require it. (yes,-fno-go-check-divide-zerohas the extrago-in there, don't @ me, that's just how it is π)-fgo-check-divide-overflowβ adds explicit checks for division overflow. for example, division overflow occurs when computing"INT_MIN / -1". in Go this should be wrapped, to produce"INT_MIN". some processors, such as x86, generate a trap on division overflow. on those systems, this option may be used. or the checks may be removed via-fno-go-check-divide-overflow. this option is currently on by default, but in the future may be off by default on systems that do not require it π₯-fno-go-optimize-allocsβ disables escape analysis, which tries to allocate objects on the stack rather than the heap. yeah. it's trying its best π-fgo-debug-escapenβ outputs escape analysis debugging information. larger values of n generate more information. more n = more chaos π-fgo-debug-escape-hash=nβ a hash value to debug escape analysis. n is a binary string. this runs escape analysis only on functions whose names hash to values that match the given suffix n. this can be used to binary search across functions to uncover escape analysis bugs. detective mode activated π΅οΈββοΈ-fgo-debug-optimizationβ outputs optimization diagnostics. enjoy the lore π-fgo-c-header=fileβ writes top-level named Go struct definitions to file as C code. this is used when compiling the runtime package. slay, cross-language communication π-fgo-compiling-runtimeβ applies special rules for compiling the runtime package. implicit memory allocation is forbidden. some additional compiler directives are supported. runtime package gets the VIP treatment π-fgo-embedcfg=fileβ identifies a JSON file used to map patterns used with special"//go:embed"comments to the files named by the 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 the go command to implement"//go:embed". the go command said "i'll handle this" and honestly, respect π«Ά-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 the go command β-gβ this is the standard gcc option. it's mentioned 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 β in which case certain standard library functions, such as"runtime.Callers", will not operate correctly. so like,-g0is a choice, and that choice has consequences π
π SEE ALSO π
gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entries for gccgo and gcc. go read those too, bestie, that's the homework π
π COPYRIGHT π
Copyright (c) 2010-2025 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.
okay so that's the whole page, every last crumb of it, and now the cute lil sign-off: this lil beauty comes from source/version gcc-15, dated 2026-06-12 β and it's genuinely, officially GCCGO(1). bye bestie, go compile something iconic π¦πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: gcc15-go 15.3.0+git11272-160000.2.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: gcc15-go 15.3.0+git11272-160000.2.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: gcc15-go 15.3.0+git11272-160000.2.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: gcc15-go 15.3.0+git11272-160000.2.1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms