I am writing an LLVM plugin. In it, I create a global array of pointers that take data along the flow of different functions in the program. When pointers take an address in a function scope, it is logical to assume that, once outside their scope, there is a risk that the content of the memory will be overwritten as the OS sees fit.
I would like to know if there is a way to make the content of the pointer unvariable (unless I find myself in the need to change it) through all scopes, of course, inside the program.
I thought that a flag like volatile
would do the trick, but it seems like all this does is preserve its sequential position in comparison to non-volatile instructions.