[dev.link] cmd: convert symbol "shared" flag to object file flag

For the new object file format, don't tag individual symbols with a
"shared" flag, since that characteristic is better off as an attribute
of the containing object file as opposed to the individual symbol. Add
a new flags field in the object file header and put a bit in the flags
if the shared flags is in effect during compilation.

Change-Id: I2cf6d33bf7bf2fd8a7614ae0cd6ef03914777498
Reviewed-on: https://go-review.googlesource.com/c/go/+/201398
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Than McIntosh 2019-10-16 08:54:58 -04:00
parent 2bbf2e0233
commit 15634a0230
3 changed files with 24 additions and 10 deletions

View file

@ -56,7 +56,8 @@ type Reloc struct {
type oReader struct {
*goobj2.Reader
unit *sym.CompilationUnit
version int // version of static symbol
version int // version of static symbol
flags uint32 // read from object file
pkgprefix string
}
@ -460,7 +461,7 @@ func (l *Loader) Preload(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *
}
localSymVersion := syms.IncVersion()
pkgprefix := objabi.PathToPrefix(lib.Pkg) + "."
or := &oReader{r, unit, localSymVersion, pkgprefix}
or := &oReader{r, unit, localSymVersion, r.Flags(), pkgprefix}
// Autolib
lib.ImportStrings = append(lib.ImportStrings, r.Autolib()...)
@ -770,7 +771,7 @@ func loadObjFull(l *Loader, r *oReader) {
if osym.ReflectMethod() {
s.Attr |= sym.AttrReflectMethod
}
if osym.Shared() {
if r.Flags()&goobj2.ObjFlagShared != 0 {
s.Attr |= sym.AttrShared
}
if osym.TopFrame() {