seen with a test rebuild of a linux distro using binutils trunk. on powerpc64le-linux-gnu all gcc builds fail in building libgo, trying to link the shared library: /bin/bash ./libtool --tag=CC --mode=link /<<PKGBUILDDIR>>/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/powerpc64le-linux-gnu/bin/ -B/usr/powerpc64le-linux-gnu/lib/ -isystem /usr/powerpc64le-linux-gnu/include -isystem /usr/powerpc64le-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -fexceptions -fnon-call-exceptions -fplan9-extensions -fno-stack-protector -fsplit-stack -Wall -Wextra -Wwrite-strings -Wcast-qual -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I ../../../src/libgo/../libgcc -I ../../../src/libgo/../libbacktrace -I ../../gcc/include -g -O2 -version-info 9:0:0 -pthread -XCClinker -fsplit-stack -Wl,-z,relro -o libgo.la -rpath /usr/lib/../lib go-append.lo go-assert.lo go-assert-interface.lo go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo go-check-interface.lo go-construct-map.lo go-convert-interface.lo go-copy.lo go-defer.lo go-deferred-recover.lo go-eface-compare.lo go-eface-val-compare.lo go-ffi.lo go-fieldtrack.lo go-int-array-to-string.lo go-int-to-string.lo go-interface-compare.lo go-interface-eface-compare.lo go-interface-val-compare.lo go-make-slice.lo go-map-delete.lo go-map-index.lo go-map-len.lo go-map-range.lo go-matherr.lo go-memcmp.lo go-nanotime.lo go-now.lo go-new-map.lo go-new.lo go-nosys.lo go-panic.lo go-print.lo go-recover.lo go-reflect-call.lo go-reflect-map.lo go-rune.lo go-runtime-error.lo go-setenv.lo go-signal.lo go-strcmp.lo go-string-to-byte-array.lo go-string-to-int-array.lo go-strplus.lo go-strslice.lo go-traceback.lo go-type-complex.lo go-type-eface.lo go-type-error.lo go-type-float.lo go-type-identity.lo go-type-interface.lo go-type-string.lo go-typedesc-equal.lo go-unsafe-new.lo go-unsafe-newarray.lo go-unsafe-pointer.lo go-unsetenv.lo go-unwind.lo go-varargs.lo env_posix.lo heapdump.lo lock_futex.lo thread-linux.lo mcache.lo mcentral.lo mem.lo mfixalloc.lo mgc0.lo mheap.lo msize.lo netpoll_epoll.lo panic.lo parfor.lo print.lo proc.lo runtime.lo signal_unix.lo thread.lo yield.lo chan.lo cpuprof.lo go-iface.lo lfstack.lo malloc.lo map.lo mprof.lo netpoll.lo rdebug.lo reflect.lo runtime1.lo sema.lo sigqueue.lo string.lo time.lo getncpu-linux.lo bufio.lo bytes.lo bytes/index.lo crypto.lo encoding.lo errors.lo expvar.lo flag.lo fmt.lo hash.lo html.lo image.lo io.lo log.lo math.lo mime.lo net.lo os.lo path.lo reflect-go.lo reflect/makefunc_ffi_c.lo regexp.lo runtime-go.lo sort.lo strconv.lo strings.lo strings/index.lo sync.lo syscall.lo syscall/clone_linux.lo syscall/errno.lo syscall/signame.lo syscall/wait.lo testing.lo time-go.lo unicode.lo archive/tar.lo archive/zip.lo compress/bzip2.lo compress/flate.lo compress/gzip.lo compress/lzw.lo compress/zlib.lo container/heap.lo container/list.lo container/ring.lo crypto/aes.lo crypto/cipher.lo crypto/des.lo crypto/dsa.lo crypto/ecdsa.lo crypto/elliptic.lo crypto/hmac.lo crypto/md5.lo crypto/rand.lo crypto/rc4.lo crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo crypto/sha512.lo crypto/subtle.lo crypto/tls.lo crypto/x509.lo crypto/x509/pkix.lo database/sql.lo database/sql/driver.lo debug/dwarf.lo debug/elf.lo debug/gosym.lo debug/macho.lo debug/pe.lo debug/plan9obj.lo encoding/ascii85.lo encoding/asn1.lo encoding/base32.lo encoding/base64.lo encoding/binary.lo encoding/csv.lo encoding/gob.lo encoding/hex.lo encoding/json.lo encoding/pem.lo encoding/xml.lo exp/proxy.lo exp/terminal.lo html/template.lo go/ast.lo go/build.lo go/constant.lo go/doc.lo go/format.lo go/importer.lo go/internal/gcimporter.lo go/internal/gccgoimporter.lo go/parser.lo go/printer.lo go/scanner.lo go/token.lo go/types.lo hash/adler32.lo hash/crc32.lo hash/crc64.lo hash/fnv.lo net/http/cgi.lo net/http/cookiejar.lo net/http/fcgi.lo net/http/httptest.lo net/http/httputil.lo net/http/internal.lo net/http/pprof.lo image/color.lo image/color/palette.lo image/draw.lo image/gif.lo image/internal/imageutil.lo image/jpeg.lo image/png.lo index/suffixarray.lo internal/golang.org/x/net/http2/hpack.lo internal/race.lo internal/singleflight.lo internal/syscall/unix.lo internal/testenv.lo internal/trace.lo io/ioutil.lo log/syslog.lo log/syslog/syslog_c.lo math/big.lo math/cmplx.lo math/rand.lo mime/multipart.lo mime/quotedprintable.lo net/http.lo net/internal/socktest.lo net/mail.lo net/rpc.lo net/smtp.lo net/textproto.lo net/url.lo old/regexp.lo old/template.lo os/exec.lo os/signal.lo os/user.lo path/filepath.lo regexp/syntax.lo net/rpc/jsonrpc.lo runtime/debug.lo runtime/pprof.lo sync/atomic.lo sync/atomic_c.lo text/scanner.lo text/tabwriter.lo text/template.lo text/template/parse.lo testing/iotest.lo testing/quick.lo unicode/utf16.lo unicode/utf8.lo ../libbacktrace/libbacktrace.la ../libatomic/libatomic_convenience.la ../libffi/libffi_convenience.la -lpthread -lm libtool: link: /<<PKGBUILDDIR>>/build/./gcc/xgcc -B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/powerpc64le-linux-gnu/bin/ -B/usr/powerpc64le-linux-gnu/lib/ -isystem /usr/powerpc64le-linux-gnu/include -isystem /usr/powerpc64le-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -shared .libs/go-append.o .libs/go-assert.o .libs/go-assert-interface.o .libs/go-byte-array-to-string.o .libs/go-breakpoint.o .libs/go-caller.o .libs/go-callers.o .libs/go-can-convert-interface.o .libs/go-cdiv.o .libs/go-cgo.o .libs/go-check-interface.o .libs/go-construct-map.o .libs/go-convert-interface.o .libs/go-copy.o .libs/go-defer.o .libs/go-deferred-recover.o .libs/go-eface-compare.o .libs/go-eface-val-compare.o .libs/go-ffi.o .libs/go-fieldtrack.o .libs/go-int-array-to-string.o .libs/go-int-to-string.o .libs/go-interface-compare.o .libs/go-interface-eface-compare.o .libs/go-interface-val-compare.o .libs/go-make-slice.o .libs/go-map-delete.o .libs/go-map-index.o .libs/go-map-len.o .libs/go-map-range.o .libs/go-matherr.o .libs/go-memcmp.o .libs/go-nanotime.o .libs/go-now.o .libs/go-new-map.o .libs/go-new.o .libs/go-nosys.o .libs/go-panic.o .libs/go-print.o .libs/go-recover.o .libs/go-reflect-call.o .libs/go-reflect-map.o .libs/go-rune.o .libs/go-runtime-error.o .libs/go-setenv.o .libs/go-signal.o .libs/go-strcmp.o .libs/go-string-to-byte-array.o .libs/go-string-to-int-array.o .libs/go-strplus.o .libs/go-strslice.o .libs/go-traceback.o .libs/go-type-complex.o .libs/go-type-eface.o .libs/go-type-error.o .libs/go-type-float.o .libs/go-type-identity.o .libs/go-type-interface.o .libs/go-type-string.o .libs/go-typedesc-equal.o .libs/go-unsafe-new.o .libs/go-unsafe-newarray.o .libs/go-unsafe-pointer.o .libs/go-unsetenv.o .libs/go-unwind.o .libs/go-varargs.o .libs/env_posix.o .libs/heapdump.o .libs/lock_futex.o .libs/thread-linux.o .libs/mcache.o .libs/mcentral.o .libs/mem.o .libs/mfixalloc.o .libs/mgc0.o .libs/mheap.o .libs/msize.o .libs/netpoll_epoll.o .libs/panic.o .libs/parfor.o .libs/print.o .libs/proc.o .libs/runtime.o .libs/signal_unix.o .libs/thread.o .libs/yield.o .libs/chan.o .libs/cpuprof.o .libs/go-iface.o .libs/lfstack.o .libs/malloc.o .libs/map.o .libs/mprof.o .libs/netpoll.o .libs/rdebug.o .libs/reflect.o .libs/runtime1.o .libs/sema.o .libs/sigqueue.o .libs/string.o .libs/time.o .libs/getncpu-linux.o .libs/bufio.o .libs/bytes.o bytes/.libs/index.o .libs/crypto.o .libs/encoding.o .libs/errors.o .libs/expvar.o .libs/flag.o .libs/fmt.o .libs/hash.o .libs/html.o .libs/image.o .libs/io.o .libs/log.o .libs/math.o .libs/mime.o .libs/net.o .libs/os.o .libs/path.o .libs/reflect-go.o reflect/.libs/makefunc_ffi_c.o .libs/regexp.o .libs/runtime-go.o .libs/sort.o .libs/strconv.o .libs/strings.o strings/.libs/index.o .libs/sync.o .libs/syscall.o syscall/.libs/clone_linux.o syscall/.libs/errno.o syscall/.libs/signame.o syscall/.libs/wait.o .libs/testing.o .libs/time-go.o .libs/unicode.o archive/.libs/tar.o archive/.libs/zip.o compress/.libs/bzip2.o compress/.libs/flate.o compress/.libs/gzip.o compress/.libs/lzw.o compress/.libs/zlib.o container/.libs/heap.o container/.libs/list.o container/.libs/ring.o crypto/.libs/aes.o crypto/.libs/cipher.o crypto/.libs/des.o crypto/.libs/dsa.o crypto/.libs/ecdsa.o crypto/.libs/elliptic.o crypto/.libs/hmac.o crypto/.libs/md5.o crypto/.libs/rand.o crypto/.libs/rc4.o crypto/.libs/rsa.o crypto/.libs/sha1.o crypto/.libs/sha256.o crypto/.libs/sha512.o crypto/.libs/subtle.o crypto/.libs/tls.o crypto/.libs/x509.o crypto/x509/.libs/pkix.o database/.libs/sql.o database/sql/.libs/driver.o debug/.libs/dwarf.o debug/.libs/elf.o debug/.libs/gosym.o debug/.libs/macho.o debug/.libs/pe.o debug/.libs/plan9obj.o encoding/.libs/ascii85.o encoding/.libs/asn1.o encoding/.libs/base32.o encoding/.libs/base64.o encoding/.libs/binary.o encoding/.libs/csv.o encoding/.libs/gob.o encoding/.libs/hex.o encoding/.libs/json.o encoding/.libs/pem.o encoding/.libs/xml.o exp/.libs/proxy.o exp/.libs/terminal.o html/.libs/template.o go/.libs/ast.o go/.libs/build.o go/.libs/constant.o go/.libs/doc.o go/.libs/format.o go/.libs/importer.o go/internal/.libs/gcimporter.o go/internal/.libs/gccgoimporter.o go/.libs/parser.o go/.libs/printer.o go/.libs/scanner.o go/.libs/token.o go/.libs/types.o hash/.libs/adler32.o hash/.libs/crc32.o hash/.libs/crc64.o hash/.libs/fnv.o net/http/.libs/cgi.o net/http/.libs/cookiejar.o net/http/.libs/fcgi.o net/http/.libs/httptest.o net/http/.libs/httputil.o net/http/.libs/internal.o net/http/.libs/pprof.o image/.libs/color.o image/color/.libs/palette.o image/.libs/draw.o image/.libs/gif.o image/internal/.libs/imageutil.o image/.libs/jpeg.o image/.libs/png.o index/.libs/suffixarray.o internal/golang.org/x/net/http2/.libs/hpack.o internal/.libs/race.o internal/.libs/singleflight.o internal/syscall/.libs/unix.o internal/.libs/testenv.o internal/.libs/trace.o io/.libs/ioutil.o log/.libs/syslog.o log/syslog/.libs/syslog_c.o math/.libs/big.o math/.libs/cmplx.o math/.libs/rand.o mime/.libs/multipart.o mime/.libs/quotedprintable.o net/.libs/http.o net/internal/.libs/socktest.o net/.libs/mail.o net/.libs/rpc.o net/.libs/smtp.o net/.libs/textproto.o net/.libs/url.o old/.libs/regexp.o old/.libs/template.o os/.libs/exec.o os/.libs/signal.o os/.libs/user.o path/.libs/filepath.o regexp/.libs/syntax.o net/rpc/.libs/jsonrpc.o runtime/.libs/debug.o runtime/.libs/pprof.o sync/.libs/atomic.o sync/.libs/atomic_c.o text/.libs/scanner.o text/.libs/tabwriter.o text/.libs/template.o text/template/.libs/parse.o testing/.libs/iotest.o testing/.libs/quick.o unicode/.libs/utf16.o unicode/.libs/utf8.o -Wl,--whole-archive ../libbacktrace/.libs/libbacktrace.a ../libatomic/.libs/libatomic_convenience.a ../libffi/.libs/libffi_convenience.a -Wl,--no-whole-archive -lpthread -lm -pthread -fsplit-stack -Wl,-z -Wl,relro -pthread -Wl,-soname -Wl,libgo.so.9 -o .libs/libgo.so.9.0.0 /usr/bin/powerpc64le-linux-gnu-ld.gold: -fuse-ld=gold: unexpected argument /usr/bin/powerpc64le-linux-gnu-ld.gold: use the --help option for usage information collect2: error: ld returned 1 exit status Makefile:2726: recipe for target 'libgo.la' failed make[6]: *** [libgo.la] Error 1 make[6]: Leaving directory '/<<PKGBUILDDIR>>/build/powerpc64le-linux-gnu/libgo' Makefile:4339: recipe for target 'all-recursive' failed make[5]: *** [all-recursive] Error 1 make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/powerpc64le-linux-gnu/libgo' Makefile:2591: recipe for target 'all' failed make[4]: *** [all] Error 2
not seen on x86, arm* and s390x archs
This isn't a gold bug. The gcc driver should not be passing -fuse-ld on to gold.
Incidentally, if you add -v -Wl,-v to the xgcc command line you should see collect2 being invoked with -fuse-ld=gold. collect2 ought to eat that option.
hmm, I'm wondering why I only see that with binutils trunk on powerpc64le...
Possibly something to do with your build environment for powerpc64le. Check whether collect2 is being run.
Please reconsider. collect2 has always passed through -fuse-ld=<gold|bfd> to the linker, and gold has accepted (and ignored) it until the recent commit 7ef67ba5339 that was supposed to fix PR 22042. Now gold simply segfaults when given the option without an argument, while before it was ignored (as intended). And the functionality that was supposed to ignore the option does not work anymore for some reason. $ gdb --args /mnt/build/binutils/gold/ld.gold -fuse-ld [...] (gdb) r Starting program: /mnt/build/binutils/gold/ld.gold -fuse-ld bt Program received signal SIGSEGV, Segmentation fault. gold::options::parse_string (option_name=0x7fffffffe18e "-fuse-ld", arg=0x0, retval=retval@entry=0x7fffffff7200) at /mnt/checkout/binutils-gdb/gold/options.cc:253 253 if (*arg == '\0') (gdb) bt #0 gold::options::parse_string (option_name=0x7fffffffe18e "-fuse-ld", arg=0x0, retval=retval@entry=0x7fffffff7200) at /mnt/checkout/binutils-gdb/gold/options.cc:253 #1 0x0000000000429f03 in gold::General_options::Struct_fuse_ld::parse_to_value (this=0x7fffffff7198, option_name=<optimized out>, arg=<optimized out>) at /mnt/checkout/binutils-gdb/gold/options.h:895 #2 0x000000000065a047 in gold::Command_line::process_one_option (this=this@entry=0x7fffffff4b30, argc=argc@entry=1, argv=argv@entry=0x7fffffffde30, i=i@entry=0, no_more_options=no_more_options@entry=0x7fffffff3fdf) at /mnt/checkout/binutils-gdb/gold/options.cc:1523 #3 0x000000000065b985 in gold::Command_line::process (this=this@entry=0x7fffffff4b30, argc=1, argv=0x7fffffffde30) at /mnt/checkout/binutils-gdb/gold/options.cc:1565 #4 0x0000000000407c3a in main (argc=<optimized out>, argv=<optimized out>) at /mnt/checkout/binutils-gdb/gold/main.cc:165
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=930b5f8bfb8e2d971f459c570d248714183a08d5 commit 930b5f8bfb8e2d971f459c570d248714183a08d5 Author: Cary Coutant <ccoutant@gmail.com> Date: Mon Jan 15 10:05:54 2018 -0800 Fix -fuse-ld option to accept string argument. PR 22042 complained that garbage text was being printed in the help for the -fuse-ld option; this was caused by passing an empty string to the gettext() function, which sometimes returns garbage when passed an empty string. The quick fix was to replace "" with NULL as the helparg, but that changed the parsing of the option, as gold uses the helparg to determine whether an option takes an argument. This patch adds a non-empty helparg string to fix both problems. gold/ PR gold/22694 * options.h (-fuse-ld): Add correct helparg.
Fixed on trunk.
The binutils-2_30-branch branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=75400e01f206ad383ab15a40e13086c2f9cc795b commit 75400e01f206ad383ab15a40e13086c2f9cc795b Author: Cary Coutant <ccoutant@gmail.com> Date: Mon Jan 15 10:05:54 2018 -0800 Fix -fuse-ld option to accept string argument. PR 22042 complained that garbage text was being printed in the help for the -fuse-ld option; this was caused by passing an empty string to the gettext() function, which sometimes returns garbage when passed an empty string. The quick fix was to replace "" with NULL as the helparg, but that changed the parsing of the option, as gold uses the helparg to determine whether an option takes an argument. This patch adds a non-empty helparg string to fix both problems. gold/ PR gold/22694 * options.h (-fuse-ld): Add correct helparg.