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

gccgo: very long gcbits symbol names #32083

Closed
Helflym opened this issue May 16, 2019 · 3 comments
Closed

gccgo: very long gcbits symbol names #32083

Helflym opened this issue May 16, 2019 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@Helflym
Copy link
Contributor

Helflym commented May 16, 2019

gccgo is generated gcbits symbols with their full name, instead of hidding them under gcbits..* like Go toolchain is doing (cf https://go-review.googlesource.com/c/go/+/12531/).
Corresponding Go issue #11583

$ nm index0-out.o | grep gcbits  
...
gcbits..bazaaaaaaaamaaa... (average 100 000 a... )
...

On AIX, symbol names are limited to 65535 characters.
Therefore, test "./index0-out.go compilation" is failing:

ld: 0711-950 ERROR: A name is too long.
        Names longer than 65535 characters are truncated.
        The name begins: gcbits..bazaaaaaaaamaaaaaaaaaaaaaaaaaaaaaaaaa
ld: 0711-950 ERROR: A name is too long.
        Names longer than 65535 characters are truncated.
        The name begins: gcbits..bazaaaaaaaamaaaaaaaaaaaaaaaaaaaaaaaaa
collect2: error: ld returned 8 exit status
compiler exited with status 1

Is there any way to reduce/hide these symbol names as it's done under Go toolchain ?
I don't think such thing can actually occur in a "real" Go code, but that might be worth fixing it once for all.

/cc @ianlancetaylor @thanm

@gopherbot gopherbot added this to the Gccgo milestone May 16, 2019
@thanm
Copy link
Contributor

thanm commented May 16, 2019

Could you please post the code in question, or some sort of source reproducer? Thanks.

@Helflym
Copy link
Contributor Author

Helflym commented May 16, 2019

index0-out.zip

This index0-out.go is generated inside gccgo testsuite (under gcc/testsuite/go.test/test) by index0.go and index.go.

@thanm thanm self-assigned this May 16, 2019
@gopherbot
Copy link

Change https://golang.org/cl/177598 mentions this issue: compiler: use SHA1-hash for symname for long gcbits symbols

@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label May 17, 2019
kraj pushed a commit to kraj/gcc that referenced this issue May 17, 2019
    
    The current scheme used by the compiler for "gcbits" symbols involves
    generating a symbol name based on a 32-char encoding of the bits data.
    This scheme works well in most cases but can generate very long symbol
    names in rare cases. To help avoid such long symbol names, switch to a
    different encoding scheme based on the SHA1 digest of the payload if
    the symbol size would be too large.
    
    Fixes golang/go#32083.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/177598


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271322 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators May 16, 2020
@rsc rsc unassigned thanm 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

4 participants