-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go, cmd/link: don't handle GOROOT_FINAL in linker #36118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Change https://golang.org/cl/210943 mentions this issue: |
I don't quite see how we can replace |
Are there still any platforms for which |
When I opened this issue, I was just thinking about how the linker expands
For the purpose of setting the default |
I don't know if anybody really uses |
GOROOT_FINAL has been removed following #62047 and the code mentioned now uses the GOROOT as configured. |
GOROOT_FINAL
is used to set the final location ofGOROOT
when building the toolchain and standard library.When the compiler or assembler parse a file, they store file names and columns on AST nodes. If the file name is in
GOROOT
, theGOROOT
path is replaced with the literal$GOROOT
. This is done incmd/internal/objabi.AbsFile
. These file names eventually end up in debug data.The linker expands these strings, replacing
$GOROOT
with the actualGOROOT
orGOROOT_FINAL
if that's set. This is done incmd/link/internal/ld.expandGoroot
.We should avoid special handling for
GOROOT_FINAL
in the linker. Instead we should more unified support for-trimpath
.-trimpath
is given to thego
command, all source paths in output files (including compiled .a files and intermediate generated cgo files) should be derived from package paths the same way.-trimpath
flags with the same format and meaning. They should not have special handling forGOROOT
paths.GOROOT_FINAL
is set when thego
command builds a package inGOROOT
, an appropriate-trimpath
flag should be given to the compiler, assembler, and cgo.The text was updated successfully, but these errors were encountered: