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
25c8014e
Commit
25c8014e
authored
Dec 21, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/go: respect $GCFLAGS
R=lvd CC=golang-dev
https://golang.org/cl/5500060
parent
f52a2088
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
src/cmd/go/build.go
src/cmd/go/build.go
+10
-1
No files found.
src/cmd/go/build.go
View file @
25c8014e
...
...
@@ -139,6 +139,7 @@ type builder struct {
goos
string
// the $GOOS
gobin
string
// the $GOBIN
exe
string
// the executable suffix - "" or ".exe"
gcflags
[]
string
// additional flags for Go compiler
actionCache
map
[
cacheKey
]
*
action
// a cache of already-constructed actions
mkdirCache
map
[
string
]
bool
// a cache of created directories
...
...
@@ -202,6 +203,7 @@ func (b *builder) init(aflag, nflag, xflag bool) {
if
b
.
goos
==
"windows"
{
b
.
exe
=
".exe"
}
b
.
gcflags
=
strings
.
Fields
(
os
.
Getenv
(
"GCFLAGS"
))
b
.
arch
,
err
=
build
.
ArchChar
(
b
.
goarch
)
if
err
!=
nil
{
...
...
@@ -836,6 +838,7 @@ func mkAbs(dir, f string) string {
// to generate the named output file.
func
(
b
*
builder
)
gc
(
p
*
Package
,
ofile
string
,
gcargs
,
importArgs
[]
string
,
gofiles
[]
string
)
error
{
args
:=
[]
string
{
b
.
arch
+
"g"
,
"-o"
,
ofile
}
args
=
append
(
args
,
b
.
gcflags
...
)
args
=
append
(
args
,
gcargs
...
)
args
=
append
(
args
,
importArgs
...
)
for
_
,
f
:=
range
gofiles
{
...
...
@@ -890,7 +893,13 @@ func (b *builder) gccld(p *Package, out string, flags []string, obj []string) er
// gccCmd returns a gcc command line ending with args
func
(
b
*
builder
)
gccCmd
(
objdir
string
,
flags
[]
string
,
args
...
string
)
[]
string
{
// TODO: HOST_CC?
a
:=
[]
string
{
"gcc"
,
"-I"
,
objdir
,
"-g"
,
"-fPIC"
,
"-O2"
}
a
:=
[]
string
{
"gcc"
,
"-I"
,
objdir
,
"-g"
,
"-O2"
}
// Definitely want -fPIC but on Windows gcc complains
// "-fPIC ignored for target (all code is position independent)"
if
b
.
goos
!=
"windows"
{
a
=
append
(
a
,
"-fPIC"
)
}
switch
b
.
arch
{
case
"8"
:
a
=
append
(
a
,
"-m32"
)
...
...
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