summaryrefslogtreecommitdiff
path: root/src/cmd/cgo/gcc.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2009-11-02 12:02:16 -0800
committerAdam Langley <agl@golang.org>2009-11-02 12:02:16 -0800
commit16dd5020239cfc71c205a29bb0d957fd6d6c1a9c (patch)
tree60fe8c0d3ae25d25dfdf05ba1073c880f3df739a /src/cmd/cgo/gcc.go
parent240084c12a52bf9a31c171a62a3f8b1c43ea429d (diff)
downloadgolang-16dd5020239cfc71c205a29bb0d957fd6d6c1a9c.tar.gz
Fix cgo for GCC 4.4
Firstly, with -Werror, GCC switched to printing warnings starting with "error:". Widening the string matches solves this as the messages are otherwise unchanged. Secondly, GCC 4.4 outputs DWARF sections with with NUL bytes in all the offsets and requires the relocation section for .debug_info to be processed in order to result in valid DWARF data. Thus we add minimal handling for relocation sections, which is sufficient for our needs. BUG=1 Fixes issue 1. R=rsc, iant CC=go-dev http://go/go-review/1017003
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r--src/cmd/cgo/gcc.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index f573b98cb..b9354cdd6 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -78,9 +78,9 @@ func (p *Prog) loadDebugInfo() {
switch {
default:
continue;
- case strings.Index(line, "warning: useless type name in empty declaration") >= 0:
+ case strings.Index(line, ": useless type name in empty declaration") >= 0:
what = "type";
- case strings.Index(line, "warning: statement with no effect") >= 0:
+ case strings.Index(line, ": statement with no effect") >= 0:
what = "value";
case strings.Index(line, "undeclared") >= 0:
what = "error";
@@ -114,7 +114,7 @@ func (p *Prog) loadDebugInfo() {
fatal("gcc failed:\n%s\non input:\n%s", stderr, b.Bytes());
}
- // Scan DWARF info for top-level TagVariable entries with AttrName __cgo__i.
+ // Scan DWARF info for top-level TagVariable entries with AttrName __cgo__i.
types := make([]dwarf.Type, len(names));
r := d.Reader();
for {
@@ -198,10 +198,10 @@ func (p *Prog) gccDebug(stdin []byte) (*dwarf.Data, string) {
machine,
"-Wall", // many warnings
"-Werror", // warnings are errors
- "-o"+tmp, // write object to tmp
- "-gdwarf-2", // generate DWARF v2 debugging symbols
+ "-o"+tmp, // write object to tmp
+ "-gdwarf-2", // generate DWARF v2 debugging symbols
"-c", // do not link
- "-xc", // input language is C
+ "-xc", // input language is C
"-", // read input from standard input
};
_, stderr, ok := run(stdin, concat(base, p.GccOptions));