1
0
mirror of https://github.com/golang/go synced 2024-11-05 19:56:11 -07:00

cmd/link: more cleanups for visibility hidden symbol handling

CL 404296 removes the hidden visibility checks, but a few of them
were left. Remove them as well.

Change-Id: Idbcf37429709c91403803d32684239d398e43543
Reviewed-on: https://go-review.googlesource.com/c/go/+/404303
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Mui 2022-05-06 16:05:06 -04:00
parent 4d716e4d4a
commit 508cb32d4b
3 changed files with 3 additions and 7 deletions

View File

@ -215,7 +215,7 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
rst = ldr.SymType(rs)
}
if rs != 0 && ((rst == sym.Sxxx && !ldr.AttrVisibilityHidden(rs)) || rst == sym.SXREF) {
if rs != 0 && (rst == sym.Sxxx || rst == sym.SXREF) {
// When putting the runtime but not main into a shared library
// these symbols are undefined and that's OK.
if target.IsShared() || target.IsPlugin() {

View File

@ -111,9 +111,7 @@ func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loade
if targType == sym.SDYNIMPORT {
ldr.Errorf(s, "unexpected R_390_PCnn relocation for dynamic symbol %s", ldr.SymName(targ))
}
// TODO(mwhudson): the test of VisibilityHidden here probably doesn't make
// sense and should be removed when someone has thought about it properly.
if (targType == 0 || targType == sym.SXREF) && !ldr.AttrVisibilityHidden(targ) {
if targType == 0 || targType == sym.SXREF {
ldr.Errorf(s, "unknown symbol %s in pcrel", ldr.SymName(targ))
}
su := ldr.MakeSymbolUpdater(s)

View File

@ -147,9 +147,7 @@ func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loade
if targType == sym.SDYNIMPORT {
ldr.Errorf(s, "unexpected R_386_PC32 relocation for dynamic symbol %s", ldr.SymName(targ))
}
// TODO(mwhudson): the test of VisibilityHidden here probably doesn't make
// sense and should be removed when someone has thought about it properly.
if (targType == 0 || targType == sym.SXREF) && !ldr.AttrVisibilityHidden(targ) {
if targType == 0 || targType == sym.SXREF {
ldr.Errorf(s, "unknown symbol %s in pcrel", ldr.SymName(targ))
}
su := ldr.MakeSymbolUpdater(s)