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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@go101
Copy link

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
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 17, 2021
@odeke-em odeke-em added this to the Go1.16 milestone Jan 17, 2021
@odeke-em
Copy link
Member

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 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

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

/cc @cherrymui

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

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

@golang golang locked and limited conversation to collaborators Jan 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants