You are not logged in.

#1 2013-12-22 22:23:34

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 209

[solved] gccgo compiled programs runtime error: DWARF underflow

The last couple days I'm toying around with go and trying to compile anything with gccgo instead of 6g gives me a runtime error and program dies. For example this trivial program

package main

import "fmt"
import "time"

func main() {
    const layout = "Mon 2 Jan 2006 - 15:04:05"
    t := time.Now()
    fmt.Println(t.Format(layout))
}

when compiled with gccgo gives me

$ go build -x -compiler=gccgo date.go 
WORK=/tmp/go-build607910408
mkdir -p $WORK/command-line-arguments/_obj/
cd /home/foucault/Desktop
gccgo -I $WORK -c -g -m64 -fgo-relative-import-path=_/home/foucault/Desktop -o $WORK/command-line-arguments/_obj/main.o ./date.go
ar cru $WORK/libcommand-line-arguments.a $WORK/command-line-arguments/_obj/main.o
cd .
gccgo -o date $WORK/command-line-arguments/_obj/main.o -Wl,-( -m64 -Wl,-)
$ ./date
fatal error: DWARF underflow in .debug_info at 4

6g seems to work ok though

$ go build -x -compiler=gc date.go  
WORK=/tmp/go-build962957705
mkdir -p $WORK/command-line-arguments/_obj/
cd /home/foucault/Desktop
/usr/lib/go/pkg/tool/linux_amd64/6g -o $WORK/command-line-arguments/_obj/_go_.6 -p command-line-arguments -complete -D _/home/foucault/Desktop -I $WORK ./date.go
/usr/lib/go/pkg/tool/linux_amd64/pack grcP $WORK $WORK/command-line-arguments.a $WORK/command-line-arguments/_obj/_go_.6
cd .
/usr/lib/go/pkg/tool/linux_amd64/6l -o date -L $WORK $WORK/command-line-arguments.a
$ ./date
Mon 23 Dec 2013 - 00:20:48

Is this only me? Can anyone confirm it? Any tips on debugging?

Last edited by Foucault (2013-12-24 10:50:26)

Offline

#2 2013-12-23 05:00:45

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

How did you get gccgo? This mailing list thread seems to imply it has to do with debug symbols being unexpectedly stripped (and your output shows -g in use by gccgo).

Last edited by cactus (2013-12-23 05:01:57)


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2013-12-23 07:00:30

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 209

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

cactus wrote:

How did you get gccgo?

pacman -S gcc-go
pacman -Ql gcc-go|grep gccgo
/usr/bin/gccgo

I'm aware of the thread, and I have noticed that -g is being used. time.gox and fmt.gox are not stripped as well.

$ file /usr/lib/go/4.8.2/x86_64-unknown-linux-gnu/time.gox
/usr/lib/go/4.8.2/x86_64-unknown-linux-gnu/time.gox: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
$ file /usr/lib/go/4.8.2/x86_64-unknown-linux-gnu/fmt.gox 
/usr/lib/go/4.8.2/x86_64-unknown-linux-gnu/fmt.gox: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

I have also tried the same on a different machine (Intel C2D E4600) also Arch, same packages and it segfaults.

Last edited by Foucault (2013-12-23 09:38:45)

Offline

#4 2013-12-23 20:49:26

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

Interesting. I would raise it on the mailing list (#golang-nuts). The gccgo devs hang out on there too.

I did just find this too. You could try a different version of gccgo and see if you get different results, or try that patch.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#5 2013-12-23 23:00:04

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,433
Website

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

Try gcc-4.8.2-7 in [testing]:

allan@arya ~/tmp/go 
> gccgo -g date.go 

allan@arya ~/tmp/go 
> ./a.out 
Tue 24 Dec 2013 - 08:59:20

Offline

#6 2013-12-23 23:28:05

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 209

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

Allan wrote:

Try gcc-4.8.2-7 in [testing]:

I'd like that but I'm using multilib. Can I just rebuild gcc-multilib and assorted packages in a chroot by uncommenting the _snapshot=4.8-20131219 variable in the PKGBUILD (and the relevant source I suppose)? As far as I can tell is the only difference between the testing gcc and the core gcc.

Last edited by Foucault (2013-12-23 23:32:00)

Offline

#7 2013-12-24 03:44:08

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,433
Website

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

gcc-multilib has been updated too.

Offline

#8 2013-12-24 04:56:06

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

Don't listen to Allan. He just breaks things. wink


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#9 2013-12-24 10:50:06

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 209

Re: [solved] gccgo compiled programs runtime error: DWARF underflow

gcc from testing seems to work ok. Thank you both!

Offline

Board footer

Powered by FluxBB