Skip to content

Commit

Permalink
cmd/link: fix SCONST symbol handling on darwin
Browse files Browse the repository at this point in the history
Don't include SCONST symbols in the symbol table when
NotInSymbolTable is set. This is what the old code (genasmsym)
does.

In fact, SCONST symbol is only emitted by the field tracking
code, and is always NotInSymbolTable. So we should just not
include them at all, or not generate SCONST symbols at all. But
at this late stage I'll just restore the old behavior.

Change-Id: If6843003e16701d45b8c67b2297098a7babdec52
Reviewed-on: https://go-review.googlesource.com/c/go/+/233997
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
cherrymui committed May 14, 2020
1 parent 796786c commit 1f325af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/link/internal/ld/macho.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ func collectmachosyms(ctxt *Link) {
continue
}
t := ldr.SymType(s)
if t >= sym.SELFRXSECT && t < sym.SXREF { // data sections handled in dodata
if t >= sym.SELFRXSECT && t < sym.SXREF || t == sym.SCONST { // data sections handled in dodata
if t == sym.STLSBSS {
// TLSBSS is not used on darwin. See data.go:allocateDataSections
continue
Expand All @@ -810,7 +810,7 @@ func collectmachosyms(ctxt *Link) {
}

switch t {
case sym.SDYNIMPORT, sym.SHOSTOBJ, sym.SUNDEFEXT, sym.SCONST:
case sym.SDYNIMPORT, sym.SHOSTOBJ, sym.SUNDEFEXT:
addsym(s)
}

Expand Down

0 comments on commit 1f325af

Please sign in to comment.