Abstract:
Methods for reducing memory loads for accessing global variables (globals) when creating executables for position independent (PI) code are disclosed. A first method includes compiling PI code (404), identifying globals (405), and determining whether globals are defined in the executable (407). If a global is not defined in the executable, a definition is created in the executable (409). A second method includes receiving a list of defined globals from instrumented PI code binary (601) and comparing the list with globals in the PI code (607). Memory loads are created for globals that are unlisted (609). A third method includes compiling PI code with special relocations for globals (801) and determining whether globals are defined in the executable (803). If the global is defined in the executable, the special relocation is replaced with a direct load of the global (805). If not, the special relocation is replaced with a two-instruction sequence that loads the global's address and then the global's value (805).
Abstract:
Provided are methods and systems for removing Procedure Linkage Table (PLT) stubs from dynamically linked binaries. The methods and systems are designed to replace a call to an external function such that a global offset table entry is created for the function that will contain the address of the function and will be early bound. The call-site for the external function then performs one indirect call to the function using the global offset table entry containing the address of the external function.