GCCGO(1)
β¨ GCCGO(1) β gccgo π
π NAME
okay so gccgo is a GCC-based compiler for the Go language and it is literally iconic π₯
π SYNOPSIS
gccgo [-c|-S]
[-g] [-pg] [-Olevel]
[-Idir...] [-Ldir...]
[-o outfile] infile...
Only the most useful options are listed here; see below for the remainder. πΈ
π¦ DESCRIPTION
bestie, the gccgo command is a frontend to gcc and it supports many of the same options π§ This manual only documents the options specific to gccgo, so no need to panic π
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 one or more Go source files, and all the files in a single package must be compiled together by passing every file as an argument to gccgo. A single invocation of gccgo may only compile a single package, so one at a time, periodt π
One Go package may "import" a different Go package. The imported package must have already been compiled, and gccgo reads the import data directly from the compiled package. When this package is later linked, the compiled form of the package must be included in the link command. π«Ά
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. > π Do NOT strip your Go program, it will get messy fr fr.
π OPTIONS
-Idirβ tell gccgo which directory to search when it's looking for an import package at compile time πΊοΈ-Ldirβ when linking, specify a library search directory, same as with gcc π-fgo-pkgpath=stringβ sets the package path. This is the value returned by thePkgPathmethod ofreflect.Typeobjects, and it's also used for the names of globally visible symbols. The argument should normally be the string that will be used to import this package after it's installed, so basically a pathname inside the directories given by-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-fgo-pkgpathis used,-fgo-prefixgets ignored, so pick one π
Go lets a single program include more than one package with the same name in the package clause, though the two packages obviously have to be imported using different pathnames. For this to work with gccgo, either -fgo-pkgpath or -fgo-prefix must be specified when compiling a package. β¨
Using either -fgo-pkgpath or -fgo-prefix disables the special treatment of the main package and lets that package be imported like any other. π¦
-fgo-relative-import-path=dirβ a relative import is one that starts with./or../. With 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 explicitreturnstatement. You can turn 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 this is caught at runtime by catching theSIGFPEsignal. Some processors, like PowerPC, don't generate aSIGFPEon division by zero, and some runtimes don't generate a signal that can be caught. On those systems, use this option. 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 computingINT_MIN / -1. In Go this should wrap around to produceINT_MIN. Some processors, like x86, trap on division overflow, so on those systems use this option. You can 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 need it. π₯-fno-go-optimize-allocsβ disables escape analysis, which tries to allocate objects on the stack rather than the heap. πΈ-fgo-debug-escapenβ outputs escape analysis debugging information. Larger values ofngenerate more info π-fgo-debug-escape-hash=nβ a hash value for debugging escape analysis.nis a binary string. This runs escape analysis only on functions whose names hash to values matching 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 patterns used with special//go:embedcomments to the files named by those patterns. The JSON file should have two parts:"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 implement//go:embed. π«Ά-gβ the standard gcc option, mentioned here because gccgo turns on debugging info generation by default, the equivalent of the standard-g1. Go programs need debugging info to be available so they can produce backtrace info. You can pass an explicit-g0to disable debugging info generation, but then certain standard library functions, likeruntime.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-2021 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.
bestie that's the whole page, gcc-11 vibes from 2024-07-19 and you're officially a gccgo expert now ππβ¨
π¦ where this page comes from
- ubuntu questing: gccgo-11-s390x-linux-gnu 11.5.0-7ubuntu1.1cross1
- ubuntu questing: gccgo-11-s390x-linux-gnu 11.5.0-7ubuntu1cross1
- ubuntu resolute: gccgo-11-s390x-linux-gnu 11.5.0-11ubuntu2cross1
- ubuntu stonking: gccgo-11-s390x-linux-gnu 11.5.0-11ubuntu2cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms