/ go Public
cmd/link: possible linker bug when using the -T flag to set the text address #28257
Issues related to the Go compiler and/or runtime.
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
What did you do?
aarch64-elf-readelf -W -l -S bin/xxx_xxx/surprise
If possible, provide a recipe for reproducing the error.
I have found this error to be caused by any link that supplies an start address other than one ending in 0x1000. I was doing some experiments on arm (thus the aarch64 above) but I think this is actually in the offset calculations for the elf headers (section and program).
Commands like this seem to cause the problem (using the -T flag with something that doesn't end in 1000):
GOOS=xxx GOARCH=xxx go install -v -ldflags='-T 0x88000' github.com/iansmith/xxx/surprise/cmd/surprise
A complete runnable program is good.
A link on play.golang.org is best.
That link shows the diff to my "fix". My fix is clearly not the real one, but whoever wrote the code in elf.go (
go/src/cmd/link/internal/ld/elf.go) will probably see the problem immediately when they see what I have done.
What did you expect to see?
I expected to see normal elf section headers and program headers. After my (ahem) "fix", you get the normal output:
What did you see instead?
Note the negative value in the 3rd program header (the program text segment)! .shstrtab (section header string table) section has been overwritten so the names are garbage.
The text was updated successfully, but these errors were encountered: