Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: cannot load DWARF output from ./_cgo_.o: applyRelocations: not implemented #18959

Closed
vicglarson opened this issue Feb 6, 2017 · 6 comments

Comments

@vicglarson
Copy link

commented Feb 6, 2017

What version of Go are you using (go version)?

go version go1.7.4 linux/amd64

gccgo --version
gccgo (GCC) 7.0.0 20161208 (experimental)

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build047826825=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

cross-complie test.go for sparc-sun-solaris2.12

package main
//#cgo LDFLAGS: -c
//#cgo CFLAGS: -DPNG_DEBUG=1

// #include <stdio.h>
import "C"

func main() {
C.puts("test")
}

What did you see instead?

go tool cgo -debug-gcc -gccgo -objdir . -- test.go

$ gcc -E -dM -xc -m64 - <<EOF
#line 5 "/home/ubuntu/1/test.go"
#include <stdio.h>

#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC. */
typedef ptrdiff_t intgo;

typedef struct { char *p; intgo n; } GoString;
typedef struct { char *p; intgo n; intgo c; } GoBytes;
GoString GoString(char *p);
GoString GoStringN(char *p, int l);
GoBytes GoBytes(void *p, int n);
char *CString(GoString);
void *CBytes(GoBytes);
void *_CMalloc(size_t);
EOF
#define DBL_MIN_EXP (-1021)
#define FLT32X_MAX_EXP 1024
#define _SYS_FEATURE_TESTS_H
#define UINT_LEAST16_MAX 0xffff
#define __ATOMIC_ACQUIRE 2
#define FLT128_MAX_10_EXP 4932
#define sun_attr___packed attribute((packed))
#define FLT_MIN 1.17549435082228750796873653722224568e-38F
#define __GCC_IEC_559_COMPLEX 2
#define UINT_LEAST8_TYPE unsigned char
#define T_WCHAR
#define __INTMAX_C(c) c ## L
#define CHAR_BIT 8
#define UINT8_MAX 0xff
#define sun_attr___VPRINTFLIKE(__n) attribute((format(printf, __n, 0)))
#define _FILEDEFED
#define WINT_MAX 0x7fffffff
#define FLT32_MIN_EXP (-125)
#define stderr (&__iob[2])
#define ORDER_LITTLE_ENDIAN 1234
#define SIZE_MAX 0xffffffffffffffffUL
#define WCHAR_MAX 0x7fffffff
#define _LONG_LONG_ALIGNMENT 8
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define DBL_DENORM_MIN ((double)4.94065645841246544176568792868221372e-324L)
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
#define _OBP
#define __GCC_IEC_559 2
#define FLT32X_DECIMAL_DIG 17
#define _IOFBF 0000
#define sun_attr___pure attribute((pure))
#define FLT_EVAL_METHOD 0
#define unix 1
#define FLT64_DECIMAL_DIG 17
#define _XOPEN_VERSION 3
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
#define _I32LPx
#define UINT_FAST64_MAX 0xffffffffffffffffUL
#define SIG_ATOMIC_TYPE int
#define DBL_MIN_10_EXP (-307)
#define FINITE_MATH_ONLY 0
#define L_cuserid 9
#define ___sun_attr_inner(__a) _sun_attr ##__a
#define sun_attr___noreturn attribute((noreturn))
#define GNUC_PATCHLEVEL 0
#define FLT32_HAS_DENORM 1
#define UINT_FAST8_MAX 0xff
#define __has_include(STR) has_include(STR)
#define DEC64_MAX_EXP 385
#define _WCHAR_T_DEFINED
#define __INT8_C(c) c
#define INT_LEAST8_WIDTH 8
#define sparc 1
#define UINT_LEAST64_MAX 0xffffffffffffffffUL
#define sun_attr(__a) ___sun_attr_inner __a
#define SHRT_MAX 0x7fff
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
#define FLT64X_MAX_10_EXP 4932
#define UINT_LEAST8_MAX 0xff
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
#define FLT128_DENORM_MIN 6.47517511943802511092443895822764655e-4966F128
#define UINTMAX_TYPE long unsigned int
#define DEC32_EPSILON 1E-6DF
#define FLT_EVAL_METHOD_TS_18661_3 0
#define __unix 1
#define UINT32_MAX 0xffffffffU
#define LDBL_MAX_EXP 16384
#define FLT128_MIN_EXP (-16381)
#define WINT_MIN (-WINT_MAX - 1)
#define __sun 1
#define FLT128_MIN_10_EXP (-4931)
#define INT_LEAST16_WIDTH 16
#define SCHAR_MAX 0x7f
#define _LONG_ALIGNMENT 8
#define FLT128_MANT_DIG 113
#define WCHAR_MIN (-WCHAR_MAX - 1)
#define __INT64_C(c) c ## L
#define _INT_ALIGNMENT 4
#define DBL_DIG 15
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
#define FLT64X_MANT_DIG 113
#define _MULTI_DATAMODEL
#define _SYS_CCOMPILE_H
#define SIZEOF_INT 4
#define SIZEOF_POINTER 8
#define getchar_unlocked() getc_unlocked(stdin)
#define _DOUBLE_COMPLEX_ALIGNMENT 8
#define USER_LABEL_PREFIX
#define FLT64X_EPSILON 1.92592994438723585305597794258492732e-34F64x
#define STDC_HOSTED 1
#define LDBL_HAS_INFINITY 1
#define FLT32_DIG 6
#define FLT_EPSILON 1.19209289550781250000000000000000000e-7F
#define SHRT_WIDTH 16
#define TMP_MAX 17576
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
#define STDC_UTF_16 1
#define DEC32_MAX 9.999999E96DF
#define WCHAR_T
#define FLT64X_DENORM_MIN 6.47517511943802511092443895822764655e-4966F64x
#define _STDDEF_H
#define FLT32X_HAS_INFINITY 1
#define INT32_MAX 0x7fffffff
#define INT_WIDTH 32
#define SIZEOF_LONG 8
#define _IONBF 0004
#define __UINT16_C(c) c
#define PTRDIFF_WIDTH 64
#define DECIMAL_DIG 36
#define FLT64_EPSILON 2.22044604925031308084726333618164062e-16F64
#define INTMAX_WIDTH 64
#define _LARGEFILE_SOURCE 1
#define __has_include_next(STR) has_include_next(STR)
#define _SSIZE_T
#define FLT64X_MIN_10_EXP (-4931)
#define LDBL_HAS_QUIET_NAN 1
#define FLT64_MANT_DIG 53
#define __va_ptr_base void
#define L_tmpnam 25
#define ___int_wchar_t_h
#define _T_PTRDIFF
#define GNUC 7
#define sun_attr___KVPRINTFLIKE(__n) attribute((format(cmn_err, __n, 0)))
#define offsetof(TYPE,MEMBER) __builtin_offsetof (TYPE, MEMBER)
#define L_ctermid 9
#define FLT_HAS_DENORM 1
#define SIZEOF_LONG_DOUBLE 16
#define SEEK_CUR 1
#define BIGGEST_ALIGNMENT 16
#define FLT64_MAX_10_EXP 308
#define sun_attr___KPRINTFLIKE(__n) attribute((format(cmn_err, __n, (__n)+1)))
#define __va_void(expr) ((void)expr)
#define _GCC_WCHAR_T
#define DBL_MAX ((double)1.79769313486231570814527423731704357e+308L)
#define INT_FAST32_MAX 0x7fffffff
#define DBL_HAS_INFINITY 1
#define stdin (&__iob[0])
#define __SVR4 1
#define DEC32_MIN_EXP (-94)
#define putchar_unlocked(x) putc_unlocked((x), stdout)
#define INTPTR_WIDTH 64
#define _LONG_LONG_HTOL
#define FLT32X_HAS_DENORM 1
#define INT_FAST16_TYPE int
#define _SUNOS_VTOC_8
#define WCHAR_T_DEFINED
#define _NFILE 20
#define LDBL_HAS_DENORM 1
#define _STDIO_IMPL_H
#define __va_alist_type long
#define FLT128_HAS_INFINITY 1
#define DEC128_MAX 9.999999999999999999999999999999999E6144DL
#define INT_LEAST32_MAX 0x7fffffff
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT
#define DEC32_MIN 1E-95DF
#define DBL_MAX_EXP 1024
#define WCHAR_WIDTH 32
#define FLT32_MAX 3.40282346638528859811704183484516925e+38F32
#define DEC128_EPSILON 1E-33DL
#define PTRDIFF_MAX 0x7fffffffffffffffL
#define _STDIO_TAG_H
#define _PTRDIFF_T_DECLARED
#define FLT32_HAS_QUIET_NAN 1
#define _T_WCHAR
#define LONG_LONG_MAX 0x7fffffffffffffffLL
#define SIZEOF_SIZE_T 8
#define _WCHAR_T
#define __KVPRINTFLIKE(__n) sun_attr((KVPRINTFLIKE(__n)))
#define sparc 1
#define FLT64X_MIN_EXP (-16381)
#define SIZEOF_WINT_T 4
#define LONG_LONG_WIDTH 64
#define _STDIO_H
#define FLT32_MAX_EXP 128
#define _PTRDIFF_T
#define __GXX_ABI_VERSION 1011
#define sun_attr___PRINTFLIKE(__n) attribute((format(printf, __n, (__n)+1)))
#define FLT_MIN_EXP (-125)
#define __PTRDIFF_T
#define FLT64X_HAS_QUIET_NAN 1
#define INT_FAST64_TYPE long int
#define _LONGLONG_TYPE
#define __FILE_TAG __FILE
#define _ANSI_STDDEF_H
#define FLT64_DENORM_MIN 4.94065645841246544176568792868221372e-324F64
#define DBL_MIN ((double)2.22507385850720138309023271733240406e-308L)
#define _ALIGNMENT_REQUIRED 1
#define LP64 1
#define FLT32X_EPSILON 2.22044604925031308084726333618164062e-16F32x
#define _ISO_STDIO_ISO_H
#define FLT64_MIN_EXP (-1021)
#define _RESTRICT_KYWD restrict
#define _SYS_ISA_DEFS_H
#define FLT64_MIN_10_EXP (-307)
#define _IOREAD 0001
#define FLT64X_DECIMAL_DIG 36
#define DEC128_MIN 1E-6143DL
#define REGISTER_PREFIX
#define UINT16_MAX 0xffff
#define _LONG_DOUBLE_ALIGNMENT 16
#define DBL_HAS_DENORM 1
#define _IOMYBUF 0010
#define FLT32_MIN 1.17549435082228750796873653722224568e-38F32
#define UINT8_TYPE unsigned char
#define NO_INLINE 1
#define __sparcv9 1
#define FLT_MANT_DIG 24
#define LDBL_DECIMAL_DIG 36
#define VERSION "7.0.0 20161208 (experimental)"
#define __UINT64_C(c) c ## UL
#define PTRDIFF_T
#define __INT_WCHAR_T_H
#define _BIT_FIELDS_HTOL
#define __GCC_ATOMIC_INT_LOCK_FREE 2
#define _NO_FDISK_PRESENT
#define T_PTRDIFF
#define FLT128_MAX_EXP 16384
#define FLT32_MANT_DIG 24
#define _OFF_T
#define FLOAT_WORD_ORDER ORDER_BIG_ENDIAN
#define _CHAR_ALIGNMENT 1
#define FLT128_HAS_DENORM 1
#define __sparc 1
#define FLT128_DIG 33
#define SCHAR_WIDTH 8
#define __INT32_C(c) c
#define DEC64_EPSILON 1E-15DD
#define ORDER_PDP_ENDIAN 3412
#define DEC128_MIN_EXP (-6142)
#define FLT32_MAX_10_EXP 38
#define sun 1
#define INT_FAST32_TYPE int
#define UINT_LEAST16_TYPE short unsigned int
#define FLT64X_HAS_INFINITY 1
#define unix 1
#define INT16_MAX 0x7fff
#define SIZE_TYPE long unsigned int
#define UINT64_MAX 0xffffffffffffffffUL
#define _ISO_STDIO_C99_H
#define _FLOAT_ALIGNMENT 4
#define FLT64X_DIG 33
#define INT8_TYPE char
#define _IORW 0200
#define ELF 1
#define _FLOAT_COMPLEX_ALIGNMENT 4
#define _STDC_C11
#define FLT_RADIX 2
#define INT_LEAST16_TYPE short int
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
#define __UINTMAX_C(c) c ## UL
#define SIG_ATOMIC_MAX 0x7fffffff
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define _BOOL_ALIGNMENT 1
#define SIZEOF_PTRDIFF_T 8
#define SEEK_SET 0
#define _HAVE_TEM_FIRMWARE
#define _SYS_VA_LIST_H
#define _STDC_C99
#define FLT32X_MANT_DIG 53
#define FLT32X_MIN_EXP (-1021)
#define DEC32_SUBNORMAL_MIN 0.000001E-95DF
#define _WCHAR_T_H
#define INT_FAST16_MAX 0x7fffffff
#define FLT64_DIG 15
#define UINT_FAST32_MAX 0xffffffffU
#define UINT_LEAST64_TYPE long unsigned int
#define FLT_HAS_QUIET_NAN 1
#define _MAX_ALIGNMENT 16
#define FLT_MAX_10_EXP 38
#define _POINTER_ALIGNMENT 8
#define LONG_MAX 0x7fffffffffffffffL
#define WCHAR_T
#define FLT64X_HAS_DENORM 1
#define DEC128_SUBNORMAL_MIN 0.000000000000000000000000000000001E-6143DL
#define FLT_HAS_INFINITY 1
#define BSD_PTRDIFF_T
#define UINT_FAST16_TYPE unsigned int
#define DEC64_MAX 9.999999999999999E384DD
#define INT_FAST32_WIDTH 32
#define NULL ((void *)0)
#define CHAR16_TYPE short unsigned int
#define __PRAGMA_REDEFINE_EXTNAME 1
#define SIZE_WIDTH 64
#define INT_LEAST16_MAX 0x7fff
#define DEC64_MANT_DIG 16
#define INT64_MAX 0x7fffffffffffffffL
#define UINT_LEAST32_MAX 0xffffffffU
#define FLT32_DENORM_MIN 1.40129846432481707092372958328991613e-45F32
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
#define SIG_ATOMIC_WIDTH 32
#define INT_LEAST64_TYPE long int
#define INT16_TYPE short int
#define INT_LEAST8_TYPE char
#define STDC_VERSION 201112L
#define DEC32_MAX_EXP 97
#define _BIG_ENDIAN
#define INT_FAST8_MAX 0x7f
#define FLT128_MAX 1.18973149535723176508575932662800702e+4932F128
#define INTPTR_MAX 0x7fffffffffffffffL
#define __ATTR_DEPRECATED sun_attr((deprecated))
#define FLT64_HAS_QUIET_NAN 1
#define _IOLBF 0100
#define FLT32_MIN_10_EXP (-37)
#define FLT32X_DIG 15
#define LDBL_MANT_DIG 113
#define DBL_HAS_QUIET_NAN 1
#define FLT64_HAS_INFINITY 1
#define FLT64X_MAX 1.18973149535723176508575932662800702e+4932F64x
#define __GNUC_VA_LIST
#define _GCC_MAX_ALIGN_T
#define SIG_ATOMIC_MIN (-SIG_ATOMIC_MAX - 1)
#define _DOUBLE_ALIGNMENT 8
#define _SHORT_ALIGNMENT 2
#define FILENAME_MAX 1024
#define __VPRINTFLIKE(__n) sun_attr((VPRINTFLIKE(__n)))
#define INTPTR_TYPE long int
#define UINT16_TYPE short unsigned int
#define WCHAR_TYPE int
#define SIZEOF_FLOAT 4
#define UINTPTR_MAX 0xffffffffffffffffUL
#define INT_FAST64_WIDTH 64
#define DEC64_MIN_EXP (-382)
#define sun_attr___deprecated attribute((deprecated))
#define FLT32_DECIMAL_DIG 9
#define INT_FAST64_MAX 0x7fffffffffffffffL
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 255
#define BUFSIZ 1024
#define FLT_DIG 6
#define FLT32_HAS_INFINITY 1
#define FLT64X_MAX_EXP 16384
#define _IEEE_754
#define _WCHAR_T_DECLARED
#define UINT_FAST64_TYPE long unsigned int
#define INT_MAX 0x7fffffff
#define _DTRACE_VERSION 1
#define __PACKED sun_attr((packed))
#define INT64_TYPE long int
#define FLT_MAX_EXP 128
#define ORDER_BIG_ENDIAN 4321
#define DBL_MANT_DIG 53
#define INT_LEAST64_MAX 0x7fffffffffffffffL
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
#define _IOWRT 0002
#define DEC64_MIN 1E-383DD
#define WINT_TYPE int
#define UINT_LEAST32_TYPE unsigned int
#define SIZEOF_SHORT 2
#define LDBL_MIN_EXP (-16381)
#define FLT64_MAX 1.79769313486231570814527423731704357e+308F64
#define stdout (&__iob[1])
#define WINT_WIDTH 32
#define EOF (-1)
#define INT_LEAST8_MAX 0x7f
#define __KPRINTFLIKE(__n) sun_attr((KPRINTFLIKE(__n)))
#define FLT32X_MAX_10_EXP 308
#define SIZEOF_INT128 16
#define _CHAR_IS_SIGNED
#define sun_attr___const attribute((const))
#define LDBL_MAX_10_EXP 4932
#define __ATOMIC_RELAXED 0
#define DBL_EPSILON ((double)2.22044604925031308084726333618164062e-16L)
#define FLT128_MIN 3.36210314311209350626267781732175260e-4932F128
#define _LP64 1
#define __UINT8_C(c) c
#define FLT64_MAX_EXP 1024
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
#define INT_LEAST32_TYPE int
#define wchar_t
#define sun 1
#define SEEK_END 2
#define SIZEOF_WCHAR_T 4
#define UINT64_TYPE long unsigned int
#define _LARGEFILE64_SOURCE 1
#define STDDEF_H
#define FLT128_HAS_QUIET_NAN 1
#define INT_FAST8_TYPE char
#define _IOEOF 0020
#define FLT64X_MIN 3.36210314311209350626267781732175260e-4932F64x
#define GNUC_STDC_INLINE 1
#define P_tmpdir "/var/tmp/"
#define FLT64_HAS_DENORM 1
#define FLT32_EPSILON 1.19209289550781250000000000000000000e-7F32
#define DBL_DECIMAL_DIG 17
#define STDC_UTF_32 1
#define _IOERR 0040
#define INT_FAST8_WIDTH 8
#define DEC_EVAL_METHOD 2
#define _SIZE_T
#define FLT32X_MAX 1.79769313486231570814527423731704357e+308F32x
#define FOPEN_MAX _NFILE
#define __PRINTFLIKE(__n) sun_attr((PRINTFLIKE(__n)))
#define _STACK_GROWS_DOWNWARD
#define _FILE_OFFSET_BITS 64
#define svr4 1
#define __UINT32_C(c) c ## U
#define INTMAX_MAX 0x7fffffffffffffffL
#define BYTE_ORDER ORDER_BIG_ENDIAN
#define FLT_DENORM_MIN 1.40129846432481707092372958328991613e-45F
#define INT8_MAX 0x7f
#define LONG_WIDTH 64
#define UINT_FAST32_TYPE unsigned int
#define CHAR32_TYPE unsigned int
#define FLT_MAX 3.40282346638528859811704183484516925e+38F
#define __NORETURN sun_attr((noreturn))
#define INT32_TYPE int
#define _DMA_USES_VIRTADDR
#define SIZEOF_DOUBLE 8
#define FLT_MIN_10_EXP (-37)
#define _ISO_CPP_14882_1998
#define FLT64_MIN 2.22507385850720138309023271733240406e-308F64
#define INT_LEAST32_WIDTH 32
#define INTMAX_TYPE long int
#define DEC128_MAX_EXP 6145
#define _ISO_C_9899_1999
#define FLT32X_HAS_QUIET_NAN 1
#define __ATOMIC_CONSUME 1
#define GNUC_MINOR 0
#define INT_FAST16_WIDTH 32
#define UINTMAX_MAX 0xffffffffffffffffUL
#define DEC32_MANT_DIG 7
#define FLT32X_DENORM_MIN 4.94065645841246544176568792868221372e-324F32x
#define DBL_MAX_10_EXP 308
#define LDBL_DENORM_MIN 6.47517511943802511092443895822764655e-4966L
#define __INT16_C(c) c
#define PTRDIFF_TYPE long int
#define __CONST sun_attr((const))
#define __GNUC_VERSION (GNUC * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)
#define __ATOMIC_SEQ_CST 5
#define arch64 1
#define UINT32_TYPE unsigned int
#define FLT32X_MIN_10_EXP (-307)
#define UINTPTR_TYPE long unsigned int
#define DEC64_SUBNORMAL_MIN 0.000000000000001E-383DD
#define DEC128_MANT_DIG 34
#define LDBL_MIN_10_EXP (-4931)
#define FLT128_EPSILON 1.92592994438723585305597794258492732e-34F128
#define SIZEOF_LONG_LONG 8
#define _GCC_PTRDIFF_T
#define _SBFSIZ 8
#define FLT128_DECIMAL_DIG 36
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
#define FLT32X_MIN 2.22507385850720138309023271733240406e-308F32x
#define LDBL_DIG 33
#define FLT_DECIMAL_DIG 9
#define UINT_FAST16_MAX 0xffffffffU
#define ___int_ptrdiff_t_h
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
#define __PURE sun_attr((pure))
#define INT_LEAST64_WIDTH 64
#define UINT_FAST8_TYPE unsigned char
#define __ATOMIC_ACQ_REL 4
#define __WCHAR_T
#define __ATOMIC_RELEASE 3
$ gcc -w -Wno-error -o./cgo.o -gdwarf-2 -c -xc -m64 - <<EOF
#line 5 "/home/ubuntu/1/test.go"
#include <stdio.h>

#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC. */
typedef ptrdiff_t intgo;

typedef struct { char *p; intgo n; } GoString;
typedef struct { char *p; intgo n; intgo c; } GoBytes;
GoString GoString(char *p);
GoString GoStringN(char *p, int l);
GoBytes GoBytes(void *p, int n);
char *CString(GoString);
void *CBytes(GoBytes);
void *_CMalloc(size_t);
#line 1 "not-declared"
void __cgo_f_1_1(void) { typeof(puts) *cgo_undefined; }
#line 1 "not-type"
void __cgo_f_1_2(void) { puts *cgo_undefined; }
#line 1 "not-const"
void __cgo_f_1_3(void) { enum { cgo__undefined = (puts)1 }; }
#line 1 "completed"
int __cgo__1 = __cgo__2;
EOF
not-type: In function '__cgo_f_1_2':
not-type:1:32: error: 'cgo_undefined' undeclared (first use in this function)
not-type:1:32: note: each undeclared identifier is reported only once for each function it appears in
not-const: In function '__cgo_f_1_3':
not-const:1:60: error: invalid operands to binary * (have 'int (
)(const char *)' and 'int')
completed: At top level:
completed:1:16: error: '__cgo__2' undeclared here (not in a function); did you mean '__cgo__1'?
$ gcc -w -Wno-error -o./cgo.o -gdwarf-2 -c -xc -m64 - <<EOF
#line 5 "/home/ubuntu/1/test.go"
#include <stdio.h>

#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC. */
typedef ptrdiff_t intgo;

typedef struct { char *p; intgo n; } GoString;
typedef struct { char *p; intgo n; intgo c; } GoBytes;
GoString GoString(char *p);
GoString GoStringN(char *p, int l);
GoBytes GoBytes(void *p, int n);
char *CString(GoString);
void *CBytes(GoBytes);
void *_CMalloc(size_t);
typeof(puts) *__cgo__0;
typeof(puts) *__cgo__1;
long long __cgodebug_data[] = {
0,
0,
1
};
EOF
cannot load DWARF output from ./cgo.o: applyRelocations: not implemented

readelf -a --wide cgo.o
ELF Header:
Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: Sparc v9
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 2504 (bytes into file)
Flags: 0x2, rmo
Size of this header: 64 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 64 (bytes)
Number of section headers: 15
Section header string table index: 12

Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 1
[ 2] .data PROGBITS 0000000000000000 000040 000018 00 WA 0 0 8
[ 3] .bss NOBITS 0000000000000000 000058 000000 00 WA 0 0 1
[ 4] .debug_info PROGBITS 0000000000000000 000058 00018d 00 0 0 1
[ 5] .rela.debug_info RELA 0000000000000000 000678 0002b8 18 I 13 4 8
[ 6] .debug_abbrev PROGBITS 0000000000000000 0001e5 0000bd 00 0 0 1
[ 7] .debug_aranges PROGBITS 0000000000000000 0002a2 000020 00 0 0 1
[ 8] .rela.debug_aranges RELA 0000000000000000 000930 000018 18 I 13 7 8
[ 9] .debug_line PROGBITS 0000000000000000 0002c2 0000b2 00 0 0 1
[10] .debug_str PROGBITS 0000000000000000 000374 000146 01 MS 0 0 1
[11] .comment PROGBITS 0000000000000000 0004ba 00002a 01 MS 0 0 1
[12] .shstrtab STRTAB 0000000000000000 000948 00007f 00 0 0 1
[13] .symtab SYMTAB 0000000000000000 0004e8 000150 18 14 11 8
[14] .strtab STRTAB 0000000000000000 000638 00003d 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

