This is the frontend part of .ref enablement. It works with D122198, and implements below items:
(1) variable to init/term functions (required to add functions to _cdtors array if the variable is included in linker output)
(2) dtor function to term function (required to correctly handle atexit/unatexit registration/unregistration)
Should we use addVarTermAssoc?