GCCGO(1)
β¨ GCCGO(1) β the gccgo manual page π
okay bestie, gather round because gccgo is literally the GCC-based compiler for the Go language and it is SO iconic π
π₯. The manual name is gccgo and it's giving "compile Go code, no cap" π¦.
π 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 are listed here, bestie π«Ά the rest are down below, see below for the remainder β¨.
π§ DESCRIPTION
okay so 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 don't worry about the others π.
gccgo can compile Go source code into an object file, link a collection of object files together, or do both in sequence. Main character energy β.
Go source code is compiled as packages π. A package consists of one or more Go source files. All the files in a single package must be compiled together, by passing all the files as arguments to gccgo. A single invocation of gccgo may only compile a single package, periodt π
.
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. 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 π.
π OPTIONS
-Idirβ tell it which directory to search when looking for an import package at compile time π.-Ldirβ when linking, specify a library search directory, same as gcc does π.-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 has 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, so don't stress π .
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 π. In order 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 permits that package to be imported like any other β¨.
-fgo-relative-import-path=dirβ a relative import is an import that starts with./or../. If this option is used, gccgo will usediras a prefix for the relative import when searching for it π§.-frequire-return-statement,-fno-require-return-statementβ by default gccgo will 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β 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 a SIGFPE on division by zero, and 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 it may be off by default on systems that do not require it π.-fgo-check-divide-overflowβ adds explicit checks for division overflow π¦. For example, division overflow occurs when computingINT_MIN / -1. In Go this should be wrapped, to produceINT_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 it 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 π.-fgo-debug-escapenβ outputs escape analysis debugging information. Larger values ofngenerate more information π.-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π§. This can be used to binary search across functions 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 used to map patterns used with special//go:embedcomments 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β 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 to get backtrace information π. An explicit-g0may be used to disable the generation of debugging information, but then certain standard library functions, such asruntime.Callers, will not 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 gccgo tea βπ this page was from gcc-11 and dated 2024-07-19, so it's a little vintage but still slaying πβ¨ byeee π«Άπ¦
π¦ where this page comes from
- ubuntu noble: gccgo-11-mipsel-linux-gnu 11.5.0-1ubuntu1~24.04cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms