This patch implements CodeGen support for the "declare target" directive.
Code is generated for variables, functions and ctors/dtors.
I understand that the patch as a whole is somewhat large; if this is the case and it cannot land in one go then let's discuss how it can be split. Due to this uncertainty I haven't included any regression tests, I'll upload them once the scope of each patch has been determined.
Why do you need these additional parameters?