There are no program headers in this file.

Relocation section '.rela.debug_info' at offset 0x678 contains 29 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
0000000000000006 0000000600000017 R_SPARC_UA32 0000000000000000 .debug_abbrev + 0
000000000000000c 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 71
0000000000000011 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + e5
0000000000000015 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 1b
0000000000000019 0000000800000017 R_SPARC_UA32 0000000000000000 .debug_line + 0
000000000000001e 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 14
0000000000000029 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 14
0000000000000035 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + e
0000000000000056 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 104
000000000000005d 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 114
0000000000000064 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 4d
0000000000000079 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 139
0000000000000093 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 38
0000000000000098 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 13f
00000000000000a5 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 31
00000000000000b2 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 10d
00000000000000c8 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + d9
00000000000000d2 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 46
00000000000000e7 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 2a
00000000000000f5 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + de
0000000000000103 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 68
0000000000000113 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 0
000000000000011a 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 11d
0000000000000135 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + d0
0000000000000142 0000000b00000036 R_SPARC_UA64 0000000000000008 __cgo__0 + 0
0000000000000151 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 5f
000000000000015e 0000000c00000036 R_SPARC_UA64 0000000000000008 __cgo__1 + 0
0000000000000177 0000000900000017 R_SPARC_UA32 0000000000000000 .debug_str + 129
0000000000000184 0000000d00000036 R_SPARC_UA64 0000000000000000 __cgodebug_data + 0

Relocation section '.rela.debug_aranges' at offset 0x930 contains 1 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
0000000000000006 0000000500000017 R_SPARC_UA32 0000000000000000 .debug_info + 0

The decoding of unwind sections for machine type Sparc v9 is not currently supported.

Symbol table '.symtab' contains 14 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS cgo-gcc-input-474235888.c
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
3: 0000000000000000 0 SECTION LOCAL DEFAULT 2
4: 0000000000000000 0 SECTION LOCAL DEFAULT 3
5: 0000000000000000 0 SECTION LOCAL DEFAULT 4
6: 0000000000000000 0 SECTION LOCAL DEFAULT 6
7: 0000000000000000 0 SECTION LOCAL DEFAULT 7
8: 0000000000000000 0 SECTION LOCAL DEFAULT 9
9: 0000000000000000 0 SECTION LOCAL DEFAULT 10
10: 0000000000000000 0 SECTION LOCAL DEFAULT 11
11: 0000000000000008 8 OBJECT GLOBAL DEFAULT COM __cgo__0
12: 0000000000000008 8 OBJECT GLOBAL DEFAULT COM __cgo__1
13: 0000000000000000 24 OBJECT GLOBAL DEFAULT 2 __cgodebug_data

No version information found in this file.

@vicglarson

This comment has been minimized.

