Skip to content
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

cmd/link: records absolute working directory in binary #22311

Closed
aclements opened this issue Oct 17, 2017 · 2 comments
Closed

cmd/link: records absolute working directory in binary #22311

aclements opened this issue Oct 17, 2017 · 2 comments
Labels
Debugging FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@aclements
Copy link
Member

The linker records the result of os.Getwd() in the DWARF compilation unit's DW_AT_comp_dir attribute. This is almost certainly wrong since we've been working to keep information like this out of the binary (for example, it's not affected by -trimpath). It's also additionally wrong because it records the linker's working directory, where it's supposed to record the compiler's working directory [1].

It would be nice if we could just omit it, but there's a comment in writelines that says "OS X linker requires compilation dir or absolute path in comp unit name to output debug info." We could perhaps always make the value "/". Or perhaps we could use the package's source directory (with -trimpath applied).

[1] DWARF4: A DW_AT_comp_dir attribute whose value is a null-terminated string containing the current
working directory of the compilation command that produced this compilation unit in
whatever form makes sense for the host system. See also @thanm's comment.

/cc @rsc @thanm

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 29, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Mar 29, 2018
@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 23, 2018
@ianlancetaylor
Copy link
Contributor

CC @heschik

@ianlancetaylor ianlancetaylor modified the milestones: Go1.12, Go1.13 Dec 7, 2018
@heschi
Copy link
Contributor

heschi commented Dec 7, 2018

Oh, this is an old bug. It's hardcoded to . now.

func getCompilationDir() string {

@heschi heschi closed this as completed Dec 7, 2018
@golang golang locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debugging FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants