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, identifying globals, and determining whether globals are defined in the executable. If a global is not defined in the executable, a definition is created in the executable. A second method includes receiving a list of defined globals from instrumented PI code binary and comparing the list with globals in the PI code. Memory loads are created for globals that are unlisted. A third method includes compiling PI code with special relocations for globals and determining whether globals are defined in the executable. If the global is defined in the executable, the special relocation is replaced with a direct load of the global. If not, the special relocation is replaced with a two-instruction sequence that loads the global's address and then the global's value.
Abstract:
A system and method for detecting execution of unsupported instructions while testing multiversioned functions within software application code are disclosed. An example method includes annotating a software application's executable binary to distinguish functions that are directed to particular hardware variations. Functions with instructions that are unsupported by a simulated hardware platform variation on which the software application's annotated executable binary will run may then be detected. The contents of the detected functions may be rewritten with trap instructions. At runtime, when executing the software application on the simulated hardware platform variation running on a different physical hardware platform variation, responsive to execution of a function with instructions that are unsupported by the simulated hardware platform, terminating the software application based on the execution of the trap instructions. Execution of unsupported instructions may be detected based on the termination of the software application.
Abstract:
Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for receiving source code that contains a hot function that calls a multiversioned function, where a function definition of the multiversioned function specifies a first version and an alternative second version, and generating compiled code that includes a first and a second clone of the hot function, and a first and a second version of the multiversioned function. In the compiled code, the first clone of the hot function includes a direct call to the first version of the multiversioned function, and the second clone of the hot function includes a direct call to the second version of the multiversioned function.