Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: dead-code elimination for empty init functions #34869
Adding these functions to a package should have no effect:
However, today they currently still emit empty functions (complete with DWARF debugging), which get linked into the inittasks array.
It's probably a simple task for sinit.go to recognize that the init function is empty and then skip processing it further.
CL 200958 adds skipping empty init function feature without any tests for it. A codegen test sounds ideal, but it's unlikely that we can make one for now, so use a program to manipulate runtime/proc.go:initTask directly. Updates #34869 Change-Id: I2683b9a1ace36af6861af02a3a9fb18b3110b282 Reviewed-on: https://go-review.googlesource.com/c/go/+/204217 Run-TryBot: Cuong Manh Le <firstname.lastname@example.org> Reviewed-by: Matthew Dempsky <email@example.com> Reviewed-by: Keith Randall <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com>