diff options
author | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 |
commit | 1bb8f19f5e9016a9eb118b8aba2b5689b4505812 (patch) | |
tree | 7b69b0974f4999bac76d11abed2071a2dc9e97aa /src/cmd/cgo/gcc.go | |
parent | 6b7539d607f26a1b1cd3eda71fc123ad4d52a133 (diff) | |
download | golang-1bb8f19f5e9016a9eb118b8aba2b5689b4505812.tar.gz |
8c, 8l dynamic loading support.
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.
on snow leopard:
- non-cgo binaries work; all tests pass.
- cgo binaries work on amd64 but not 386.
R=r
DELTA=2031 (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r-- | src/cmd/cgo/gcc.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index e3f526845..f573b98cb 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -172,6 +172,17 @@ func (p *Prog) loadDebugInfo() { p.Typedef = conv.typedef; } +func concat(a, b []string) []string { + c := make([]string, len(a)+len(b)); + for i, s := range a { + c[i] = s; + } + for i, s := range b { + c[i+len(a)] = s; + } + return c; +} + // gccDebug runs gcc -gdwarf-2 over the C program stdin and // returns the corresponding DWARF data and any messages // printed to standard error. @@ -182,7 +193,7 @@ func (p *Prog) gccDebug(stdin []byte) (*dwarf.Data, string) { } tmp := "_cgo_.o"; - _, stderr, ok := run(stdin, []string{ + base := []string{ "gcc", machine, "-Wall", // many warnings @@ -192,7 +203,8 @@ func (p *Prog) gccDebug(stdin []byte) (*dwarf.Data, string) { "-c", // do not link "-xc", // input language is C "-", // read input from standard input - }); + }; + _, stderr, ok := run(stdin, concat(base, p.GccOptions)); if !ok { return nil, string(stderr); } |