Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
7171f533
Commit
7171f533
authored
Nov 23, 2012
by
Shenghou Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/go: fix data race on cgoLibGccFile
Fixes #4426. R=dvyukov CC=golang-dev
https://golang.org/cl/6851099
parent
f142deee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
src/cmd/go/build.go
src/cmd/go/build.go
+13
-6
No files found.
src/cmd/go/build.go
View file @
7171f533
...
...
@@ -1478,7 +1478,7 @@ func gccgoCleanPkgpath(p *Package) string {
func
(
b
*
builder
)
libgcc
(
p
*
Package
)
(
string
,
error
)
{
f
,
err
:=
b
.
runOut
(
p
.
Dir
,
p
.
ImportPath
,
b
.
gccCmd
(
p
.
Dir
),
"-print-libgcc-file-name"
)
if
err
!=
nil
{
return
""
,
nil
return
""
,
fmt
.
Errorf
(
"gcc -print-libgcc-file-name: %v (%s)"
,
err
,
f
)
}
return
strings
.
Trim
(
string
(
f
),
"
\r\n
"
),
nil
}
...
...
@@ -1542,7 +1542,10 @@ func envList(key string) []string {
var
cgoRe
=
regexp
.
MustCompile
(
`[/\\:]`
)
var
cgoLibGccFile
string
var
(
cgoLibGccFile
string
cgoLibGccFileOnce
sync
.
Once
)
func
(
b
*
builder
)
cgo
(
p
*
Package
,
cgoExe
,
obj
string
,
gccfiles
[]
string
)
(
outGo
,
outObj
[]
string
,
err
error
)
{
if
goos
!=
toolGOOS
{
...
...
@@ -1633,13 +1636,17 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
bareLDFLAGS
=
append
(
bareLDFLAGS
,
f
)
}
}
if
cgoLibGccFile
==
""
{
var
err
error
cgoLibGccFileOnce
.
Do
(
func
()
{
cgoLibGccFile
,
err
=
b
.
libgcc
(
p
)
if
err
!=
nil
{
return
nil
,
nil
,
err
})
if
cgoLibGccFile
==
""
{
if
err
==
nil
{
err
=
errors
.
New
(
"failed to get libgcc filename"
)
}
return
nil
,
nil
,
err
}
var
staticLibs
[]
string
if
goos
==
"windows"
{
// libmingw32 and libmingwex might also use libgcc, so libgcc must come last
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment