Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
930540ca
Commit
930540ca
authored
Feb 28, 2018
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libgo: update to final Go 1.10 release
Reviewed-on:
https://go-review.googlesource.com/97517
From-SVN: r258051
parent
5007cea3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
12 deletions
+67
-12
gcc/go/gofrontend/MERGE
+1
-1
libgo/MERGE
+1
-1
libgo/VERSION
+1
-1
libgo/go/cmd/go/internal/load/pkg.go
+1
-0
libgo/go/cmd/go/internal/work/exec.go
+10
-5
libgo/go/cmd/go/internal/work/security.go
+46
-4
libgo/go/cmd/go/internal/work/security_test.go
+7
-0
No files found.
gcc/go/gofrontend/MERGE
View file @
930540ca
8b3d6091801d485c74a9c92740c69673e39160b0
bd7fc3c85d874344b18bbb0a738ec94dfb43794b
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
libgo/MERGE
View file @
930540ca
20e228f2fdb44350c858de941dff4aea9f3127b8
bf86aec25972f3a100c3aa58a6abcbcc35bdea49
The first line of this file holds the git revision number of the
last merge done from the master library sources.
libgo/VERSION
View file @
930540ca
go1.10
rc2
go1.10
libgo/go/cmd/go/internal/load/pkg.go
View file @
930540ca
...
...
@@ -1224,6 +1224,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) {
// GNU binutils flagfile specifiers, sometimes called "response files").
// To be conservative, we reject almost any arg beginning with non-alphanumeric ASCII.
// We accept leading . _ and / as likely in file system paths.
// There is a copy of this function in cmd/compile/internal/gc/noder.go.
func
SafeArg
(
name
string
)
bool
{
if
name
==
""
{
return
false
...
...
libgo/go/cmd/go/internal/work/exec.go
View file @
930540ca
...
...
@@ -945,15 +945,20 @@ func splitPkgConfigOutput(out []byte) []string {
// Calls pkg-config if needed and returns the cflags/ldflags needed to build the package.
func
(
b
*
Builder
)
getPkgConfigFlags
(
p
*
load
.
Package
)
(
cflags
,
ldflags
[]
string
,
err
error
)
{
if
pkgs
:=
p
.
CgoPkgConfig
;
len
(
pkgs
)
>
0
{
var
pcflags
[]
string
for
len
(
pkgs
)
>
0
&&
strings
.
HasPrefix
(
pkgs
[
0
],
"--"
)
{
pcflags
=
append
(
pcflags
,
pkgs
[
0
])
pkgs
=
pkgs
[
1
:
]
}
for
_
,
pkg
:=
range
pkgs
{
if
!
load
.
SafeArg
(
pkg
)
{
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid pkg-config package name: %s"
,
pkg
)
}
}
var
out
[]
byte
out
,
err
=
b
.
runOut
(
p
.
Dir
,
p
.
ImportPath
,
nil
,
b
.
PkgconfigCmd
(),
"--cflags"
,
"--"
,
pkgs
)
out
,
err
=
b
.
runOut
(
p
.
Dir
,
p
.
ImportPath
,
nil
,
b
.
PkgconfigCmd
(),
"--cflags"
,
pcflags
,
"--"
,
pkgs
)
if
err
!=
nil
{
b
.
showOutput
(
nil
,
p
.
Dir
,
b
.
PkgconfigCmd
()
+
" --cflags "
+
strings
.
Join
(
pkgs
,
" "
),
string
(
out
))
b
.
showOutput
(
nil
,
p
.
Dir
,
b
.
PkgconfigCmd
()
+
" --cflags "
+
strings
.
Join
(
p
cflags
,
" "
)
+
strings
.
Join
(
p
kgs
,
" "
),
string
(
out
))
b
.
Print
(
err
.
Error
()
+
"
\n
"
)
return
nil
,
nil
,
errPrintedOutput
}
...
...
@@ -963,15 +968,15 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
return
nil
,
nil
,
err
}
}
out
,
err
=
b
.
runOut
(
p
.
Dir
,
p
.
ImportPath
,
nil
,
b
.
PkgconfigCmd
(),
"--libs"
,
"--"
,
pkgs
)
out
,
err
=
b
.
runOut
(
p
.
Dir
,
p
.
ImportPath
,
nil
,
b
.
PkgconfigCmd
(),
"--libs"
,
pcflags
,
"--"
,
pkgs
)
if
err
!=
nil
{
b
.
showOutput
(
nil
,
p
.
Dir
,
b
.
PkgconfigCmd
()
+
" --libs "
+
strings
.
Join
(
pkgs
,
" "
),
string
(
out
))
b
.
showOutput
(
nil
,
p
.
Dir
,
b
.
PkgconfigCmd
()
+
" --libs "
+
strings
.
Join
(
p
cflags
,
" "
)
+
strings
.
Join
(
p
kgs
,
" "
),
string
(
out
))
b
.
Print
(
err
.
Error
()
+
"
\n
"
)
return
nil
,
nil
,
errPrintedOutput
}
if
len
(
out
)
>
0
{
ldflags
=
strings
.
Fields
(
string
(
out
))
if
err
:=
checkLinkerFlags
(
"
CFLAGS"
,
"pkg-config --cflag
s"
,
ldflags
);
err
!=
nil
{
if
err
:=
checkLinkerFlags
(
"
LDFLAGS"
,
"pkg-config --lib
s"
,
ldflags
);
err
!=
nil
{
return
nil
,
nil
,
err
}
}
...
...
libgo/go/cmd/go/internal/work/security.go
View file @
930540ca
...
...
@@ -34,6 +34,7 @@ import (
"fmt"
"os"
"regexp"
"strings"
)
var
re
=
regexp
.
MustCompile
...
...
@@ -45,26 +46,42 @@ var validCompilerFlags = []*regexp.Regexp{
re
(
`-O([^@\-].*)`
),
re
(
`-W`
),
re
(
`-W([^@,]+)`
),
// -Wall but not -Wa,-foo.
re
(
`-f(no-)?blocks`
),
re
(
`-f(no-)?common`
),
re
(
`-f(no-)?constant-cfstrings`
),
re
(
`-f(no-)?exceptions`
),
re
(
`-finput-charset=([^@\-].*)`
),
re
(
`-f(no-)?lto`
),
re
(
`-f(no-)?modules`
),
re
(
`-f(no-)?objc-arc`
),
re
(
`-f(no-)?omit-frame-pointer`
),
re
(
`-f(no-)?openmp(-simd)?`
),
re
(
`-f(no-)?permissive`
),
re
(
`-f(no-)?(pic|PIC|pie|PIE)`
),
re
(
`-f(no-)?rtti`
),
re
(
`-f(no-)?split-stack`
),
re
(
`-f(no-)?stack-(.+)`
),
re
(
`-f(no-)?strict-aliasing`
),
re
(
`-fsanitize=(.+)`
),
re
(
`-g([^@\-].*)?`
),
re
(
`-m(arch|cpu|fpu|tune)=([^@\-].*)`
),
re
(
`-m(no-)?avx[0-9a-z.]*`
),
re
(
`-m(no-)?ms-bitfields`
),
re
(
`-m(no-)?stack-(.+)`
),
re
(
`-mmacosx-(.+)`
),
re
(
`-mnop-fun-dllimport`
),
re
(
`-m(no-)?sse[0-9.]*`
),
re
(
`-pedantic(-errors)?`
),
re
(
`-pipe`
),
re
(
`-pthread`
),
re
(
`-std=([^@\-].*)`
),
re
(
`-
?-
std=([^@\-].*)`
),
re
(
`-x([^@\-].*)`
),
}
var
validCompilerFlagsWithNextArg
=
[]
string
{
"-D"
,
"-I"
,
"-isystem"
,
"-framework"
,
"-x"
,
}
...
...
@@ -79,16 +96,29 @@ var validLinkerFlags = []*regexp.Regexp{
re
(
`-m(arch|cpu|fpu|tune)=([^@\-].*)`
),
re
(
`-(pic|PIC|pie|PIE)`
),
re
(
`-pthread`
),
re
(
`-?-static([-a-z0-9+]*)`
),
// Note that any wildcards in -Wl need to exclude comma,
// since -Wl splits its argument at commas and passes
// them all to the linker uninterpreted. Allowing comma
// in a wildcard would allow tunnelling arbitrary additional
// linker arguments through one of these.
re
(
`-Wl,--(no-)?as-needed`
),
re
(
`-Wl,-Bdynamic`
),
re
(
`-Wl,-Bstatic`
),
re
(
`-Wl,--disable-new-dtags`
),
re
(
`-Wl,--enable-new-dtags`
),
re
(
`-Wl,--end-group`
),
re
(
`-Wl,-framework,[^,@\-][^,]+`
),
re
(
`-Wl,-headerpad_max_install_names`
),
re
(
`-Wl,--no-undefined`
),
re
(
`-Wl,-rpath,([^,@\-][^,]+)`
),
re
(
`-Wl,-search_paths_first`
),
re
(
`-Wl,--start-group`
),
re
(
`-Wl,-?-unresolved-symbols=[^,]+`
),
re
(
`-Wl,--(no-)?warn-([^,]+)`
),
re
(
`[a-zA-Z0-9_
].*\.(
o|obj|dll|dylib|so)`
),
// direct linker inputs: x.o or libfoo.so (but not -foo.o or @foo.o)
re
(
`[a-zA-Z0-9_
/].*\.(a|
o|obj|dll|dylib|so)`
),
// direct linker inputs: x.o or libfoo.so (but not -foo.o or @foo.o)
}
var
validLinkerFlagsWithNextArg
=
[]
string
{
...
...
@@ -96,6 +126,7 @@ var validLinkerFlagsWithNextArg = []string{
"-l"
,
"-L"
,
"-framework"
,
"-Wl,-framework"
,
}
func
checkCompilerFlags
(
name
,
source
string
,
list
[]
string
)
error
{
...
...
@@ -147,10 +178,21 @@ Args:
i
++
continue
Args
}
// Permit -Wl,-framework -Wl,name.
if
i
+
1
<
len
(
list
)
&&
strings
.
HasPrefix
(
arg
,
"-Wl,"
)
&&
strings
.
HasPrefix
(
list
[
i
+
1
],
"-Wl,"
)
&&
load
.
SafeArg
(
list
[
i
+
1
][
4
:
])
&&
!
strings
.
Contains
(
list
[
i
+
1
][
4
:
],
","
)
{
i
++
continue
Args
}
if
i
+
1
<
len
(
list
)
{
return
fmt
.
Errorf
(
"invalid flag in %s: %s %s"
,
source
,
arg
,
list
[
i
+
1
])
return
fmt
.
Errorf
(
"invalid flag in %s: %s %s
(see https://golang.org/s/invalidflag)
"
,
source
,
arg
,
list
[
i
+
1
])
}
return
fmt
.
Errorf
(
"invalid flag in %s: %s without argument"
,
source
,
arg
)
return
fmt
.
Errorf
(
"invalid flag in %s: %s without argument
(see https://golang.org/s/invalidflag)
"
,
source
,
arg
)
}
}
Bad
:
...
...
libgo/go/cmd/go/internal/work/security_test.go
View file @
930540ca
...
...
@@ -132,6 +132,9 @@ var goodLinkerFlags = [][]string{
{
"-l"
,
"世界"
},
{
"-L"
,
"framework"
},
{
"-framework"
,
"Chocolate"
},
{
"-Wl,-framework"
,
"-Wl,Chocolate"
},
{
"-Wl,-framework,Chocolate"
},
{
"-Wl,-unresolved-symbols=ignore-all"
},
}
var
badLinkerFlags
=
[][]
string
{
...
...
@@ -185,6 +188,10 @@ var badLinkerFlags = [][]string{
{
"-l"
,
"-foo"
},
{
"-framework"
,
"-Caffeine"
},
{
"-framework"
,
"@Home"
},
{
"-Wl,-framework,-Caffeine"
},
{
"-Wl,-framework"
,
"-Wl,@Home"
},
{
"-Wl,-framework"
,
"@Home"
},
{
"-Wl,-framework,Chocolate,@Home"
},
{
"-x"
,
"--c"
},
{
"-x"
,
"@obj"
},
{
"-Wl,-rpath,@foo"
},
...
...
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