-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.20.1 darwin/arm64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="on" GOARCH="arm64" GOBIN="" GOCACHE="/Users/jarrettkuklis/Library/Caches/go-build" GOENV="/Users/jarrettkuklis/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/jarrettkuklis/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/username/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/username/go/go1.20.1" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/username/go/go1.20.1/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.20.1" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/username/Documents/GolandProjects/efi/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kw/8msl9lzx7wbdbq4xxtz3rhvr0000gn/T/go-build1473043980=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Cross-compile an empty main function to linux with -R=0x1000 and -T=0x40000000 linker flags.
GOOS=linux go build -o a.out -ldflags="-R 0x1000 -T 0x40000000" ./test
What did you expect to see?
The text segment start at 0x40000000. (Example linked with +0xFFF)
$ readelf -Wl a.out
Elf file type is EXEC (Executable file)
Entry point 0x400535d0
There are 7 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x000000004000003f 0x000000004000003f 0x000188 0x000188 R 0x1000
NOTE 0x000f9c 0x0000000040000f9b 0x0000000040000f9b 0x000064 0x000064 R 0x4
LOAD 0x000001 0x0000000040000000 0x0000000040000000 0x054da0 0x054da0 R E 0x1000
LOAD 0x055000 0x0000000040055000 0x0000000040055000 0x065098 0x065098 R 0x1000
LOAD 0x0bb000 0x00000000400bb000 0x00000000400bb000 0x0034c0 0x03ac90 RW 0x1000
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x8
LOOS+0x5041580 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0x8
Section to Segment mapping:
Segment Sections...
00
01 note.go.buildid
02 text note.go.buildid
03 rodata typelink itablink gosymtab gopclntab
04 go.buildinfo noptrdata data bss noptrbss
05
06
What did you see instead?
The text segment starts at 0x3FFFF000.
$ readelf -Wl a.out
Elf file type is EXEC (Executable file)
Entry point 0x400525d0
There are 7 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x000000003ffff040 0x000000003ffff040 0x000188 0x000188 R 0x1000
NOTE 0x000f9c 0x000000003fffff9c 0x000000003fffff9c 0x000064 0x000064 R 0x4
LOAD 0x000000 0x000000003ffff000 0x000000003ffff000 0x054da0 0x054da0 R E 0x1000
LOAD 0x055000 0x0000000040054000 0x0000000040054000 0x065098 0x065098 R 0x1000
LOAD 0x0bb000 0x00000000400ba000 0x00000000400ba000 0x0034c0 0x03ac90 RW 0x1000
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x8
LOOS+0x5041580 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0x8
Section to Segment mapping:
Segment Sections...
00
01 .note.go.buildid
02 .text .note.go.buildid
03 .rodata .typelink .itablink .gosymtab .gopclntab
04 .go.buildinfo .noptrdata .data .bss .noptrbss
05
06
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.