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
4881e774
Commit
4881e774
authored
Jun 07, 2011
by
Dave Cheney
Committed by
Andrew Gerrand
Jun 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgo: support non intel gcc machine flags
R=adg CC=golang-dev
https://golang.org/cl/4528124
parent
5e03143c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
src/cmd/cgo/gcc.go
src/cmd/cgo/gcc.go
+11
-7
No files found.
src/cmd/cgo/gcc.go
View file @
4881e774
...
...
@@ -660,11 +660,14 @@ func (p *Package) gccName() (ret string) {
}
// gccMachine returns the gcc -m flag to use, either "-m32" or "-m64".
func
(
p
*
Package
)
gccMachine
()
string
{
if
p
.
PtrSize
==
8
{
return
"-m64"
}
return
"-m32"
func
(
p
*
Package
)
gccMachine
()
[]
string
{
switch
runtime
.
GOARCH
{
case
"amd64"
:
return
[]
string
{
"-m64"
}
case
"386"
:
return
[]
string
{
"-m32"
}
}
return
nil
}
const
gccTmp
=
"_obj/_cgo_.o"
...
...
@@ -674,7 +677,6 @@ const gccTmp = "_obj/_cgo_.o"
func
(
p
*
Package
)
gccCmd
()
[]
string
{
c
:=
[]
string
{
p
.
gccName
(),
p
.
gccMachine
(),
"-Wall"
,
// many warnings
"-Werror"
,
// warnings are errors
"-o"
+
gccTmp
,
// write object to tmp
...
...
@@ -684,6 +686,7 @@ func (p *Package) gccCmd() []string {
"-xc"
,
// input language is C
}
c
=
append
(
c
,
p
.
GccOptions
...
)
c
=
append
(
c
,
p
.
gccMachine
()
...
)
c
=
append
(
c
,
"-"
)
//read input from standard input
return
c
}
...
...
@@ -719,7 +722,8 @@ func (p *Package) gccDebug(stdin []byte) *dwarf.Data {
// #defines that gcc encountered while processing the input
// and its included files.
func
(
p
*
Package
)
gccDefines
(
stdin
[]
byte
)
string
{
base
:=
[]
string
{
p
.
gccName
(),
p
.
gccMachine
(),
"-E"
,
"-dM"
,
"-xc"
}
base
:=
[]
string
{
p
.
gccName
(),
"-E"
,
"-dM"
,
"-xc"
}
base
=
append
(
base
,
p
.
gccMachine
()
...
)
stdout
,
_
:=
runGcc
(
stdin
,
append
(
append
(
base
,
p
.
GccOptions
...
),
"-"
))
return
stdout
}
...
...
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