Skip to content

cmd/link: 386 and amd64 hosts produce different 386 binaries #22193

@starius

Description

@starius

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

1.9.1

Does this issue reproduce with the latest release?

Yes

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

Host: Linux amd64 and 386, Darwin amd64.
Target: {amd64, 386} {Linux, Darwin, Windows}.

What did you do?

I built the following program (located in $GOPATH/src/test/main.go):

package main

import "os"
import "os/signal"

func main() {
    sig := make(chan os.Signal, 10)
    signal.Stop(sig)
}

with the following command:

GOOS=linux GOARCH=386 go install -a -tags netgo -ldflags='-s -w' test

on two host machines: Linux amd64 and Linux 386.
The produced binaries were different.

I wrote a script that installs Go 1.4 which installs Go 1.9.1 which installs another Go 1.9.1 (as suggested on the IRC channel) which builds the program.

Results:

host=linux_amd64
* 6764b1c25110b5050739ea420d21707fe7f60c8f0f60e5aa0edc16a9ba1ed958  /tmp/gopath/bin/darwin_386/test
  099d1ea0f08c12961871062175ed1eb0f08a9c3711a04ae7b065ed464d0f7c4e  /tmp/gopath/bin/darwin_amd64/test
* 85b7da6f6627c34e50ba1801380ad28dad07cb8409c13afef78f02c0c4f3cc7d  /tmp/gopath/bin/linux_386/test
  0f56ffbe56fb47d76e34a174ca9a16e948ed31d0f1966d3ad3a9e4413bc21288  /tmp/gopath/bin/linux_amd64/test
* cccfac9dc10b2fe184581904bae8ae32a593f2d7369689ea8de92d42d82e4f8e  /tmp/gopath/bin/windows_386/test.exe
  0b9fd63afa1b5212a71912a5fa7b92d016fa53fdab7a6bd3368ff92cfeb87def  /tmp/gopath/bin/windows_amd64/test.exe

host=linux_386
* 4b356f6d7e5f8f236aa2340223bb4b6e96cd955f3615cd84d06f1fbeafc71bf2  /tmp/gopath/bin/darwin_386/test
  099d1ea0f08c12961871062175ed1eb0f08a9c3711a04ae7b065ed464d0f7c4e  /tmp/gopath/bin/darwin_amd64/test
* 9a0522c00d1b989650342efba689bd9d332fc3290d085a16949c626ce0822f02  /tmp/gopath/bin/linux_386/test
  0f56ffbe56fb47d76e34a174ca9a16e948ed31d0f1966d3ad3a9e4413bc21288  /tmp/gopath/bin/linux_amd64/test
* 35d36ded359656d9ae5dfa7f68a30585a0c327c622720bb34fbdf34dda912c0e  /tmp/gopath/bin/windows_386/test.exe
  0b9fd63afa1b5212a71912a5fa7b92d016fa53fdab7a6bd3368ff92cfeb87def  /tmp/gopath/bin/windows_amd64/test.exe

386 binaries for all 3 OS (Linux, Windows, Darwin) are different when building on Linux amd64 and Linux 386. However both hosts produce amd64 binaries that are exactly the same on any OS.

Darwin amd64 host produces the same binaries as Linux amd64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions