Delay reading global metadata until the first function or the end of
the file is emitted. That way, earlier module passes can set metadata
that is emitted in the ELF.
emitStartOfAsmFile gets called when the passes are initialized,
which prevented earlier passes from changing the metadata.
This fixes issues encountered after converting
AMDGPUResourceUsageAnalysis to a Module pass in D117504.
This feels like an abuse of the pass manager. You're not supposed to depend on passes on other functions from a function pass. What pass is setting this metadata? Is it a module pass?