Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: crash on undefined functions #43748

Closed
go101 opened this issue Jan 17, 2021 · 5 comments
Closed

cmd/link: crash on undefined functions #43748

go101 opened this issue Jan 17, 2021 · 5 comments

Comments

@go101
Copy link

@go101 go101 commented Jan 17, 2021

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

$ go version
go version go1.16beta1 linux/amd64

Does this issue reproduce with the latest release?

Not on the the 1.15.5 stable release.

What did you do?

package main

import "C"

func main() {}

var a func() = f

var b = g()

func f()

func g() int {
	a()
	return 0
}

What did you expect to see?

Reports main.f·f: relocation target main.f not defined as the stable release.

What did you see instead?

Crash:

# command-line-arguments
main.f·f: relocation target main.f not defined
main.f·f: reloc 1 (R_ADDR) to non-elf symbol main.f (outer=main.f) 0 (Sxxx)
panic: elfrelocsect: size mismatch 1179176 != 1087592 + 91560

goroutine 75 [running]:
cmd/link/internal/ld.elfrelocsect(0xc000146000, 0xc0001422a0, 0xc00052e2a0, 0xc00053e000, 0x11cf, 0x11cf)
	/usr/local/go/src/cmd/link/internal/ld/elf.go:1126 +0xe65
cmd/link/internal/ld.relocSectFn.func1.1(0x6f23c8, 0xc000146000, 0xc0001422a0, 0xc00052e2a0, 0xc00053e000, 0x11cf, 0x11cf, 0xc000d6d900, 0xc000144460)
	/usr/local/go/src/cmd/link/internal/ld/asmb.go:202 +0x66
created by cmd/link/internal/ld.relocSectFn.func1
	/usr/local/go/src/cmd/link/internal/ld/asmb.go:201 +0x1bd
@seankhliao seankhliao changed the title cmd/compiler: crash on undefined functions cmd/compile: crash on undefined functions Jan 17, 2021
@odeke-em odeke-em added this to the Go1.16 milestone Jan 17, 2021
@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jan 17, 2021

Thank you @go101 for this report, thank you @seankhliao for the triage; happy New Year to the both of you!

This is a regression from Go1.15, and thus I have marked it as a release blocker. Kindly cc-ing @mdempsky @cuonglm @ianlancetaylor, and I'll also take a look too.

@mdempsky mdempsky self-assigned this Jan 17, 2021
@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 17, 2021

I see the same issue with Go 1.15.6, so I don't think this is a release blocker?

Edit: Not the exact same failure, but it still fails to build with Go 1.15.6. So not a regression.

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 17, 2021

The program isn't valid anyway, unless there are additional files that weren't included in the report. You can't have a program that depends on function main.f, but then not supply a definition for it.

@mdempsky mdempsky modified the milestones: Go1.16, Go1.17 Jan 17, 2021
@mdempsky mdempsky changed the title cmd/compile: crash on undefined functions cmd/link: crash on undefined functions Jan 17, 2021
@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 17, 2021

@mdempsky mdempsky removed their assignment Jan 17, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 19, 2021

Change https://golang.org/cl/284576 mentions this issue: cmd/link: exit before Asmb2 if error

@gopherbot gopherbot closed this in ccb2e90 Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants