system.cc (5268:5bfc53fe60e7) | system.cc (5543:3af77710f397) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 120 unchanged lines hidden (view full) --- 129 * Mips binaries may have multiple global offset table (GOT) 130 * sections. A function that uses the GOT starts with a 131 * two-instruction prolog which sets the global pointer (gp == r29) to 132 * the appropriate GOT section. The proper gp value is calculated 133 * based on the function address, which must be passed by the caller 134 * in the procedure value register (pv aka t12 == r27). This sequence 135 * looks like the following: 136 * | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 120 unchanged lines hidden (view full) --- 129 * Mips binaries may have multiple global offset table (GOT) 130 * sections. A function that uses the GOT starts with a 131 * two-instruction prolog which sets the global pointer (gp == r29) to 132 * the appropriate GOT section. The proper gp value is calculated 133 * based on the function address, which must be passed by the caller 134 * in the procedure value register (pv aka t12 == r27). This sequence 135 * looks like the following: 136 * |
137 * opcode Ra Rb offset 138 * ldah gp,X(pv) 09 29 27 X 139 * lda gp,Y(gp) 08 29 29 Y | 137 * opcode Ra Rb offset 138 * ldah gp,X(pv) 09 29 27 X 139 * lda gp,Y(gp) 08 29 29 Y |
140 * 141 * for some constant offsets X and Y. The catch is that the linker 142 * (or maybe even the compiler, I'm not sure) may recognize that the 143 * caller and callee are using the same GOT section, making this 144 * prolog redundant, and modify the call target to skip these 145 * instructions. If we check for execution of the first instruction 146 * of a function (the one the symbol points to) to detect when to skip 147 * it, we'll miss all these modified calls. It might work to --- 75 unchanged lines hidden --- | 140 * 141 * for some constant offsets X and Y. The catch is that the linker 142 * (or maybe even the compiler, I'm not sure) may recognize that the 143 * caller and callee are using the same GOT section, making this 144 * prolog redundant, and modify the call target to skip these 145 * instructions. If we check for execution of the first instruction 146 * of a function (the one the symbol points to) to detect when to skip 147 * it, we'll miss all these modified calls. It might work to --- 75 unchanged lines hidden --- |