return nil
}
+var wantHdr = objabi.HeaderString()
+
// ldobj loads an input object. If it is a host object (an object
// compiled by a non-Go compiler) it returns the Hostobj pointer. If
// it is a Go object, it returns nil.
}
// First, check that the basic GOOS, GOARCH, and Version match.
- t := fmt.Sprintf("%s %s %s ", buildcfg.GOOS, buildcfg.GOARCH, buildcfg.Version)
-
- line = strings.TrimRight(line, "\n")
- if !strings.HasPrefix(line[10:]+" ", t) && !*flagF {
- Errorf(nil, "%s: object is [%s] expected [%s]", pn, line[10:], t)
- return nil
- }
-
- // Second, check that longer lines match each other exactly,
- // so that the Go compiler and write additional information
- // that must be the same from run to run.
- if len(line) >= len(t)+10 {
- if theline == "" {
- theline = line[10:]
- } else if theline != line[10:] {
- Errorf(nil, "%s: object is [%s] expected [%s]", pn, line[10:], theline)
- return nil
- }
+ if line != wantHdr {
+ Errorf(nil, "%s: linked object header mismatch:\nhave %q\nwant %q\n", pn, line, wantHdr)
}
// Skip over exports and other info -- ends with \n!\n.