GCCGO(1)
π GCCGO(1) β the gccgo girlie's guide π
okay so bestie, welcome to gccgo, aka the GNU manual section 1 page for the GCC-based compiler for the Go language. this is the vibe. let's get into it π«Ά
β¨ SYNOPSIS β¨
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
lowkey important: that's only the most useful options up there. the rest are chillin' further down the page, bestie. keep scrolling π
πΈ DESCRIPTION πΈ
so the gccgo command is basically a frontend to gcc, and it supports a looooot of the same options. but β and this is the tea β this manual only documents the options specific to gccgo. the rest? go ask gcc(1) π
here's what gccgo can do, pick your fighter:
- compile Go source code into an object file π§
- link a collection of object files together π
- or literally do both in sequence, main character energy β¨
π¦ packages, the whole deal
Go source code gets compiled as packages. a package = one or more Go source files. and all the files in a single package must be compiled together, by passing all the files as arguments to gccgo. one single invocation of gccgo may only compile a single package. no sneaky multitasking, periodt.
one Go package may "import" a different Go package. and the imported package must have already been compiled β gccgo reads the import data directly from the compiled package. later, when you link it, the compiled form of that package has gotta be included in the link command. no package left behind π
π the debugging info thing
Go programs must generally be compiled with debugging information, and -g1 is the default (more on that below, iykyk). and stripping a Go program? it will generally cause it to misbehave or fail. don't do it bestie, that's a jump scare π©·
π OPTIONS π
one bullet per option, exactly as promised, no skips:
-Idirβ specify a directory to use when searching for an import package at compile time π-Ldirβ when linking, specify a library search directory, just like withgccπ-fgo-pkgpath=stringβ set 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 to this option should normally be the string that'll be used to import this package after it's been installed β in other words, a pathname within the directories specified by 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 π
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 this to work with gccgo, either -fgo-pkgpath or -fgo-prefix must be specified when compiling a package. no cap.
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. iconic behaviour honestly π
-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 π§-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π-fgo-check-divide-zeroβ add 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. β οΈ-fgo-check-divide-overflowβ add 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β disable escape analysis, which tries to allocate objects on the stack rather than the heap πβοΈπ¨-fgo-debug-escapenβ output escape analysis debugging information. larger values of n generate more information π-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 π-fgo-debug-optimizationβ output optimization diagnostics π¬-fgo-c-header=fileβ write top-level named Go struct definitions to file as C code. this is used when compiling the runtime package π§±-fgo-compiling-runtimeβ apply special rules for compiling the runtime package. implicit memory allocation is forbidden. some additional compiler directives are supported π«-fgo-embedcfg=fileβ identify 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"π-gβ this is the standardgccoption. it's mentioned here because by defaultgccgoturns on debugging information generation with the equivalent of the standard option-g1. this is 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, choose wisely bestie π
π SEE ALSO π
go give these a lil read too:
gpl(7)gfdl(7)fsf-funding(7)gcc(1)- and the Info entries for
gccgoandgcc
π COPYRIGHT π
Copyright (c) 2010-2023 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!! mwah π this slay of a manual page is from gcc-13 and it's dated 2026-09-10 β so if you're reading this, congrats, you're officially up to date. stay compiling, stay iconic πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: gccgo-13-powerpc64le-linux-gnu 13.5.0-1ubuntu1cross1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms