-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
I would like to create symbols (variables, constants, functions) that may not be directly referenced, but need to exist in the executable for one reason or another. I'm imagining adding a keep bool field to compiler.globalInfo and case "//go:used" or case "//go:keep" to globalInfo.parsePragmas. Then something would need to be added to keep the symbol, maybe in compiler.getGlobal.
I would be happy to create a PR implementing this, but I can't for the life of me figure out how to mark a global as "this will be used, do not optimize it away". There must be some way to do it, because clang respects __attribute((used)), but googling "clang used attribute" is not effective.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request