On Thu, Jul 9, 2020 at 9:40 AM Atilla Filiz <ati...@fi-tech.be> wrote:
>
> As part of porting to powerpc440 effort, we are using gccgo to port Docker.
>
> I am confused about the -X flag. What is the gccgo equivalent of using -X 
> importpath.name=value to set string variables in some go files.
>
> The following command
>
> GO111MODULE=off GOARCH=ppc 
> GOCACHE="/workspace/output/cr/host/usr/share/go-cache" GOROOT="""" 
> CC="/workspace/output/cr/host/bin/powerpc-buildroot-linux-gnu-gcc" 
> CXX="/workspace/output/cr/host/bin/powerpc-buildroot-linux-gnu-g++" 
> GOTOOLDIR="""/pkg/tool/linux_ppc" 
> GCCGO="/workspace/output/cr/host/bin/powerpc-buildroot-linux-gnu-gccgo" 
> PATH="/workspace/output/cr/host/bin:/workspace/output/cr/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
>  GOBIN= CGO_ENABLED=1 
> GOPATH="/workspace/output/cr/build/docker-cli-19.03.5/gopath" CGO_ENABLED=0 
> ""/workspace/buildroot/../toolchains/powerpc-buildroot-linux-gnu_sdk-buildroot"/bin/go"
>  build  -v -compiler gccgo -gccgoflags='-static 
> -Lvendor/golang.org/x/sys/unix -lgccgo_c -X 
> github.com/docker/cli/cli.Version=19.03.5' -tags "autogen" -p 17 -o 
> /workspace/output/cr/build/docker-cli-19.03.5/bin/docker ./cmd/docker
>
> fails with
>
> powerpc-buildroot-linux-gnu-gccgo: error: 
> github.com/docker/cli/cli.Version=19.03.5: No such file or directory
> powerpc-buildroot-linux-gnu-gccgo: error: unrecognized command line option 
> '-X'
>
> as if we tried to pass the options to gcc or ld.
>
> The same command is supposed to work with gc, as the original flag was there 
> in buildroot, but failed to build when we switched to gccgo.

Unfortunately there really isn't an equivalent to -X when using gccgo.
The design of gccgo is to use the system linker, and system linkers
don't support an option like this.

I think it would be possible to do some sort of code generation in the
go tool  to implement this for gccgo, but nobody has done that work.

Sorry.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUA-50NLFTunvJw-Y9MHd9-JZxqqnH0mVPx%2BsagzSze0g%40mail.gmail.com.

Reply via email to