On Fri, Sep 28, 2018 at 12:43 AM,  <amand...@cohesity.com> wrote:
> Seems like even that does not seem to work. Please see:
>
> amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ sudo
> GOPATH=/opt/go_pkgs  CGO_CFLAGS='-m64' CGO_LDFLAGS='-m64' go install -x
> -gccgoflags=-m64
> WORK=/tmp/go-build357879094
> mkdir -p $WORK/b001/
> cd $WORK
> /usr/gnu/bin/gccgo -fgo-importcfg=/dev/null -c -x c - || true
> cd /opt/go_pkgs/src/github.com/golang/glog
> /usr/gnu/bin/gccgo -c -g -fdebug-prefix-map=$WORK=/tmp/go-build
> -gno-record-gcc-switches -fgo-pkgpath=github.com/golang/glog -o
> $WORK/b001/_go_.o -I $WORK/b001/_importcfgroot_ -m64 ./glog.go
> ./glog_file.go
> echo '  .section .go.buildid,"e"' >> $WORK/b001/_buildid.s
> echo '  .byte 0x64,0x71,0x65,0x31,0x73,0x55,0x39,0x39' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x62,0x56,0x7a,0x36,0x52,0x57,0x35,0x74' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x64,0x55,0x59,0x4f,0x2f,0x64,0x71,0x65' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x31,0x73,0x55,0x39,0x39,0x62,0x56,0x7a' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x36,0x52,0x57,0x35,0x74,0x64,0x55,0x59' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x4f' >> $WORK/b001/_buildid.s
> echo '' >> $WORK/b001/_buildid.s
> /usr/gnu/bin/gccgo -xassembler-with-cpp -I $WORK/b001/ -c -o
> $WORK/b001/_buildid.o -D GOOS_solaris -D GOARCH_sparc -D
> GOPKGPATH=github_com_golang_glog $WORK/b001/_buildid.s
> ar rcD $WORK/b001/_pkg_.a $WORK/b001/_go_.o $WORK/b001/_buildid.o
> /usr/gnu/libexec/gcc/sparc-sun-solaris2.11/8.2.1/buildid -w
> $WORK/b001/_pkg_.a # internal
> cp $WORK/b001/_pkg_.a
> /root/.cache/go-build/9d/9de1b3b9dc941395e2c0ba0bd363f9af9f8dc5c62c84b2d248c274ba14a2bcd7-d
> # internal
> mkdir -p /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/
> cp $WORK/b001/_pkg_.a
> /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/libglog.a
> rm -r $WORK/b001/
> amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ file
> /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/libglog.a
> /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/libglog.a:
> current ar archive, 32-bit symbol table
>
> In the above output, I can see that -m64 flag is being passed to gcc, but
> somehow does not seem to apply everywhere (one of the gccgo invocation does
> not have -m64 flag). I tried to look at the generated archive and one of the
> members is still 32bit  MSB executable. Please look:
>
> amandeep@s113ldom1:~/workspace$ ar -t
> /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/libglog.a
> _go_.o
> _buildid.o
> amandeep@s113ldom1:~/workspace$ ar -xv
> /opt/go_pkgs/pkg/gccgo_solaris_sparc/github.com/golang/libglog.a ./_go_.o
> ./_buildid.o
> x - _go_.o
> x - _buildid.o
> amandeep@s113ldom1:~/workspace$ file ./_buildid.o
> ./_buildid.o:   ELF 32-bit MSB relocatable SPARC Version 1
> amandeep@s113ldom1:~/workspace$ file ./_go_.o
> ./_go_.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1
>
> Could that be the reason?
>
> I also tried providing GOARCH=sprac64 flag to see if that helps, but it
> didn't. Similar output, just the file is generated in a different folder.
> Please see:
>
> amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ sudo
> GOPATH=/opt/go_pkgs  CGO_CFLAGS='-m64' CGO_LDFLAGS='-m64' GOARCH=sparc64
> CGO_ENABLED=1 go install -x -gccgoflags=-m64
> WORK=/tmp/go-build328208181
> mkdir -p $WORK/b001/
> cd $WORK
> /usr/gnu/bin/gccgo -fgo-importcfg=/dev/null -c -x c - || true
> cd /opt/go_pkgs/src/github.com/golang/glog
> /usr/gnu/bin/gccgo -c -g -fdebug-prefix-map=$WORK=/tmp/go-build
> -gno-record-gcc-switches -fgo-pkgpath=github.com/golang/glog -o
> $WORK/b001/_go_.o -I $WORK/b001/_importcfgroot_ -m64 ./glog.go
> ./glog_file.go
> echo '  .section .go.buildid,"e"' >> $WORK/b001/_buildid.s
> echo '  .byte 0x79,0x71,0x58,0x37,0x74,0x64,0x76,0x6c' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x7a,0x59,0x53,0x39,0x41,0x6a,0x30,0x58' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x34,0x53,0x78,0x39,0x2f,0x79,0x71,0x58' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x37,0x74,0x64,0x76,0x6c,0x7a,0x59,0x53' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x39,0x41,0x6a,0x30,0x58,0x34,0x53,0x78' >>
> $WORK/b001/_buildid.s
> echo '  .byte 0x39' >> $WORK/b001/_buildid.s
> echo '' >> $WORK/b001/_buildid.s
> /usr/gnu/bin/gccgo -xassembler-with-cpp -I $WORK/b001/ -c -o
> $WORK/b001/_buildid.o -D GOOS_solaris -D GOARCH_sparc64 -D
> GOPKGPATH=github_com_golang_glog $WORK/b001/_buildid.s
> ar rcD $WORK/b001/_pkg_.a $WORK/b001/_go_.o $WORK/b001/_buildid.o
> /usr/gnu/libexec/gcc/sparc-sun-solaris2.11/8.2.1/buildid -w
> $WORK/b001/_pkg_.a # internal
> cp $WORK/b001/_pkg_.a
> /root/.cache/go-build/a4/a47820a6bcb6e72c26a3be36129e80b12a0f0193dd5959e2c7304a3b169d9af8-d
> # internal
> mkdir -p /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/
> cp $WORK/b001/_pkg_.a
> /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a
> rm -r $WORK/b001/
> amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ file
> /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a
> /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a:
> current ar archive, 32-bit symbol table
>
> I also gave compiling the helloworld file a try with this newly generated
> lib (with different flags) but the compilation still faces the previous
> problem. Did I miss something? Please let me know.

OK, new suggestion.  Also set the environment variable CC="gcc -m64".

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to