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/pack: restore P flag functionality #6989

Closed
rsc opened this issue Dec 19, 2013 · 4 comments
Closed

cmd/pack: restore P flag functionality #6989

rsc opened this issue Dec 19, 2013 · 4 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Dec 19, 2013

The new object file has made the pack P flag (remove prefix from path names) not work
anymore. We need to make it work again, either using pack or using some other tool. The
new format will make the code much simpler.
@robpike
Copy link
Contributor

robpike commented Jan 31, 2014

Comment 1:

For easy reference, here is the text from the Go 1.2 docs for pack:
Command pack
Pack is a variant of the Plan 9 ar tool. The original is documented at
http://plan9.bell-labs.com/magic/man2html/1/ar
It adds a special Go-specific section __.PKGDEF that collects all the Go type
information from the files in the archive; that section is used by the compiler when
importing the package during compilation.
Usage:
go tool pack [uvnbailogS][mrxtdpq][P prefix] archive files ...
The new option 'g' causes pack to maintain the __.PKGDEF section as files are added to
the archive.
The new option 'S' forces pack to mark the archive as safe.
The new option 'P' causes pack to remove the given prefix from file names in the line
number information in object files that are already stored in or added to the archive.

@rsc
Copy link
Contributor Author

rsc commented Apr 16, 2014

Comment 3:

The pack P flag removed a leading directory prefix from all file names referred to in
the pcln table.
For example if you were working in /usr/rsc/go/foo and you used pack grcP /usr/rsc, the
path normally referred to as /usr/rsc/go/foo/x.go would be recorded as go/foo/x.go. This
is useful for removing temporary paths from the binary, so that repeated builds produce
byte-for-byte identical outputs.
We need this functionality, but probably not in pack. We've arranged so that pack is not
necessary for most packages: 6g writes out .a files directly, and 'go' appends other
supporting files directly too. There is no invocation of pack during make.bash, for
example. Putting the P functionality into pack would require invoking pack again. The
theory behind not invoking pack is that instead of using pack to convert to the format
you want, you can save an I/O round if you make the original writer write out the format
you want in the first place. This suggests that the P functionality should be in 6a, 6c,
and 6g instead.
CL 88300045 does this.

Status changed to Started.

@gopherbot
Copy link

Comment 4:

CL https://golang.org/cl/88300045 mentions this issue.

@rsc
Copy link
Contributor Author

rsc commented Apr 16, 2014

Comment 5:

This issue was closed by revision e97b3ab.

Status changed to Fixed.

@rsc rsc added fixed labels Apr 16, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants