You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mean cmd/link can't just assume locally-unused unexported symbols are globally unused.
Instead, let me refine the complaint to: since bar is unused and has no definition, cmd/link shouldn't need to complain. It should just omit defining a foo.bar symbol in the shared object.
If any later builds try to reference foo.bar, they should fail instead.
The reason this errors is because something is referencing foo.bar: the foo.bar·f structure the compiler creates. I guess that structure could use a special relocation type that causes foo.bar·f to be omitted iff the symbol the reloc points to is undefined? Maybe Ian can think of a better hack.
Create a package with a source file like:
and try to build on linux/amd64 with
-buildmode=shared
. You get a linker error:I would expect cmd/link to notice that foo.bar is unreachable and omit it from the resulting shared object.
Noticed working on https://go-review.googlesource.com/#/c/20076/.
/cc @ianlancetaylor @mwhudson
The text was updated successfully, but these errors were encountered: