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: possible oversight with internal/gc.disableExport #31049
Comments
Thanks @odeke-em , but I believe it's correct as-is. The OnExportList flag is used by exportsym to avoid adding a symbol to exportlist if it's already been added: go/src/cmd/compile/internal/gc/export.go Lines 27 to 32 in 0ec302c
The way disableExport works is that it sets OnExportList before exportsym is called, so that exportsym thinks the symbol has already been added to exportlist and avoids adding it again. |
Thanks for the reply @mdempsky! Perhaps let's rename that helper function to Perhaps let's think of a different marking naming, because |
Cool, thanks @josharian I've made the suggestion at #27167 (comment) and with that I'll close this issue. Thank you @mdempsky for the response too. |
I was just studying closure.go and noticed that we invoke disableExport(sym) for closures created.
The signature for disableExport says
go/src/cmd/compile/internal/gc/dcl.go
Lines 1005 to 1006 in 0ec302c
However, in the body of disableExport we see that we invoke
sym.SetOnExportList(true)
which toggles the symbol to be exported as per
go/src/cmd/compile/internal/types/sym.go
Line 55 in 0ec302c
This change is from CL 108216
I believe it should be
sym.SetOnExportList(false)
The bug only doesn't show because when creating object files we explicitly check that names are exported as per
go/src/cmd/compile/internal/gc/export.go
Lines 56 to 58 in 0ec302c
otherwise if you add debugs you'll see that we encounter closure symbols such as
"".bar.func1
Kindly paging @mdempsky @griesemer
The text was updated successfully, but these errors were encountered: