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/compile: large unnamed struct can result in 'name too long' error at link time #4438

Closed
rsc opened this issue Nov 25, 2012 · 13 comments
Closed

Comments

@rsc
Copy link
Contributor

rsc commented Nov 25, 2012

Because we use the raw type literal in symbol names, if the result exceeds 8 kB (!),
then ld's Brdline will not be able to read the name into the Biobuf buffer, which will
make ld print 'name too long'. For enormous literals like this we need an alternate
plan, like using the sha1 sum of the type text instead.
@bradfitz
Copy link
Contributor

Comment 1:

Oh, c'mon, you can't just file this bug and not mention how you came up with an 8 kB
symbol. :)

@rsc
Copy link
Contributor Author

rsc commented Nov 26, 2012

Comment 2:

Wasn't me who did it, but how is "large unnamed struct", as it says in the description.

@rsc
Copy link
Contributor Author

rsc commented Dec 10, 2012

Comment 3:

Labels changed: added size-l.

@rsc
Copy link
Contributor Author

rsc commented Mar 12, 2013

Comment 4:

Labels changed: added go1.1maybe, removed go1.1.

@robpike
Copy link
Contributor

robpike commented May 18, 2013

Comment 5:

Labels changed: added go1.2maybe, removed go1.1maybe.

@rsc
Copy link
Contributor Author

rsc commented Sep 9, 2013

Comment 6:

Labels changed: added go1.3maybe, removed go1.2maybe.

@rsc
Copy link
Contributor Author

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor Author

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@gopherbot
Copy link

Comment 9 by renzo.toma:

I hit this bug while attempting to json.Unmarshal a large json doc to a large type
struct. Not really an edge I'd say.
Anyways I have created a 'crashme' to illustrate the bug.
$ go build name-too-long.go
# command-line-arguments
/tmp/go-build113202767/command-line-arguments.a(_go_.6): name too long
$ go version
go version go1.2.1 linux/amd64

Attachments:

  1. name-too-long.go (10847 bytes)

@minux
Copy link
Member

minux commented Jun 15, 2014

Comment 10:

Re #9, tip is much better.
$ go build ~/Downloads/name-too-long.go 
$ ./name-too-long
You will never see this, because GO cannot compile this.
$ go version
go version devel +dc25bc60c565 Sat Jun 14 23:29:20 2014 -0400 linux/amd64

@rsc rsc self-assigned this Jun 15, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: large unnamed struct can result in 'name too long' error at link time cmd/compile: large unnamed struct can result in 'name too long' error at link time Jun 8, 2015
@odeke-em
Copy link
Member

Yeah, just like @minux mentioned, @rtoma's program can now be compiled fine,
as on the playground at https://play.golang.org/p/RGuspjE9uw

@rtoma
Copy link

rtoma commented Dec 12, 2016

Wow, blast from the past.

Verified with go version go1.7.3 darwin/amd64
Thanks for fixing.

@odeke-em
Copy link
Member

@rsc or @griesemer can we close this s'il vous plait?

@robpike robpike closed this as completed Feb 23, 2017
@golang golang locked and limited conversation to collaborators Feb 23, 2018
@rsc rsc removed their assignment Jun 22, 2022
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

7 participants