mirror of
https://github.com/golang/go
synced 2024-11-11 18:51:37 -07:00
[release-branch.go1.18] misc/cgo/testcshared: handle unsuffixed dlltool path
Adapt the testcshared tests to handle the case where the path output
by invoking
gcc -print-prog-name=dlltool
is a path lacking the final ".exe" suffix (this seems to be what clang
is doing); tack it on before using if this is the case.
Updates #57704.
Fixes #57705.
Change-Id: I04fb7b9fc90677880b1ced4a4ad2a8867a3f5f86
Reviewed-on: https://go-review.googlesource.com/c/go/+/451816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 771a98d6b1
)
Reviewed-on: https://go-review.googlesource.com/c/go/+/461176
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
87105e5b2e
commit
aa0c01fb35
@ -317,10 +317,25 @@ func createHeaders() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to find dlltool path: %v\n%s\n", err, out)
|
return fmt.Errorf("unable to find dlltool path: %v\n%s\n", err, out)
|
||||||
}
|
}
|
||||||
args := []string{strings.TrimSpace(string(out)), "-D", args[6], "-l", libgoname, "-d", "libgo.def"}
|
dlltoolpath := strings.TrimSpace(string(out))
|
||||||
|
if filepath.Ext(dlltoolpath) == "" {
|
||||||
|
// Some compilers report slash-separated paths without extensions
|
||||||
|
// instead of ordinary Windows paths.
|
||||||
|
// Try to find the canonical name for the path.
|
||||||
|
if lp, err := exec.LookPath(dlltoolpath); err == nil {
|
||||||
|
dlltoolpath = lp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is an unfortunate workaround for https://github.com/mstorsjo/llvm-mingw/issues/205 in which
|
args := []string{dlltoolpath, "-D", args[6], "-l", libgoname, "-d", "libgo.def"}
|
||||||
// we basically reimplement the contents of the dlltool.sh wrapper: https://git.io/JZFlU
|
|
||||||
|
if filepath.Ext(dlltoolpath) == "" {
|
||||||
|
// This is an unfortunate workaround for
|
||||||
|
// https://github.com/mstorsjo/llvm-mingw/issues/205 in which
|
||||||
|
// we basically reimplement the contents of the dlltool.sh
|
||||||
|
// wrapper: https://git.io/JZFlU.
|
||||||
|
// TODO(thanm): remove this workaround once we can upgrade
|
||||||
|
// the compilers on the windows-arm64 builder.
|
||||||
dlltoolContents, err := os.ReadFile(args[0])
|
dlltoolContents, err := os.ReadFile(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to read dlltool: %v\n", err)
|
return fmt.Errorf("unable to read dlltool: %v\n", err)
|
||||||
@ -343,6 +358,7 @@ func createHeaders() error {
|
|||||||
args = append(args, "-m", machine)
|
args = append(args, "-m", machine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
out, err = exec.Command(args[0], args[1:]...).CombinedOutput()
|
out, err = exec.Command(args[0], args[1:]...).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user