GCCGO(1)
π GCCGO(1): the gccgo manual, bestie edition π
β¨ NAME β¨
gccgo: a GCC-based compiler for the Go language π
β¨ SYNOPSIS β¨
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
Only the most useful options made the cut here, so scroll down for the rest π«Ά
β¨ DESCRIPTION β¨
Okay so gccgo is a frontend to gcc and it supports a lot of the same options π This manual only covers the options that are specific to gccgo, so you're not reading the same stuff twice.
The gccgo command can compile Go source code into an object file, link a collection of object files together, or do both in sequence β¨
Go source code gets compiled as packages. A package is made of one or more Go source files. All the files in a single package have to be compiled together, so pass every file as an argument to gccgo. A single invocation of gccgo can only compile a single package π
One Go package can "import" a different Go package. The imported package has to be compiled already, and gccgo reads the import data straight from the compiled package. When the package gets linked later, its compiled form has to be included in the link command π¦
Go programs generally need to be compiled with debugging information, and -g1 is the default (more on that below).
π Stripping a Go program will generally cause it to misbehave or fail. Be careful with that one, bestie.
β¨ OPTIONS β¨
-Idirβ pick a directory to search when hunting for an import package at compile time π-Ldirβ when linking, set a library search directory, same as with gcc π-fgo-pkgpath=stringβ sets the package path, which is the value returned by thePkgPathmethod ofreflect.Typeobjects. It's also used for the names of globally visible symbols. The argument should normally be the string you'll use to import this package after it's installed, so basically a pathname inside the directories given by the-Ioption πΈ-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-fgo-pkgpathis used,-fgo-prefixgets ignored. Go lets a single program include more than one package with the same name in the "package" clause, though those two packages obviously have to be imported using different pathnames. For that to work with gccgo, you need either-fgo-pkgpathor-fgo-prefixwhen compiling a package. Using either one also turns off the special treatment of the "main" package and lets that package be imported like any other π-fgo-relative-import-path=dirβ a relative import starts with./or../. If you use this option, gccgo usesdiras a prefix for the relative import when searching 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 switch that warning off with-fno-require-return-statementπ-fgo-check-divide-zeroβ adds explicit checks for division by zero. In Go, dividing (or taking the modulo) by zero causes a panic. On Unix systems that's caught at runtime 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 computing "INT_MIN / -1". In Go this should wrap around to produce "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 via-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 for debugging escape analysis, wherenis a binary string. This runs escape analysis only on functions whose names hash to values that match the given suffixn. You can use it to binary search across functions and 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, but some additional compiler directives are supported π«-gβ the standard gcc option, mentioned here because by default gccgo turns on debugging information generation with the equivalent of the standard option-g1. This is because Go programs need debugging information available in order to get backtrace information. An explicit-g0disables the generation of debugging information, and in that case 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-2020 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.
That's the whole tea, bestie! π This page came from gcc-10, dated 2023-07-07, and it's all GCCGO(1) energy π Love you, mean it π«Άβ¨
π¦ where this page comes from
- ubuntu noble: gccgo-10-mips-linux-gnu 10.5.0-4ubuntu2cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms