public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug go/63731] New: Fallback to netgo does not work
@ 2014-11-04  8:08 yohei at jp dot ibm.com
  2014-11-14  4:15 ` [Bug go/63731] " yohei at jp dot ibm.com
                   ` (31 more replies)
  0 siblings, 32 replies; 33+ messages in thread
From: yohei at jp dot ibm.com @ 2014-11-04  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63731
           Summary: Fallback to netgo does not work
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: yohei at jp dot ibm.com
                CC: cmang at google dot com

When the DNS resolver with CGO fails for statically linked binaries, it should
fall back to the pure-go DNS resolver, if I understand correctly.

This fallback mechanism does work at least on Linux for x86_64 and ppc64le.

The variable ok in lookupIP in go/net/lookup_unix.go seems always set to true,
so the fallback mechanism would never be called.

Here is an example code to demonstrate the problem.

$ gccgo -v
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/usr/local/gccgo-216834/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --enable-threads=posix --enable-shared
--enable-__cxa_atexit --enable-languages=c,c++,go --enable-secureplt
--enable-checking=yes --with-long-double-128 --enable-decimal-float
--disable-bootstrap --disable-alsa --disable-multilib
--prefix=/usr/local/gccgo-216834
Thread model: posix
gcc version 5.0.0 20141029 (experimental) (GCC) 

$ cat lookup.go 
package main

import (
    "fmt"
    "net"
)

func main() {
    addrs, err := net.LookupHost("gcc.gnu.org")
    if err != nil {
        fmt.Println(err)
    } else {
        for i := 0; i < len(addrs); i++ {
            fmt.Println(addrs[i])
        }
    }
}

$ gccgo lookup.go 
$ ./a.out 
209.132.180.131
$ gccgo -static lookup.go 
/usr/local/gccgo-216834/lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../lib64/libgo.a(net.o):
In function `net.cgoLookupPort':
/home/yohei/gccgo.216834/bld/x86_64-unknown-linux-gnu/libgo/../../../src/libgo/go/net/cgo_unix.go:83:
warning: Using 'getaddrinfo' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
$ ./a.out 
lookup gcc.gnu.org: Name or service not known
$ LD_LIBRARY_PATH=/lib/x86_64-linux-gnu ./a.out 
209.132.180.131


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2015-04-08 14:41 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-04  8:08 [Bug go/63731] New: Fallback to netgo does not work yohei at jp dot ibm.com
2014-11-14  4:15 ` [Bug go/63731] " yohei at jp dot ibm.com
2014-11-14  4:49 ` yohei at jp dot ibm.com
2014-11-14 15:54 ` ian at airs dot com
2014-11-17  8:16 ` yohei at jp dot ibm.com
2014-11-17 15:44 ` ian at airs dot com
2014-11-17 18:27 ` boger at us dot ibm.com
2014-11-18  0:24 ` ian at airs dot com
2014-11-18  6:15 ` yohei at jp dot ibm.com
2014-11-18 13:16 ` boger at us dot ibm.com
2014-11-18 13:52 ` yohei at jp dot ibm.com
2014-11-19 20:32 ` boger at us dot ibm.com
2014-11-20 13:25 ` boger at us dot ibm.com
2014-11-20 14:49 ` yohei at jp dot ibm.com
2014-11-20 20:02 ` boger at us dot ibm.com
2014-11-21  4:26 ` ian at airs dot com
2014-11-21 15:12 ` boger at us dot ibm.com
2014-11-21 17:10 ` ian at airs dot com
2014-11-25 15:35 ` boger at us dot ibm.com
2014-12-03 13:03 ` yohei at jp dot ibm.com
2014-12-03 16:10 ` boger at us dot ibm.com
2014-12-03 18:39 ` boger at us dot ibm.com
2014-12-03 19:17 ` ian at airs dot com
2015-02-28 10:16 ` e29253 at jp dot ibm.com
2015-02-28 21:01 ` ian at airs dot com
2015-03-01 23:40 ` ian at airs dot com
2015-03-02 21:58 ` boger at us dot ibm.com
2015-03-02 23:34 ` ian at airs dot com
2015-03-31 16:06 ` boger at us dot ibm.com
2015-04-01 14:11 ` boger at us dot ibm.com
2015-04-07 18:10 ` ian at airs dot com
2015-04-07 18:10 ` ian at gcc dot gnu.org
2015-04-08 14:41 ` boger at us dot ibm.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).