Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–1484 unchanged (1484 lines)
1485 // We are generating a binary with symbol table suppressed.
1486 // Suppress local symbols. We need to keep dynamically exported
1487 // and referenced symbols so the dynamic linker can resolve them.
1488 argv = append(argv, "-Wl,-x")
1489 }
1490 }
1491 if *flagHostBuildid == "none" {
1492 argv = append(argv, "-Wl,-no_uuid")
1493 }
1494 case objabi.Hopenbsd:
1495 argv = append(argv, "-pthread")
1496 if ctxt.BuildMode != BuildModePIE {
1497 argv = append(argv, "-Wl,-nopie")
…lines 1498–3132 unchanged (1635 lines)

After

…lines 1–1484 unchanged (1484 lines)
1485 // We are generating a binary with symbol table suppressed.
1486 // Suppress local symbols. We need to keep dynamically exported
1487 // and referenced symbols so the dynamic linker can resolve them.
1488 argv = append(argv, "-Wl,-x")
1489 }
1490 }
1491 if *flagRace {
1492 // With https://github.com/llvm/llvm-project/pull/182943, the race object
1493 // has a weak import of __dyld_get_dyld_header, which is only defined on
1494 // newer macOS (26.4+).
1495 argv = append(argv, "-Wl,-U,__dyld_get_dyld_header")
1496 }
1497 if *flagHostBuildid == "none" {
1498 argv = append(argv, "-Wl,-no_uuid")
1499 }
1500 case objabi.Hopenbsd:
1501 argv = append(argv, "-pthread")
1502 if ctxt.BuildMode != BuildModePIE {
…lines 1503–3138 unchanged (1636 lines)

Before

source_file
comment "// Inferno utils/8l/asm.c"
comment "// https://bitbucket.org/inferno-os/inferno-os/src/master/ut"...
comment "//"
comment "//\tCopyright © 1994-1999 Lucent Technologies Inc. All right"...
comment "//\tPortions Copyright © 1995-1997 C H Forsyth (forsyth@terza"...
comment "//\tPortions Copyright © 1997-1999 Vita Nuova Limited"
comment "//\tPortions Copyright © 2000-2007 Vita Nuova Holdings Limite"...
comment "//\tPortions Copyright © 2004,2006 Bruce Ellis"
comment "//\tPortions Copyright © 2005-2007 C H Forsyth (forsyth@terza"...
comment "//\tRevisions Copyright © 2000-2007 Lucent Technologies Inc. "...
comment "//\tPortions Copyright © 2009 The Go Authors. All rights rese"...
comment "//"
comment "// Permission is hereby granted, free of charge, to any pers"...
comment "// of this software and associated documentation files (the "...
comment "// in the Software without restriction, including without li"...
comment "// to use, copy, modify, merge, publish, distribute, sublice"...
comment "// copies of the Software, and to permit persons to whom the"...
comment "// furnished to do so, subject to the following conditions:"
comment "//"
comment "// The above copyright notice and this permission notice sha"...
comment "// all copies or substantial portions of the Software."
comment "//"
comment "// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY"...
comment "// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF M"...
comment "// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN"...
comment "// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM"...
comment "// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHE"...
comment "// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O"...
comment "// THE SOFTWARE."
package_clause
package "package"
package_identifier "ld"
import_declaration (+155 nodes collapsed)
comment "// Data layout and relocation."
comment "// Derived from Inferno utils/6l/l.h"
comment "// https://bitbucket.org/inferno-os/inferno-os/src/master/ut"...
comment "//"
comment "//\tCopyright © 1994-1999 Lucent Technologies Inc. All right"...
comment "//\tPortions Copyright © 1995-1997 C H Forsyth (forsyth@terza"...
comment "//\tPortions Copyright © 1997-1999 Vita Nuova Limited"
comment "//\tPortions Copyright © 2000-2007 Vita Nuova Holdings Limite"...
comment "//\tPortions Copyright © 2004,2006 Bruce Ellis"
comment "//\tPortions Copyright © 2005-2007 C H Forsyth (forsyth@terza"...
comment "//\tRevisions Copyright © 2000-2007 Lucent Technologies Inc. "...
comment "//\tPortions Copyright © 2009 The Go Authors. All rights rese"...
comment "//"
comment "// Permission is hereby granted, free of charge, to any pers"...
comment "// of this software and associated documentation files (the "...
comment "// in the Software without restriction, including without li"...
comment "// to use, copy, modify, merge, publish, distribute, sublice"...
comment "// copies of the Software, and to permit persons to whom the"...
comment "// furnished to do so, subject to the following conditions:"
comment "//"
comment "// The above copyright notice and this permission notice sha"...
comment "// all copies or substantial portions of the Software."
comment "//"
comment "// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY"...
comment "// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF M"...
comment "// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN"...
comment "// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM"...
comment "// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHE"...
comment "// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O"...
comment "// THE SOFTWARE."
comment "// ArchSyms holds a number of architecture specific symbols "...
comment "// relocation. Rather than allowing them universal access t"...
comment "// we keep a subset for relocation application."
type_declaration (+120 nodes collapsed)
comment "// mkArchSym is a helper for setArchSyms, to set up a specia"...
method_declaration (+72 nodes collapsed)
comment "// mkArchSymVec is similar to setArchSyms, but operates on "...
comment "// a slice, where each element corresponds to some symbol ve"...
method_declaration (+77 nodes collapsed)
comment "// setArchSyms sets up the ArchSyms structure, and must be c"...
comment "// relocations are applied."
method_declaration (+474 nodes collapsed)
type_declaration (+618 nodes collapsed)
var_declaration
var "var"
var_spec_list
( "("
var_spec
identifier "thearch"
type_identifier "Arch"
var_spec
identifier "lcSize"
type_identifier "int32"
var_spec
identifier "rpath"
type_identifier "Rpath"
var_spec
identifier "spSize"
type_identifier "int32"
var_spec
identifier "symSize"
type_identifier "int32"
) ")"
comment "// Symbol version of ABIInternal symbols. It is sym.SymVerAB"...
comment "// are used, 0 otherwise."
var_declaration
var "var"
var_spec
identifier "abiInternalVer"
= "="
expression_list
selector_expression
identifier "sym"
. "."
field_identifier "SymVerABIInternal"
comment "// DynlinkingGo reports whether we are producing Go code tha"...
comment "// in separate shared libraries linked together at runtime."
method_declaration (+72 nodes collapsed)
comment "// CanUsePlugins reports whether a plugins can be used"
method_declaration (+48 nodes collapsed)
comment "// NeedCodeSign reports whether we need to code-sign the out"...
method_declaration (+40 nodes collapsed)
var_declaration (+54 nodes collapsed)
var_declaration (+100 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "pkgdef"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "__.PKGDEF"
" "\""
var_declaration (+42 nodes collapsed)
function_declaration (+38 nodes collapsed)
comment "/*\n * Unix doesn't like it when we write to a running (or, s"...
function_declaration (+72 nodes collapsed)
function_declaration (+423 nodes collapsed)
function_declaration (+45 nodes collapsed)
function_declaration (+23 nodes collapsed)
function_declaration (+488 nodes collapsed)
comment "// extld returns the current external linker."
method_declaration (+111 nodes collapsed)
comment "// findLibPathCmd uses cmd command to find gcc library libna"...
comment "// It returns library full path if found, or \"none\" if not f"...
method_declaration (+221 nodes collapsed)
comment "// findLibPath searches for library libname."
comment "// It returns library full path if found, or \"none\" if not f"...
method_declaration (+42 nodes collapsed)
method_declaration (+1332 nodes collapsed)
comment "// loadWindowsHostArchives loads in host archives and object"...
comment "// doing internal linking on windows. Older toolchains seem "...
comment "// just a single pass through the various archives, but some"...
comment "// toolchains when linking a C program with mingw pass libra"...
comment "// multiple times to the linker, e.g. \"... -lmingwex -lmingw"...
comment "// -lmingwex -lmingw32 ...\". To accommodate this behavior, w"...
comment "// passes over the host archives below."
function_declaration (+606 nodes collapsed)
comment "// loadcgodirectives reads the previously discovered cgo dir"...
comment "// symbols in preparation for host object loading or use lat"...
method_declaration (+257 nodes collapsed)
comment "// Set up flags and special symbols depending on the platfor"...
comment "// This version works with loader.Loader."
method_declaration (+1407 nodes collapsed)
comment "// mangleTypeSym shortens the names of symbols that represen"...
comment "// if they are visible in the symbol table."
comment "//"
comment "// As the names of these symbols are derived from the string"...
comment "// the type, they can run to many kilobytes long. So we shor"...
comment "// them using a SHA-1 when the name appears in the final bin"...
comment "// This also removes characters that upset external linkers."
comment "//"
comment "// These are the symbols that begin with the prefix 'type.' "...
comment "// contain run-time type information used by the runtime and"...
comment "// packages. All Go binaries contain these symbols, but only"
comment "// those programs loaded dynamically in multiple parts need "...
comment "// symbols to have entries in the symbol table."
method_declaration (+296 nodes collapsed)
comment "// typeSymbolMangle mangles the given symbol name into somet"...
comment "//"
comment "// Keep the type:. prefix, which parts of the linker (like t"...
comment "// DWARF generator) know means the symbol is not decodable."
comment "// Leave type:runtime. symbols alone, because other parts of"
comment "// the linker manipulates them."
function_declaration (+372 nodes collapsed)
comment "/*\n * look for the next file in an archive.\n * adapted from "...
function_declaration (+305 nodes collapsed)
function_declaration (+608 nodes collapsed)
type_declaration (+52 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "hostobj"
slice_type
[ "["
] "]"
type_identifier "Hostobj"
comment "// These packages can use internal linking mode."
comment "// Others trigger external mode."
var_declaration (+80 nodes collapsed)
function_declaration (+275 nodes collapsed)
function_declaration (+224 nodes collapsed)
function_declaration (+255 nodes collapsed)
comment "// cleanTimeStamps resets the timestamps for the specified l"...
comment "// existing files to the Unix epoch (1970-01-01 00:00:00 +00"...
comment "// We take this step in order to help preserve reproducible "...
comment "// this seems to be primarily needed for external linking on"...
comment "// with later versions of xcode, which (unfortunately) seem "...
comment "// incorporate object file times into the final output file'"...
comment "// ID. See issue 64947 for the unpleasant details."
function_declaration (+89 nodes collapsed)
comment "// hostobjCopy creates a copy of the object files in hostobj"...
comment "// temporary directory."
method_declaration (+474 nodes collapsed)
comment "// writeGDBLinkerScript creates gcc linker script file in te"...
comment "// directory. writeGDBLinkerScript returns created file path"...
comment "// The script is used to work around gcc bug"
comment "// (see https://golang.org/issue/20183 for details)."
function_declaration (+100 nodes collapsed)
type_declaration (+37 nodes collapsed)
comment "// archive builds a .a archive from the hostobj object files"...
method_declaration (+504 nodes collapsed)
method_declaration
func "func"
parameter_list
( "("
parameter_declaration
identifier "ctxt"
pointer_type
* "*"
type_identifier "Link"
) ")"
field_identifier "hostlink"
parameter_list
( "("
) ")"
block
{ "{"
statement_list
if_statement (+21 nodes collapsed)
if_statement
if "if"
binary_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "BuildMode"
== "=="
identifier "BuildModeCArchive"
block
{ "{"
statement_list
return_statement
return "return"
} "}"
var_declaration
var "var"
var_spec
identifier "argv"
slice_type
[ "["
] "]"
type_identifier "string"
assignment_statement (+22 nodes collapsed)
assignment_statement (+23 nodes collapsed)
if_statement (+107 nodes collapsed)
comment "// On darwin, whether to combine DWARF into executable."
comment "// Only macOS supports unmapped segments such as our __DWARF"...
short_var_declaration (+26 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "isMSVC"
type_identifier "bool"
comment "// used on Windows"
short_var_declaration
expression_list
identifier "wlPrefix"
:= ":="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Wl,--"
" "\""
expression_switch_statement
switch "switch"
selector_expression
identifier "ctxt"
. "."
field_identifier "HeadType"
{ "{"
expression_case
case "case"
expression_list
selector_expression
identifier "objabi"
. "."
field_identifier "Hdarwin"
: ":"
statement_list
if_statement (+25 nodes collapsed)
if_statement (+52 nodes collapsed)
if_statement (+52 nodes collapsed)
if_statement (+31 nodes collapsed)
expression_case (+142 nodes collapsed)
expression_case (+240 nodes collapsed)
expression_case (+77 nodes collapsed)
} "}"
comment "// On PPC64, verify the external toolchain supports Power10."...
comment "// PC relative relocations might be generated by Go. Only ta"...
comment "// binaries might generate these relocations."
if_statement (+81 nodes collapsed)
comment "// Enable/disable ASLR on Windows."
short_var_declaration (+305 nodes collapsed)
expression_switch_statement (+532 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "altLinker"
type_identifier "string"
if_statement (+49 nodes collapsed)
if_statement (+495 nodes collapsed)
if_statement (+168 nodes collapsed)
if_statement (+31 nodes collapsed)
if_statement (+110 nodes collapsed)
comment "// On Windows, given -o foo, GCC will append \".exe\" to produ"...
comment "// \"foo.exe\". We have decided that we want to honor the -o"
comment "// option. To make this work, we append a '.' so that GCC"
comment "// will decide that the file already has an extension. We"
comment "// only want to do this when producing a Windows output file"
comment "// on a Windows host."
short_var_declaration
expression_list
identifier "outopt"
:= ":="
expression_list
unary_expression
* "*"
identifier "flagOutfile"
if_statement (+53 nodes collapsed)
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "-o"
" "\""
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
identifier "outopt"
) ")"
if_statement (+44 nodes collapsed)
if_statement (+46 nodes collapsed)
comment "// Force global symbols to be exported for dlopen, etc."
expression_switch_statement (+311 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "unusedArguments"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Qunused-arguments"
" "\""
if_statement (+38 nodes collapsed)
if_statement (+66 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "compressDWARF"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Wl,--compress-debug-sections=zlib"
" "\""
if_statement (+44 nodes collapsed)
short_var_declaration
expression_list
identifier "hostObjCopyPaths"
:= ":="
expression_list
call_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "hostobjCopy"
argument_list
( "("
) ")"
expression_statement
call_expression
identifier "cleanTimeStamps"
argument_list
( "("
identifier "hostObjCopyPaths"
) ")"
short_var_declaration (+21 nodes collapsed)
expression_statement
call_expression
identifier "cleanTimeStamps"
argument_list
( "("
composite_literal
slice_type
[ "["
] "]"
type_identifier "string"
literal_value
{ "{"
literal_element
identifier "godotopath"
} "}"
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
identifier "godotopath"
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
variadic_argument
identifier "hostObjCopyPaths"
... "..."
) ")"
if_statement (+324 nodes collapsed)
if_statement (+318 nodes collapsed)
comment "// clang, unlike GCC, passes -rdynamic to the linker"
comment "// even when linking with -static, causing a linker"
comment "// error when using GNU ld. So take out -rdynamic if"
comment "// we added it. We do it in this order, rather than"
comment "// only adding -rdynamic later, so that -extldflags"
comment "// can override -rdynamic without using -static."
comment "// Similarly for -Wl,--dynamic-linker."
short_var_declaration (+98 nodes collapsed)
for_statement (+34 nodes collapsed)
comment "// When building a program with the default -buildmode=exe t"...
comment "// gc compiler generates code requires DT_TEXTREL in a"
comment "// position independent executable (PIE). On systems where t"...
comment "// toolchain creates PIEs by default, and where DT_TEXTREL"
comment "// does not work, the resulting programs will not run. See"
comment "// issue #17847. To avoid this problem pass -no-pie to the"
comment "// toolchain if it is supported."
if_statement (+119 nodes collapsed)
for_statement (+34 nodes collapsed)
if_statement (+326 nodes collapsed)
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "passLongArgsInResponseFile"
argument_list
( "("
identifier "argv"
, ","
identifier "altLinker"
) ")"
if_statement (+68 nodes collapsed)
short_var_declaration (+27 nodes collapsed)
short_var_declaration
expression_list
identifier "out"
, ","
identifier "err"
:= ":="
expression_list
call_expression
selector_expression
identifier "cmd"
. "."
field_identifier "CombinedOutput"
argument_list
( "("
) ")"
if_statement (+36 nodes collapsed)
comment "// Filter out useless linker warnings caused by bugs outside"...
comment "// See also cmd/go/internal/work/exec.go's gccld method."
var_declaration
var "var"
var_spec
identifier "save"
slice_type
[ "["
] "]"
slice_type
[ "["
] "]"
type_identifier "byte"
var_declaration
var "var"
var_spec
identifier "skipLines"
type_identifier "int"
for_statement (+128 nodes collapsed)
assignment_statement
expression_list
identifier "out"
= "="
expression_list
call_expression
selector_expression
identifier "bytes"
. "."
field_identifier "Join"
argument_list
( "("
identifier "save"
, ","
nil "nil"
) ")"
if_statement (+231 nodes collapsed)
comment "// Helper for updating a Macho binary in some way (shared be"...
comment "// dwarf combining and UUID update)."
short_var_declaration (+257 nodes collapsed)
short_var_declaration
expression_list
identifier "uuidUpdated"
:= ":="
expression_list
false "false"
if_statement (+616 nodes collapsed)
if_statement (+93 nodes collapsed)
expression_statement
call_expression
identifier "hostlinkfips"
argument_list
( "("
identifier "ctxt"
, ","
unary_expression
* "*"
identifier "flagOutfile"
, ","
unary_expression
* "*"
identifier "flagFipso"
) ")"
if_statement (+60 nodes collapsed)
} "}"
comment "// passLongArgsInResponseFile writes the arguments into a fi"...
comment "// are very long."
method_declaration (+374 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "createTrivialCOnce"
qualified_type
package_identifier "sync"
. "."
type_identifier "Once"
function_declaration (+387 nodes collapsed)
comment "// trimLinkerArgv returns a new copy of argv that does not i"...
comment "// that are not relevant for testing whether some linker opt"...
function_declaration (+541 nodes collapsed)
comment "// hostlinkArchArgs returns arguments to pass to the externa"...
comment "// based on the architecture."
function_declaration (+362 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "wantHdr"
= "="
expression_list
call_expression
selector_expression
identifier "objabi"
. "."
field_identifier "HeaderString"
argument_list
( "("
) ")"
comment "// ldobj loads an input object. If it is a host object (an o"...
comment "// compiled by a non-Go compiler) it returns the Hostobj poi"...
comment "// it is a Go object, it returns nil."
function_declaration (+1638 nodes collapsed)
comment "// symbolsAreUnresolved scans through the loader's list of u"...
comment "// symbols and checks to see whether any of them match the n"...
comment "// symbols in 'want'. Return value is a list of bools, with "...
comment "// to true if there is an unresolved reference to the symbol"...
function_declaration (+264 nodes collapsed)
comment "// hostObject reads a single host object file (compare to \"h"...
comment "// This is used as part of internal linking when we need to "...
comment "// files such as \"crt?.o\"."
function_declaration (+263 nodes collapsed)
function_declaration (+64 nodes collapsed)
function_declaration (+186 nodes collapsed)
function_declaration (+110 nodes collapsed)
function_declaration (+400 nodes collapsed)
function_declaration (+121 nodes collapsed)
function_declaration (+1682 nodes collapsed)
function_declaration (+136 nodes collapsed)
function_declaration (+49 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "SymbolType"
type_identifier "int8"
comment "// TODO: after genasmsym is gone, maybe rename to plan9typeC"...
const_declaration (+59 nodes collapsed)
comment "// defineInternal defines a symbol used internally by the go"...
method_declaration (+92 nodes collapsed)
method_declaration (+71 nodes collapsed)
function_declaration (+139 nodes collapsed)
function_declaration (+193 nodes collapsed)
method_declaration (+212 nodes collapsed)
function_declaration (+76 nodes collapsed)
function_declaration (+87 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "markKind"
type_identifier "uint8"
comment "// for postorder traversal"
const_declaration
const "const"
( "("
const_spec
identifier "_"
type_identifier "markKind"
= "="
expression_list
iota "iota"
const_spec
identifier "visiting"
const_spec
identifier "visited"
) ")"
function_declaration (+118 nodes collapsed)
function_declaration (+157 nodes collapsed)
function_declaration (+76 nodes collapsed)
function_declaration (+498 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "hostobjcounter"
type_identifier "int"
comment "// captureHostObj writes out the content of a host object (p"...
comment "// an archive or loaded from a *.o file directly) to a direc"...
comment "// specified via the linker's \"-capturehostobjs\" debugging f"...
comment "// is intended to make it easier for a developer to inspect "...
comment "// object feeding into \"CGO internal\" link step."
function_declaration (+441 nodes collapsed)
comment "// findExtLinkTool invokes the external linker CC with --pri"...
comment "// passing the name of the tool we're interested in, such as"...
comment "// \"ar\", or \"dsymutil\", and returns the path passed back fro"...
method_declaration (+195 nodes collapsed)
comment "// isMSVC reports whether the C toolchain is clang with a -m"...
comment "// e.g. the clang bundled in MSVC."
method_declaration (+191 nodes collapsed)

After

source_file
comment "// Inferno utils/8l/asm.c"
comment "// https://bitbucket.org/inferno-os/inferno-os/src/master/ut"...
comment "//"
comment "//\tCopyright © 1994-1999 Lucent Technologies Inc. All right"...
comment "//\tPortions Copyright © 1995-1997 C H Forsyth (forsyth@terza"...
comment "//\tPortions Copyright © 1997-1999 Vita Nuova Limited"
comment "//\tPortions Copyright © 2000-2007 Vita Nuova Holdings Limite"...
comment "//\tPortions Copyright © 2004,2006 Bruce Ellis"
comment "//\tPortions Copyright © 2005-2007 C H Forsyth (forsyth@terza"...
comment "//\tRevisions Copyright © 2000-2007 Lucent Technologies Inc. "...
comment "//\tPortions Copyright © 2009 The Go Authors. All rights rese"...
comment "//"
comment "// Permission is hereby granted, free of charge, to any pers"...
comment "// of this software and associated documentation files (the "...
comment "// in the Software without restriction, including without li"...
comment "// to use, copy, modify, merge, publish, distribute, sublice"...
comment "// copies of the Software, and to permit persons to whom the"...
comment "// furnished to do so, subject to the following conditions:"
comment "//"
comment "// The above copyright notice and this permission notice sha"...
comment "// all copies or substantial portions of the Software."
comment "//"
comment "// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY"...
comment "// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF M"...
comment "// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN"...
comment "// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM"...
comment "// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHE"...
comment "// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O"...
comment "// THE SOFTWARE."
package_clause
package "package"
package_identifier "ld"
import_declaration (+155 nodes collapsed)
comment "// Data layout and relocation."
comment "// Derived from Inferno utils/6l/l.h"
comment "// https://bitbucket.org/inferno-os/inferno-os/src/master/ut"...
comment "//"
comment "//\tCopyright © 1994-1999 Lucent Technologies Inc. All right"...
comment "//\tPortions Copyright © 1995-1997 C H Forsyth (forsyth@terza"...
comment "//\tPortions Copyright © 1997-1999 Vita Nuova Limited"
comment "//\tPortions Copyright © 2000-2007 Vita Nuova Holdings Limite"...
comment "//\tPortions Copyright © 2004,2006 Bruce Ellis"
comment "//\tPortions Copyright © 2005-2007 C H Forsyth (forsyth@terza"...
comment "//\tRevisions Copyright © 2000-2007 Lucent Technologies Inc. "...
comment "//\tPortions Copyright © 2009 The Go Authors. All rights rese"...
comment "//"
comment "// Permission is hereby granted, free of charge, to any pers"...
comment "// of this software and associated documentation files (the "...
comment "// in the Software without restriction, including without li"...
comment "// to use, copy, modify, merge, publish, distribute, sublice"...
comment "// copies of the Software, and to permit persons to whom the"...
comment "// furnished to do so, subject to the following conditions:"
comment "//"
comment "// The above copyright notice and this permission notice sha"...
comment "// all copies or substantial portions of the Software."
comment "//"
comment "// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY"...
comment "// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF M"...
comment "// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN"...
comment "// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM"...
comment "// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHE"...
comment "// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O"...
comment "// THE SOFTWARE."
comment "// ArchSyms holds a number of architecture specific symbols "...
comment "// relocation. Rather than allowing them universal access t"...
comment "// we keep a subset for relocation application."
type_declaration (+120 nodes collapsed)
comment "// mkArchSym is a helper for setArchSyms, to set up a specia"...
method_declaration (+72 nodes collapsed)
comment "// mkArchSymVec is similar to setArchSyms, but operates on "...
comment "// a slice, where each element corresponds to some symbol ve"...
method_declaration (+77 nodes collapsed)
comment "// setArchSyms sets up the ArchSyms structure, and must be c"...
comment "// relocations are applied."
method_declaration (+474 nodes collapsed)
type_declaration (+618 nodes collapsed)
var_declaration
var "var"
var_spec_list
( "("
var_spec
identifier "thearch"
type_identifier "Arch"
var_spec
identifier "lcSize"
type_identifier "int32"
var_spec
identifier "rpath"
type_identifier "Rpath"
var_spec
identifier "spSize"
type_identifier "int32"
var_spec
identifier "symSize"
type_identifier "int32"
) ")"
comment "// Symbol version of ABIInternal symbols. It is sym.SymVerAB"...
comment "// are used, 0 otherwise."
var_declaration
var "var"
var_spec
identifier "abiInternalVer"
= "="
expression_list
selector_expression
identifier "sym"
. "."
field_identifier "SymVerABIInternal"
comment "// DynlinkingGo reports whether we are producing Go code tha"...
comment "// in separate shared libraries linked together at runtime."
method_declaration (+72 nodes collapsed)
comment "// CanUsePlugins reports whether a plugins can be used"
method_declaration (+48 nodes collapsed)
comment "// NeedCodeSign reports whether we need to code-sign the out"...
method_declaration (+40 nodes collapsed)
var_declaration (+54 nodes collapsed)
var_declaration (+100 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "pkgdef"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "__.PKGDEF"
" "\""
var_declaration (+42 nodes collapsed)
function_declaration (+38 nodes collapsed)
comment "/*\n * Unix doesn't like it when we write to a running (or, s"...
function_declaration (+72 nodes collapsed)
function_declaration (+423 nodes collapsed)
function_declaration (+45 nodes collapsed)
function_declaration (+23 nodes collapsed)
function_declaration (+488 nodes collapsed)
comment "// extld returns the current external linker."
method_declaration (+111 nodes collapsed)
comment "// findLibPathCmd uses cmd command to find gcc library libna"...
comment "// It returns library full path if found, or \"none\" if not f"...
method_declaration (+221 nodes collapsed)
comment "// findLibPath searches for library libname."
comment "// It returns library full path if found, or \"none\" if not f"...
method_declaration (+42 nodes collapsed)
method_declaration (+1332 nodes collapsed)
comment "// loadWindowsHostArchives loads in host archives and object"...
comment "// doing internal linking on windows. Older toolchains seem "...
comment "// just a single pass through the various archives, but some"...
comment "// toolchains when linking a C program with mingw pass libra"...
comment "// multiple times to the linker, e.g. \"... -lmingwex -lmingw"...
comment "// -lmingwex -lmingw32 ...\". To accommodate this behavior, w"...
comment "// passes over the host archives below."
function_declaration (+606 nodes collapsed)
comment "// loadcgodirectives reads the previously discovered cgo dir"...
comment "// symbols in preparation for host object loading or use lat"...
method_declaration (+257 nodes collapsed)
comment "// Set up flags and special symbols depending on the platfor"...
comment "// This version works with loader.Loader."
method_declaration (+1407 nodes collapsed)
comment "// mangleTypeSym shortens the names of symbols that represen"...
comment "// if they are visible in the symbol table."
comment "//"
comment "// As the names of these symbols are derived from the string"...
comment "// the type, they can run to many kilobytes long. So we shor"...
comment "// them using a SHA-1 when the name appears in the final bin"...
comment "// This also removes characters that upset external linkers."
comment "//"
comment "// These are the symbols that begin with the prefix 'type.' "...
comment "// contain run-time type information used by the runtime and"...
comment "// packages. All Go binaries contain these symbols, but only"
comment "// those programs loaded dynamically in multiple parts need "...
comment "// symbols to have entries in the symbol table."
method_declaration (+296 nodes collapsed)
comment "// typeSymbolMangle mangles the given symbol name into somet"...
comment "//"
comment "// Keep the type:. prefix, which parts of the linker (like t"...
comment "// DWARF generator) know means the symbol is not decodable."
comment "// Leave type:runtime. symbols alone, because other parts of"
comment "// the linker manipulates them."
function_declaration (+372 nodes collapsed)
comment "/*\n * look for the next file in an archive.\n * adapted from "...
function_declaration (+305 nodes collapsed)
function_declaration (+608 nodes collapsed)
type_declaration (+52 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "hostobj"
slice_type
[ "["
] "]"
type_identifier "Hostobj"
comment "// These packages can use internal linking mode."
comment "// Others trigger external mode."
var_declaration (+80 nodes collapsed)
function_declaration (+275 nodes collapsed)
function_declaration (+224 nodes collapsed)
function_declaration (+255 nodes collapsed)
comment "// cleanTimeStamps resets the timestamps for the specified l"...
comment "// existing files to the Unix epoch (1970-01-01 00:00:00 +00"...
comment "// We take this step in order to help preserve reproducible "...
comment "// this seems to be primarily needed for external linking on"...
comment "// with later versions of xcode, which (unfortunately) seem "...
comment "// incorporate object file times into the final output file'"...
comment "// ID. See issue 64947 for the unpleasant details."
function_declaration (+89 nodes collapsed)
comment "// hostobjCopy creates a copy of the object files in hostobj"...
comment "// temporary directory."
method_declaration (+474 nodes collapsed)
comment "// writeGDBLinkerScript creates gcc linker script file in te"...
comment "// directory. writeGDBLinkerScript returns created file path"...
comment "// The script is used to work around gcc bug"
comment "// (see https://golang.org/issue/20183 for details)."
function_declaration (+100 nodes collapsed)
type_declaration (+37 nodes collapsed)
comment "// archive builds a .a archive from the hostobj object files"...
method_declaration (+504 nodes collapsed)
method_declaration
func "func"
parameter_list
( "("
parameter_declaration
identifier "ctxt"
pointer_type
* "*"
type_identifier "Link"
) ")"
field_identifier "hostlink"
parameter_list
( "("
) ")"
block
{ "{"
statement_list
if_statement (+21 nodes collapsed)
if_statement
if "if"
binary_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "BuildMode"
== "=="
identifier "BuildModeCArchive"
block
{ "{"
statement_list
return_statement
return "return"
} "}"
var_declaration
var "var"
var_spec
identifier "argv"
slice_type
[ "["
] "]"
type_identifier "string"
assignment_statement (+22 nodes collapsed)
assignment_statement (+23 nodes collapsed)
if_statement (+107 nodes collapsed)
comment "// On darwin, whether to combine DWARF into executable."
comment "// Only macOS supports unmapped segments such as our __DWARF"...
short_var_declaration (+26 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "isMSVC"
type_identifier "bool"
comment "// used on Windows"
short_var_declaration
expression_list
identifier "wlPrefix"
:= ":="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Wl,--"
" "\""
expression_switch_statement
switch "switch"
selector_expression
identifier "ctxt"
. "."
field_identifier "HeadType"
{ "{"
expression_case
case "case"
expression_list
selector_expression
identifier "objabi"
. "."
field_identifier "Hdarwin"
: ":"
statement_list
if_statement (+25 nodes collapsed)
if_statement (+52 nodes collapsed)
if_statement (+52 nodes collapsed)
if_statement
if "if"
unary_expression
* "*"
identifier "flagRace"
block
{ "{"
comment "// With https://github.com/llvm/llvm-project/pull/182943, th"...
comment "// has a weak import of __dyld_get_dyld_header, which is onl"...
comment "// newer macOS (26.4+)."
statement_list
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Wl,-U,__dyld_get_dyld_header"
" "\""
) ")"
} "}"
if_statement (+31 nodes collapsed)
expression_case (+142 nodes collapsed)
expression_case (+240 nodes collapsed)
expression_case (+77 nodes collapsed)
} "}"
comment "// On PPC64, verify the external toolchain supports Power10."...
comment "// PC relative relocations might be generated by Go. Only ta"...
comment "// binaries might generate these relocations."
if_statement (+81 nodes collapsed)
comment "// Enable/disable ASLR on Windows."
short_var_declaration (+305 nodes collapsed)
expression_switch_statement (+532 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "altLinker"
type_identifier "string"
if_statement (+49 nodes collapsed)
if_statement (+495 nodes collapsed)
if_statement (+168 nodes collapsed)
if_statement (+31 nodes collapsed)
if_statement (+110 nodes collapsed)
comment "// On Windows, given -o foo, GCC will append \".exe\" to produ"...
comment "// \"foo.exe\". We have decided that we want to honor the -o"
comment "// option. To make this work, we append a '.' so that GCC"
comment "// will decide that the file already has an extension. We"
comment "// only want to do this when producing a Windows output file"
comment "// on a Windows host."
short_var_declaration
expression_list
identifier "outopt"
:= ":="
expression_list
unary_expression
* "*"
identifier "flagOutfile"
if_statement (+53 nodes collapsed)
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "-o"
" "\""
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
identifier "outopt"
) ")"
if_statement (+44 nodes collapsed)
if_statement (+46 nodes collapsed)
comment "// Force global symbols to be exported for dlopen, etc."
expression_switch_statement (+311 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "unusedArguments"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Qunused-arguments"
" "\""
if_statement (+38 nodes collapsed)
if_statement (+66 nodes collapsed)
const_declaration
const "const"
const_spec
identifier "compressDWARF"
= "="
expression_list
interpreted_string_literal
" "\""
interpreted_string_literal_content "-Wl,--compress-debug-sections=zlib"
" "\""
if_statement (+44 nodes collapsed)
short_var_declaration
expression_list
identifier "hostObjCopyPaths"
:= ":="
expression_list
call_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "hostobjCopy"
argument_list
( "("
) ")"
expression_statement
call_expression
identifier "cleanTimeStamps"
argument_list
( "("
identifier "hostObjCopyPaths"
) ")"
short_var_declaration (+21 nodes collapsed)
expression_statement
call_expression
identifier "cleanTimeStamps"
argument_list
( "("
composite_literal
slice_type
[ "["
] "]"
type_identifier "string"
literal_value
{ "{"
literal_element
identifier "godotopath"
} "}"
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
identifier "godotopath"
) ")"
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
identifier "append"
argument_list
( "("
identifier "argv"
, ","
variadic_argument
identifier "hostObjCopyPaths"
... "..."
) ")"
if_statement (+324 nodes collapsed)
if_statement (+318 nodes collapsed)
comment "// clang, unlike GCC, passes -rdynamic to the linker"
comment "// even when linking with -static, causing a linker"
comment "// error when using GNU ld. So take out -rdynamic if"
comment "// we added it. We do it in this order, rather than"
comment "// only adding -rdynamic later, so that -extldflags"
comment "// can override -rdynamic without using -static."
comment "// Similarly for -Wl,--dynamic-linker."
short_var_declaration (+98 nodes collapsed)
for_statement (+34 nodes collapsed)
comment "// When building a program with the default -buildmode=exe t"...
comment "// gc compiler generates code requires DT_TEXTREL in a"
comment "// position independent executable (PIE). On systems where t"...
comment "// toolchain creates PIEs by default, and where DT_TEXTREL"
comment "// does not work, the resulting programs will not run. See"
comment "// issue #17847. To avoid this problem pass -no-pie to the"
comment "// toolchain if it is supported."
if_statement (+119 nodes collapsed)
for_statement (+34 nodes collapsed)
if_statement (+326 nodes collapsed)
assignment_statement
expression_list
identifier "argv"
= "="
expression_list
call_expression
selector_expression
identifier "ctxt"
. "."
field_identifier "passLongArgsInResponseFile"
argument_list
( "("
identifier "argv"
, ","
identifier "altLinker"
) ")"
if_statement (+68 nodes collapsed)
short_var_declaration (+27 nodes collapsed)
short_var_declaration
expression_list
identifier "out"
, ","
identifier "err"
:= ":="
expression_list
call_expression
selector_expression
identifier "cmd"
. "."
field_identifier "CombinedOutput"
argument_list
( "("
) ")"
if_statement (+36 nodes collapsed)
comment "// Filter out useless linker warnings caused by bugs outside"...
comment "// See also cmd/go/internal/work/exec.go's gccld method."
var_declaration
var "var"
var_spec
identifier "save"
slice_type
[ "["
] "]"
slice_type
[ "["
] "]"
type_identifier "byte"
var_declaration
var "var"
var_spec
identifier "skipLines"
type_identifier "int"
for_statement (+128 nodes collapsed)
assignment_statement
expression_list
identifier "out"
= "="
expression_list
call_expression
selector_expression
identifier "bytes"
. "."
field_identifier "Join"
argument_list
( "("
identifier "save"
, ","
nil "nil"
) ")"
if_statement (+231 nodes collapsed)
comment "// Helper for updating a Macho binary in some way (shared be"...
comment "// dwarf combining and UUID update)."
short_var_declaration (+257 nodes collapsed)
short_var_declaration
expression_list
identifier "uuidUpdated"
:= ":="
expression_list
false "false"
if_statement (+616 nodes collapsed)
if_statement (+93 nodes collapsed)
expression_statement
call_expression
identifier "hostlinkfips"
argument_list
( "("
identifier "ctxt"
, ","
unary_expression
* "*"
identifier "flagOutfile"
, ","
unary_expression
* "*"
identifier "flagFipso"
) ")"
if_statement (+60 nodes collapsed)
} "}"
comment "// passLongArgsInResponseFile writes the arguments into a fi"...
comment "// are very long."
method_declaration (+374 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "createTrivialCOnce"
qualified_type
package_identifier "sync"
. "."
type_identifier "Once"
function_declaration (+387 nodes collapsed)
comment "// trimLinkerArgv returns a new copy of argv that does not i"...
comment "// that are not relevant for testing whether some linker opt"...
function_declaration (+541 nodes collapsed)
comment "// hostlinkArchArgs returns arguments to pass to the externa"...
comment "// based on the architecture."
function_declaration (+362 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "wantHdr"
= "="
expression_list
call_expression
selector_expression
identifier "objabi"
. "."
field_identifier "HeaderString"
argument_list
( "("
) ")"
comment "// ldobj loads an input object. If it is a host object (an o"...
comment "// compiled by a non-Go compiler) it returns the Hostobj poi"...
comment "// it is a Go object, it returns nil."
function_declaration (+1638 nodes collapsed)
comment "// symbolsAreUnresolved scans through the loader's list of u"...
comment "// symbols and checks to see whether any of them match the n"...
comment "// symbols in 'want'. Return value is a list of bools, with "...
comment "// to true if there is an unresolved reference to the symbol"...
function_declaration (+264 nodes collapsed)
comment "// hostObject reads a single host object file (compare to \"h"...
comment "// This is used as part of internal linking when we need to "...
comment "// files such as \"crt?.o\"."
function_declaration (+263 nodes collapsed)
function_declaration (+64 nodes collapsed)
function_declaration (+186 nodes collapsed)
function_declaration (+110 nodes collapsed)
function_declaration (+400 nodes collapsed)
function_declaration (+121 nodes collapsed)
function_declaration (+1682 nodes collapsed)
function_declaration (+136 nodes collapsed)
function_declaration (+49 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "SymbolType"
type_identifier "int8"
comment "// TODO: after genasmsym is gone, maybe rename to plan9typeC"...
const_declaration (+59 nodes collapsed)
comment "// defineInternal defines a symbol used internally by the go"...
method_declaration (+92 nodes collapsed)
method_declaration (+71 nodes collapsed)
function_declaration (+139 nodes collapsed)
function_declaration (+193 nodes collapsed)
method_declaration (+212 nodes collapsed)
function_declaration (+76 nodes collapsed)
function_declaration (+87 nodes collapsed)
type_declaration
type "type"
type_spec
type_identifier "markKind"
type_identifier "uint8"
comment "// for postorder traversal"
const_declaration
const "const"
( "("
const_spec
identifier "_"
type_identifier "markKind"
= "="
expression_list
iota "iota"
const_spec
identifier "visiting"
const_spec
identifier "visited"
) ")"
function_declaration (+118 nodes collapsed)
function_declaration (+157 nodes collapsed)
function_declaration (+76 nodes collapsed)
function_declaration (+498 nodes collapsed)
var_declaration
var "var"
var_spec
identifier "hostobjcounter"
type_identifier "int"
comment "// captureHostObj writes out the content of a host object (p"...
comment "// an archive or loaded from a *.o file directly) to a direc"...
comment "// specified via the linker's \"-capturehostobjs\" debugging f"...
comment "// is intended to make it easier for a developer to inspect "...
comment "// object feeding into \"CGO internal\" link step."
function_declaration (+441 nodes collapsed)
comment "// findExtLinkTool invokes the external linker CC with --pri"...
comment "// passing the name of the tool we're interested in, such as"...
comment "// \"ar\", or \"dsymutil\", and returns the path passed back fro"...
method_declaration (+195 nodes collapsed)
comment "// isMSVC reports whether the C toolchain is clang with a -m"...
comment "// e.g. the clang bundled in MSVC."
method_declaration (+191 nodes collapsed)