Emitting an extra section with meta-information

Hi LLVM developers,

tldr: what kind of pass should I use when I want to read IR
information + mangled names, that can add a section to the final
object file?

I have the following plan: collect all IR symbol information (global
variables, public functions, types), serialize this into some nice
protocol and then append it to assemblies in a section. The idea is to
make it possible to link two of these IR-annotated assemblies without
the need for language specific header files. So for Clang it might
mean that if we introduce a new C keyword like "using 'object.o'" it
would be able to link to object.o without the need for a header file.

Now this is all fine, and probably way too ambitious and much work,
but I'd like to start small and just find out how I could emit an
extra section, and put some information about the code in there.

I think I have to put this in a CodeGen pass, but it seems all CodeGen
passes must inherit from MachineFunctionPass, which only gets called
for MachineFunctions, which I think I don't want.

Ideally my pass would be a ModulePass. All information I need is what
public functions are there, what public variables/constants are there,
what are their types, what are their names, and what are their mangled
names (for looking them up in the symbol table, alternatively their
relocatable addresses, but that would probably complicate things).

So my question would be, what kind of pass would I have to define to
read IR information + mangled names, and to write a new section to the
object file?

Thanks in advance,
Tinco