Changes in directory llvm/lib/Target/PowerPC:
PPCMachOWriterInfo.cpp updated: 1.4 -> 1.5 PPCMachOWriterInfo.h updated: 1.3 -> 1.4 --- Log message: More Mach-O writer improvements. --- Diffs of the changes: (+16 -6) PPCMachOWriterInfo.cpp | 20 +++++++++++++++----- PPCMachOWriterInfo.h | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.4 llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.5 --- llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp:1.4 Thu Feb 8 00:05:08 2007 +++ llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp Wed Feb 28 01:40:50 2007 @@ -35,13 +35,11 @@ unsigned ToIdx, OutputBuffer &RelocOut, OutputBuffer &SecOut, - bool Scattered) const { + bool Scattered, + bool isExtern) const { unsigned NumRelocs = 0; uint64_t Addr = 0; - // Keep track of whether or not this is an externally defined relocation. - bool isExtern = false; - // Get the address of whatever it is we're relocating, if possible. if (!isExtern) Addr = (uintptr_t)MR.getResultPointer() + ToAddr; @@ -83,12 +81,24 @@ break; case PPC::reloc_pcrel_bx: { + // FIXME: Presumably someday we will need to branch to other, non-extern + // functions too. Need to figure out some way to distinguish between + // target is BB and target is function. + if (isExtern) { + MachORelocation BR24(MR.getMachineCodeOffset(), ToIdx, true, 2, + isExtern, PPC_RELOC_BR24, Scattered, + (intptr_t)MR.getMachineCodeOffset()); + RelocOut.outword(BR24.getAddress()); + RelocOut.outword(BR24.getPackedFields()); + ++NumRelocs; + } + Addr -= MR.getMachineCodeOffset(); Addr >>= 2; Addr &= 0xFFFFFF; Addr <<= 2; Addr |= (SecOut[MR.getMachineCodeOffset()] << 24); - + Addr |= (SecOut[MR.getMachineCodeOffset()+3] & 0x3); SecOut.fixword(Addr, MR.getMachineCodeOffset()); break; } Index: llvm/lib/Target/PowerPC/PPCMachOWriterInfo.h diff -u llvm/lib/Target/PowerPC/PPCMachOWriterInfo.h:1.3 llvm/lib/Target/PowerPC/PPCMachOWriterInfo.h:1.4 --- llvm/lib/Target/PowerPC/PPCMachOWriterInfo.h:1.3 Fri Feb 2 20:41:58 2007 +++ llvm/lib/Target/PowerPC/PPCMachOWriterInfo.h Wed Feb 28 01:40:50 2007 @@ -34,7 +34,7 @@ unsigned ToIdx, OutputBuffer &RelocOut, OutputBuffer &SecOut, - bool Scattered) const; + bool Scattered, bool Extern) const; // Constants for the relocation r_type field. // See <mach-o/ppc/reloc.h> _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits