https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64595

--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 14 Jan 2015, ian at airs dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64595
> 
> --- Comment #4 from Ian Lance Taylor <ian at airs dot com> ---
> To invoke cgo, put this code in a file foo.go and type "go run foo.go" (or "go
> build foo.go && ./foo").
> 
> 
> package main
> 
> // #include <stdio.h>
> // void cprintln(const char *s) { puts(s); }
> import "C"
> 
> func main() {
>     C.cprintln(C.CString("Hello, world"))
> }

Hmm, I get

> go-5 build foo.go 
no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable

runtime stack:
no debug info in ELF executable errno -1
panic during panic

runtime stack:
no debug info in ELF executable errno -1
stack trace unavailable

(not really informative, seems to be from the go-5 binary).  On
openSUSE all binaries have debug information stripped and put
into separate objects not necessarily installed.  Installing it
doesn't solve the above issue.  The message seems to originate
from libbacktrace (unwind information is not stripped, obviously).

> readelf -S /usr/bin/go-5
There are 33 section headers, starting at offset 0x70ad10:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400270  00000270
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             000000000040028c  0000028c
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             00000000004002ac  000002ac
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .hash             HASH             00000000004002d0  000002d0
       0000000000000704  0000000000000004   A       6     0     8
  [ 5] .gnu.hash         GNU_HASH         00000000004009d8  000009d8
       000000000000001c  0000000000000000   A       6     0     8
  [ 6] .dynsym           DYNSYM           00000000004009f8  000009f8
       0000000000001770  0000000000000018   A       7     1     8
  [ 7] .dynstr           STRTAB           0000000000402168  00002168
       000000000000093f  0000000000000000   A       0     0     1
  [ 8] .gnu.version      VERSYM           0000000000402aa8  00002aa8
       00000000000001f4  0000000000000002   A       6     0     2
  [ 9] .gnu.version_r    VERNEED          0000000000402ca0  00002ca0
       0000000000000120  0000000000000000   A       7     4     8
  [10] .rela.dyn         RELA             0000000000402dc0  00002dc0
       0000000000000048  0000000000000018   A       6     0     8
  [11] .rela.plt         RELA             0000000000402e08  00002e08
       00000000000016f8  0000000000000018   A       6    13     8
  [12] .init             PROGBITS         0000000000404500  00004500
       000000000000001a  0000000000000000  AX       0     0     4
  [13] .plt              PROGBITS         0000000000404520  00004520
       0000000000000f60  0000000000000010  AX       0     0     16
  [14] .text             PROGBITS         0000000000405480  00005480
       000000000029fc34  0000000000000000  AX       0     0     16
  [15] .fini             PROGBITS         00000000006a50b4  002a50b4
       0000000000000009  0000000000000000  AX       0     0     4
  [16] .rodata           PROGBITS         00000000006a50c0  002a50c0
       00000000002b30b0  0000000000000000   A       0     0     32
  [17] .eh_frame_hdr     PROGBITS         0000000000958170  00558170
       000000000000ea8c  0000000000000000   A       0     0     4
  [18] .eh_frame         PROGBITS         0000000000966c00  00566c00
       0000000000072dc4  0000000000000000   A       0     0     8
  [19] .gcc_except_table PROGBITS         00000000009d99c4  005d99c4
       0000000000004849  0000000000000000   A       0     0     4
  [20] .tbss             NOBITS           0000000000bdec40  005dec40
       00000000000000d8  0000000000000000 WAT       0     0     8
  [21] .init_array       INIT_ARRAY       0000000000bdec40  005dec40
       0000000000000018  0000000000000000  WA       0     0     8
  [22] .fini_array       FINI_ARRAY       0000000000bdec58  005dec58
       0000000000000008  0000000000000000  WA       0     0     8
  [23] .jcr              PROGBITS         0000000000bdec60  005dec60
       0000000000000008  0000000000000000  WA       0     0     8
  [24] .data.rel.ro      PROGBITS         0000000000bdec80  005dec80
       0000000000000148  0000000000000000  WA       0     0     32
  [25] .dynamic          DYNAMIC          0000000000bdedc8  005dedc8
       0000000000000210  0000000000000010  WA       7     0     8
  [26] .got              PROGBITS         0000000000bdefd8  005defd8
       0000000000000018  0000000000000008  WA       0     0     8
  [27] .got.plt          PROGBITS         0000000000bdf000  005df000
       00000000000007c0  0000000000000008  WA       0     0     8
  [28] .data             PROGBITS         0000000000bdf7c0  005df7c0
       000000000007e170  0000000000000000  WA       0     0     32
  [29] .bss              NOBITS           0000000000c5d940  0065d930
       0000000000024a10  0000000000000000  WA       0     0     32
  [30] .go_export        PROGBITS         0000000000000000  0065d930
       00000000000ad29e  0000000000000000           0     0     1
  [31] .gnu_debuglink    PROGBITS         0000000000000000  0070abce
       0000000000000010  0000000000000000           0     0     1
  [32] .shstrtab         STRTAB           0000000000000000  0070abde
       000000000000012e  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

If I build

package main
func main() {
}

with gccgo, strip it and then try to execute it the same error appears:

rguenther@murzim:/tmp> gccgo-5 foo.go 
rguenther@murzim:/tmp> > ./a.out 
rguenther@murzim:/tmp> gccgo-5 foo.go 
rguenther@murzim:/tmp> ./a.out 
rguenther@murzim:/tmp> strip a.out
rguenther@murzim:/tmp> ./a.out 
no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable

runtime stack:
no debug info in ELF executable errno -1
panic during panic

runtime stack:
no debug info in ELF executable errno -1
stack trace unavailable


what's the reason for this?

Reply via email to