[solved] What sections to modify in a loaded module?
Posted: Thu Jun 21, 2012 6:54 pm
Hi!
I'm loading modules into the kernel. Unresolved references in the module I'm trying to load is read from the elf symbol table of the kernel itself. This works fine. Now I want one module to be able to resolve references against another previously loaded module. This means that the previously loaded module probably need to be modified after it has been loaded (meaning that it's sections should need to reflect it's currently loaded state).
My question is: What is the de facto way to modify a loaded module?
I can solve it in a few different ways. One way could be to just set the entry address of the module to the value of where it is currently loaded in memory and base my relocations off that. Another is that I could modify all entries in the symbol table and add an offset. There are probably more ways than that but which one would you consider to be the correct one?
I'm loading modules into the kernel. Unresolved references in the module I'm trying to load is read from the elf symbol table of the kernel itself. This works fine. Now I want one module to be able to resolve references against another previously loaded module. This means that the previously loaded module probably need to be modified after it has been loaded (meaning that it's sections should need to reflect it's currently loaded state).
My question is: What is the de facto way to modify a loaded module?
I can solve it in a few different ways. One way could be to just set the entry address of the module to the value of where it is currently loaded in memory and base my relocations off that. Another is that I could modify all entries in the symbol table and add an offset. There are probably more ways than that but which one would you consider to be the correct one?