Changeset 2976
- Timestamp:
- Feb 15, 2007, 4:30:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModMachO.c
r2975 r2976 1961 1961 * Calc the symbol value. 1962 1962 */ 1963 /* The addend is stored in the code. */ 1964 /** @todo Deal with unaligned accesses on non x86 platforms. */ 1963 /* Calc the linked symbol address / addend. */ 1965 1964 switch (Fixup.r.r_length) 1966 1965 { 1966 /** @todo Deal with unaligned accesses on non x86 platforms. */ 1967 1967 case 0: SymAddr = *uFixVirgin.pi8; break; 1968 1968 case 1: SymAddr = *uFixVirgin.pi16; break; … … 1971 1971 } 1972 1972 if (Fixup.r.r_pcrel) 1973 SymAddr += Fixup.r.r_address ;1973 SymAddr += Fixup.r.r_address + pFixupSect->LinkAddress; 1974 1974 1975 1975 /* Add symbol / section address. */ … … 1993 1993 pSymSect = &pModMachO->paSections[pSym->n_sect - 1]; 1994 1994 1995 SymAddr += pSym->n_value - p ModMachO->LinkAddress + pSymSect->RVA;1995 SymAddr += pSym->n_value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; 1996 1996 break; 1997 1997 } … … 2017 2017 2018 2018 SymAddr -= pSymSect->LinkAddress; 2019 SymAddr += NewBaseAddress + pSymSect->RVA;2019 SymAddr += pSymSect->RVA + NewBaseAddress; 2020 2020 } 2021 2021 … … 2055 2055 SymAddr -= Value; /* (-> addend only) */ 2056 2056 2057 /* Calc the section number from the r_value and adjust the value in case the section moved. */2057 /* Find the section number from the r_value. */ 2058 2058 pSymSect = NULL; 2059 2059 for (iSymSect = 0; iSymSect < pModMachO->cSections; iSymSect++) … … 2070 2070 if (!pSymSect) 2071 2071 return KLDR_ERR_BAD_FIXUP; 2072 Value -= pSymSect->LinkAddress;2073 2072 2074 2073 /* Calc the symbol address. */ 2075 SymAddr += NewBaseAddress + pSymSect->RVA + Value;2074 SymAddr += Value - pSymSect->LinkAddress + pSymSect->RVA + NewBaseAddress; 2076 2075 if (Fixup.s.r_pcrel) 2077 2076 SymAddr -= Fixup.s.r_address + pFixupSect->RVA + NewBaseAddress;
Note:
See TracChangeset
for help on using the changeset viewer.