// fake root DIE for compile unit DIEs
var dwroot dwarf.DWDie
+ flagVariants := make(map[string]bool)
for _, lib := range ctxt.Library {
unit := &compilationUnit{lib: lib}
// version, so it should be safe for readers to scan
// forward to the semicolon.
producer += "; " + string(producerExtra.P)
+ flagVariants[string(producerExtra.P)] = true
+ } else {
+ flagVariants[""] = true
}
+
newattr(unit.dwinfo, dwarf.DW_AT_producer, dwarf.DW_CLS_STRING, int64(len(producer)), producer)
if len(lib.Textp) == 0 {
}
}
+ // Fix for 31034: if the objects feeding into this link were compiled
+ // with different sets of flags, then don't issue an error if
+ // the -strictdups checks fail.
+ if checkStrictDups > 1 && len(flagVariants) > 1 {
+ checkStrictDups = 1
+ }
+
// Create DIEs for global variables and the types they use.
genasmsym(ctxt, defdwsymb)
nerrors int
liveness int64
+
+ // See -strictdups command line flag.
+ checkStrictDups int // 0=off 1=warning 2=error
+ strictDupMsgCount int
)
var (
if nerrors != 0 {
Exit(2)
}
+ if checkStrictDups > 1 && strictDupMsgCount > 0 {
+ Exit(2)
+ }
Exit(0)
}
default:
log.Fatalf("invalid -strictdups flag value %d", *FlagStrictDups)
}
- objfile.Load(ctxt.Arch, ctxt.Syms, f, lib, eof-f.Offset(), pn, flags)
+ c := objfile.Load(ctxt.Arch, ctxt.Syms, f, lib, eof-f.Offset(), pn, flags)
+ strictDupMsgCount += c
addImports(ctxt, lib, pn)
return nil
}
if objabi.Fieldtrack_enabled != 0 {
ctxt.Reachparent = make(map[*sym.Symbol]*sym.Symbol)
}
+ checkStrictDups = *FlagStrictDups
startProfile()
if ctxt.BuildMode == BuildModeUnset {
dupSym *sym.Symbol
localSymVersion int
flags int
+ strictDupMsgs int
// rdBuf is used by readString and readSymName as scratch for reading strings.
rdBuf []byte
// Load loads an object file f into library lib.
// The symbols loaded are added to syms.
-func Load(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, length int64, pn string, flags int) {
+func Load(arch *sys.Arch, syms *sym.Symbols, f *bio.Reader, lib *sym.Library, length int64, pn string, flags int) int {
start := f.Offset()
r := &objReader{
rd: f.Reader,
if f.Offset() != start+length {
log.Fatalf("%s: unexpected end at %d, want %d", pn, f.Offset(), start+length)
}
+ return r.strictDupMsgs
}
func (r *objReader) loadObjFile() {
// params; I am guessing that the pos is being inherited
// from the spot where the wrapper is needed.
whitelist := strings.HasPrefix(dup.Name, "go.info.go.interface")
-
- if r.flags&StrictDupsErrFlag != 0 && !whitelist {
- log.Fatalf("failed duplicate symbol check on '%s' reading %s", dup.Name, r.pn)
+ if !whitelist {
+ r.strictDupMsgs++
}
}
}