- Timestamp:
- Feb 13, 2007, 11:59:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModMachO.c
r2964 r2968 62 62 /** The size of the section (in bytes). */ 63 63 KLDRSIZE cb; 64 /** The link address of this section. */ 65 KLDRADDR LinkAddress; 64 66 /** The RVA of this section. */ 65 67 KLDRADDR RVA; … … 835 837 pSectExtra->cb = pSect->size; 836 838 pSectExtra->RVA = pSect->addr; 839 pSectExtra->LinkAddress = pSect->addr; 837 840 pSectExtra->offFile = pSect->offset ? pSect->offset : -1; 838 841 pSectExtra->cFixups = pSect->nreloc; … … 1965 1968 case 3: SymAddr = *uFixVirgin.pi64; break; 1966 1969 } 1970 if (Fixup.r.r_pcrel) 1971 SymAddr += Fixup.r.r_address; 1967 1972 1968 1973 /* Add symbol / section address. */ … … 2008 2013 return KLDR_ERR_BAD_FIXUP; 2009 2014 pSymSect = &pModMachO->paSections[Fixup.r.r_symbolnum - 1]; 2015 2016 SymAddr -= pSymSect->LinkAddress; 2010 2017 SymAddr += NewBaseAddress + pSymSect->RVA; 2011 2018 } … … 2041 2048 case 3: SymAddr = *uFixVirgin.pi64; break; 2042 2049 } 2050 if (Fixup.s.r_pcrel) 2051 Value += Fixup.s.r_address; 2043 2052 2044 2053 /* Calc the section number from the r_value and adjust the value. */ 2045 2054 pSymSect = NULL; 2046 Value = Fixup.s.r_value - pModMachO->LinkAddress;2055 Value = Fixup.s.r_value; 2047 2056 for (iSymSect = 0; iSymSect < pModMachO->cSections; iSymSect++) 2048 2057 { 2049 KLDRADDR off = Value - pModMachO->paSections[iSymSect]. RVA;2058 KLDRADDR off = Value - pModMachO->paSections[iSymSect].LinkAddress; 2050 2059 if (off < pModMachO->paSections[iSymSect].cb) 2051 2060 { … … 2058 2067 if (!pSymSect) 2059 2068 return KLDR_ERR_BAD_FIXUP; 2060 2061 /** @todo this looking up of the r_value section isn't strictly required unless we're going to remove sections from the link. */ 2062 SymAddr += NewBaseAddress + pSymSect->RVA + (Value - pSymSect->RVA); 2063 2064 /* adjust for PC relative */ 2069 Value -= pSymSect->LinkAddress; 2070 2071 /* Calc the symbol address. */ 2072 SymAddr += NewBaseAddress + pSymSect->RVA + Value; 2065 2073 if (Fixup.s.r_pcrel) 2066 2074 SymAddr -= Fixup.s.r_address + pFixupSect->RVA + NewBaseAddress;
Note:
See TracChangeset
for help on using the changeset viewer.