Copy link
Author

commented Feb 6, 2017

Is there set of gcc debug options to bypass this step?

@josharian

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2017

@josharian josharian changed the title cannot load DWARF output from ./_cgo_.o: applyRelocations: not implemented cmd/cgo: cannot load DWARF output from ./_cgo_.o: applyRelocations: not implemented Feb 6, 2017

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2017

There is no way to bypass this step.

I don't understand why you are getting this error, though. As far as I can see the relevant code was added in https://golang.org/cl/30916 and copied to GCC 7 in SVN revision number 241171 (https://gcc.gnu.org/ml/gcc-patches/2016-10/msg01177.html). The version of gccgo that you are running should include that patch.

Can you confirm that your cgo tool was built from sources that include these lines in libgo/go/debug/elf/file.go:

	case f.Class == ELFCLASS64 && f.Machine == EM_SPARCV9:
		return f.applyRelocationsSPARC64(dst, rels)
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2017

Oh, wait, I bet you are using the cgo tool from gc 1.7.4. That works fine with gccgo, but 1.7.4 doesn't include the SPARC support you need. It is in 1.8, though. It was added in https://golang.org/cl/30870. Try using the 1.8 release candidate.

@minux

This comment has been minimized.

Copy link
Member

commented Feb 7, 2017

@vicglarson

This comment has been minimized.

Copy link
Author

commented Feb 7, 2017

thanks
tried 18.3 rc3
successfully built.

@josharian josharian closed this Feb 7, 2017

@golang golang locked and limited conversation to collaborators Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.