Create a symbol table using LLVM's pass

At compile time, I want to create a symbol table to implement a map : < Function name, function pointer >. And the newly created symbol table can finally be rendered in an executable program. I don’t know if I can do this, I looked up LLVM ::ValueSymbolTable, but I don’t know if the content created with it is only valid in the IR phase, or if it can also be rendered in the final executable.

It’s not clear what you mean by “function pointer” is this the address of the generated code in the executable? If so, then you are duplicating information that is already available in the object-file’s symbol table (although perhaps in a more convenient form). It should not be hard to generate that kind of data.

But, if by “function pointer” you mean a pointer to the IR Function instance, that’s not possible; nothing about the IR survives to the final executable.

What I want to ask you is exactly the second content you mentioned, thank you for your answer! I’ll consider other options.