ofile = obj + out
gcargs := []string{"-g"}
gcargs = append(gcargs, b.gccArchArgs()...)
+ gcargs = append(gcargs, "-fdebug-prefix-map="+b.work+"=/tmp/go-build")
+ gcargs = append(gcargs, "-gno-record-gcc-switches")
if pkgpath := gccgoPkgpath(p); pkgpath != "" {
gcargs = append(gcargs, "-fgo-pkgpath="+pkgpath)
}
for _, path := range p.Imports {
// If this is a new vendor path, add it to the list of importArgs
- if i := strings.LastIndex(path, "/vendor"); i >= 0 {
+ if i := strings.LastIndex(path, "/vendor/"); i >= 0 {
for _, dir := range savedirs {
// Check if the vendor path is already included in dir
- if strings.HasSuffix(dir, path[:i+len("/vendor")]) {
+ if strings.HasSuffix(dir, path[:i+len("/vendor/")]) {
continue
}
// Make sure this vendor path is not already in the list for importArgs
- vendorPath := dir + "/" + path[:i+len("/vendor")]
+ vendorPath := dir + "/" + path[:i+len("/vendor/")]
for _, imp := range importArgs {
if imp == "-I" {
continue
for _, f := range ofiles {
absOfiles = append(absOfiles, mkAbs(objDir, f))
}
- return b.run(p.Dir, p.ImportPath, nil, "ar", "rc", mkAbs(objDir, afile), absOfiles)
+ absAfile := mkAbs(objDir, afile)
+ // Try with D modifier first, then without if that fails.
+ if b.run(p.Dir, p.ImportPath, nil, "ar", "rcD", absAfile, absOfiles) != nil {
+ return b.run(p.Dir, p.ImportPath, nil, "ar", "rc", absAfile, absOfiles)
+ }
+ return nil
}
func (tools gccgoToolchain) link(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string, buildmode, desc string) error {
defs = append(defs, "-fsplit-stack")
}
defs = tools.maybePIC(defs)
+ if b.gccSupportsFlag("-fdebug-prefix-map=a=b") {
+ defs = append(defs, "-fdebug-prefix-map="+b.work+"=/tmp/go-build")
+ }
+ if b.gccSupportsFlag("-gno-record-gcc-switches") {
+ defs = append(defs, "-gno-record-gcc-switches")
+ }
return b.run(p.Dir, p.ImportPath, nil, envList("CC", defaultCC), "-Wall", "-g",
"-I", objdir, "-I", inc, "-o", ofile, defs, "-c", cfile)
}