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: make code more readable #16818

Closed
matloob opened this issue Aug 21, 2016 · 7 comments
Closed

cmd/link: make code more readable #16818

matloob opened this issue Aug 21, 2016 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@matloob
Copy link
Contributor

matloob commented Aug 21, 2016

I'd like to clean up cmd/link and help improve its Go style.

A few things I'd like to do:

  • Remove a bunch of the global variables, especially Ctxt
  • Reverse the dependency between the ld package and the architecture specific packages.
  • Localize more of the state to smaller components
@matloob matloob self-assigned this Aug 21, 2016
@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Aug 21, 2016
This change threads the *ld.Link Ctxt variable through
code in arch-specific packages. This removes all remaining
uses of Ctxt, so remove the global variable too.

This CL continues the work in golang.org/cl/27408

Updates #16818

Change-Id: I5f4536847a1825fd0b944824e8ae4e122ec0fb78
Reviewed-on: https://go-review.googlesource.com/27459
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 21, 2016
Bso is already a member on ld.Link. Use that instead of
the global.

Updates #16818

Change-Id: Icfc0f6cb1ff551e8129253fb6b5e0d6a94479f51
Reviewed-on: https://go-review.googlesource.com/27470
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

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

@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Aug 21, 2016
The obj library's flag functions are (mostly) light wrappers
around the standard library flag package. Use the flag package
directly where possible.

Most uses of the 'count'-type flags (except for -v) only check
against 0, so they can safely be replaced by bools. Only -v
and the flagfns haven't been replaced.

Debug has been turned into a slice of bools rather than ints.
There was a copy of the -v verbosity in ctxt.Debugvlog, so don't use
Debug['v'] and just use ctxt.Debugvlog.

Updates #16818

Change-Id: Icf6473a4823c9d35513bbd0c34ea02d5676d782a
Reviewed-on: https://go-review.googlesource.com/27471
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
gopherbot pushed a commit that referenced this issue Aug 21, 2016
The only thing pobj contains is the Ldmain function.

Updates #16818

Change-Id: Id114bdb264cb5ea2f372eb2166201f1f8eb99445
Reviewed-on: https://go-review.googlesource.com/27472
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Aug 22, 2016
This moves many of the flag globals into main and assigns them
to their flag.String/Int64/... directly.

Updates #16818

Change-Id: Ibbff44a273bbc5cb7228e43f147900ee8848517f
Reviewed-on: https://go-review.googlesource.com/27473
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Aug 23, 2016
I've also unexported a few symbols that weren't used outside the
package.

Updates #16818

Change-Id: I39d9d87b3eec30b88b4a17c1333cfbbfa6b3518f
Reviewed-on: https://go-review.googlesource.com/27468
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@quentinmit quentinmit added this to the Go1.8 milestone Sep 6, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 7, 2016
@rsc rsc modified the milestones: Unplanned, Go1.8 Oct 25, 2016
@agnivade
Copy link
Contributor

agnivade commented Jun 8, 2019

@matloob - Can you post an update here on what are the things pending on this so that others can pick this up if they want to ?

@matloob
Copy link
Contributor Author

matloob commented Jan 7, 2021

This is totally obsolete, closing.

@matloob matloob closed this as completed Jan 7, 2021
@golang golang locked and limited conversation to collaborators Jan 7, 2022
@rsc rsc unassigned matloob Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants