[gcc-6] 64/401: - update pr66904

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:48:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible_builds
in repository gcc-6.

commit f2e97e655569c7982f2de3e9cdf60c1905f9e10d
Author: doko <doko at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Fri Jan 29 07:48:53 2016 +0000

    - update pr66904
    
    
    git-svn-id: svn://anonscm.debian.org/gcccvs/branches/sid/gcc-6@8631 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/patches/pr66904.diff | 111 ++++++++++++++++++++++++++++++--------------
 1 file changed, 77 insertions(+), 34 deletions(-)

diff --git a/debian/patches/pr66904.diff b/debian/patches/pr66904.diff
index 5a4af61..ac86b7d 100644
--- a/debian/patches/pr66904.diff
+++ b/debian/patches/pr66904.diff
@@ -27,7 +27,7 @@ Date:   Thu Jan 21 14:53:55 2016 +1300
 
 --- a/src/libgo/go/cmd/go/build.go
 +++ a/src/libgo/go/cmd/go/build.go
-@@ -1437,6 +1437,9 @@ func (b *builder) build(a *action) (err error) {
+@@ -1327,6 +1327,9 @@ func (b *builder) build(a *action) (err error) {
  		if err != nil {
  			return err
  		}
@@ -37,7 +37,64 @@ Date:   Thu Jan 21 14:53:55 2016 +1300
  		cgoObjects = append(cgoObjects, outObj...)
  		gofiles = append(gofiles, outGo...)
  	}
-@@ -2610,6 +2613,7 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
+@@ -2480,12 +2483,64 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
+ 	cxx := len(root.p.CXXFiles) > 0 || len(root.p.SwigCXXFiles) > 0
+ 	objc := len(root.p.MFiles) > 0
+ 
++	readCgoFlags := func(flagsFile string) error {
++		flags, err := ioutil.ReadFile(flagsFile)
++		if err != nil {
++			return err
++		}
++		for _, line := range strings.Split(string(flags), "\n") {
++			if strings.HasPrefix(line, "_CGO_LDFLAGS=") {
++				cgoldflags = append(cgoldflags, strings.Fields(line[13:])...)
++			}
++		}
++		return nil
++	}
++
++	readAndRemoveCgoFlags := func(archive string) (string, error) {
++		newa, err := ioutil.TempFile(b.work, filepath.Base(archive))
++		if err != nil {
++			return "", err
++		}
++		olda, err := os.Open(archive)
++		if err != nil {
++			return "", err
++		}
++		_, err = io.Copy(newa, olda)
++		if err != nil {
++			return "", err
++		}
++		err = olda.Close()
++		if err != nil {
++			return "", err
++		}
++		err = newa.Close()
++		if err != nil {
++			return "", err
++		}
++
++		newarchive := newa.Name()
++		err = b.run(b.work, root.p.ImportPath, nil, "ar", "x", newarchive, "_cgo_flags")
++		if err != nil {
++			return "", err
++		}
++		err = b.run(".", root.p.ImportPath, nil, "ar", "d", newarchive, "_cgo_flags")
++		if err != nil {
++			return "", err
++		}
++		err = readCgoFlags(filepath.Join(b.work, "_cgo_flags"))
++		if err != nil {
++			return "", err
++		}
++		return newarchive, nil
++	}
++
+ 	actionsSeen := make(map[*action]bool)
+ 	// Make a pre-order depth-first traversal of the action graph, taking note of
+ 	// whether a shared library action has been seen on the way to an action (the
  	// construction of the graph means that if any path to a node passes through
  	// a shared library action, they all do).
  	var walk func(a *action, seenShlib bool)
@@ -45,45 +102,16 @@ Date:   Thu Jan 21 14:53:55 2016 +1300
  	walk = func(a *action, seenShlib bool) {
  		if actionsSeen[a] {
  			return
-@@ -2628,16 +2632,52 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
+@@ -2504,16 +2559,23 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
  			// doesn't work.
  			if !apackagesSeen[a.p] {
  				apackagesSeen[a.p] = true
 +				target := a.target
 +				if len(a.p.CgoFiles) > 0 {
-+					newa, err := ioutil.TempFile(b.work, filepath.Base(target))
-+					if err != nil {
-+						return
-+					}
-+					olda, err := os.Open(target)
-+					if err != nil {
-+						return
-+					}
-+					_, err = io.Copy(newa, olda)
-+					if err != nil {
-+						return
-+					}
-+					err = olda.Close()
++					target, err = readAndRemoveCgoFlags(target)
 +					if err != nil {
 +						return
 +					}
-+					err = newa.Close()
-+					if err != nil {
-+						return
-+					}
-+
-+					target = newa.Name()
-+					err = b.run(b.work, root.p.ImportPath, nil, "ar", "x", target, "_cgo_flags")
-+					err = b.run(".", root.p.ImportPath, nil, "ar", "d", target, "_cgo_flags")
-+					flags, err := ioutil.ReadFile(filepath.Join(b.work, "_cgo_flags"))
-+					if err != nil {
-+						return
-+					}
-+					for _, line := range strings.Split(string(flags), "\n") {
-+						if strings.HasPrefix(line, "_CGO_LDFLAGS=") {
-+							cgoldflags = append(cgoldflags, strings.Fields(line[13:])...)
-+						}
-+					}
 +				}
  				if a.p.fake && a.p.external {
  					// external _tests, if present must come before
@@ -101,7 +129,7 @@ Date:   Thu Jan 21 14:53:55 2016 +1300
  				}
  			}
  		}
-@@ -2647,10 +2687,16 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
+@@ -2523,10 +2585,16 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
  		}
  		for _, a1 := range a.deps {
  			walk(a1, seenShlib)
@@ -118,3 +146,18 @@ Date:   Thu Jan 21 14:53:55 2016 +1300
  	}
  	afiles = append(xfiles, afiles...)
  
+@@ -2555,6 +2623,14 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions
+ 		}
+ 	}
+ 
++	for i, o := range ofiles {
++		if filepath.Base(o) == "_cgo_flags" {
++			readCgoFlags(o)
++			ofiles = append(ofiles[:i], ofiles[i+1:]...)
++			break
++		}
++	}
++
+ 	ldflags = append(ldflags, "-Wl,--whole-archive")
+ 	ldflags = append(ldflags, afiles...)
+ 	ldflags = append(ldflags, "-Wl,--no-whole-archive")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gcc-6.git



More information about the Reproducible-commits mailing list