mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: don't pass CGO_CFLAGS -g options to debug info generation
Fixes #26144 Change-Id: Ie69dab1bd819eaf158be11769903b2636bbcf516 Reviewed-on: https://go-review.googlesource.com/c/152165 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Nikhil Benesch <nikhil.benesch@gmail.com>
This commit is contained in:
parent
89df035464
commit
8c5976f8b3
2 changed files with 11 additions and 2 deletions
|
|
@ -91,7 +91,13 @@ func (p *Package) addToFlag(flag string, args []string) {
|
|||
p.CgoFlags[flag] = append(p.CgoFlags[flag], args...)
|
||||
if flag == "CFLAGS" {
|
||||
// We'll also need these when preprocessing for dwarf information.
|
||||
p.GccOptions = append(p.GccOptions, args...)
|
||||
// However, discard any -g options: we need to be able
|
||||
// to parse the debug info, so stick to what we expect.
|
||||
for _, arg := range args {
|
||||
if !strings.HasPrefix(arg, "-g") {
|
||||
p.GccOptions = append(p.GccOptions, arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue