[llvm-commits] [llvm] r106608 - /llvm/trunk/lib/MC/MachObjectWriter.cpp
Eric Christopher
echristo at apple.com
Tue Jun 22 16:51:47 PDT 2010
Author: echristo
Date: Tue Jun 22 18:51:47 2010
New Revision: 106608
URL: http://llvm.org/viewvc/llvm-project?rev=106608&view=rev
Log:
Get the addend correct for i386 pic.
Thanks Daniel!
Modified:
llvm/trunk/lib/MC/MachObjectWriter.cpp
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=106608&r1=106607&r2=106608&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Tue Jun 22 18:51:47 2010
@@ -747,7 +747,6 @@
!Is64Bit &&
"Should only be called with a 32-bit TLVP relocation!");
- // If this is a subtraction then we're pcrel.
unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());
uint32_t Value = Layout.getFragmentOffset(Fragment)+Fixup.getOffset();
unsigned IsPCRel = 0;
@@ -761,7 +760,14 @@
// between the picbase and the next address. For 32-bit static the addend
// is zero.
if (Target.getSymB()) {
+ // If this is a subtraction then we're pcrel.
+ uint32_t FixupAddress =
+ Layout.getFragmentAddress(Fragment) + Fixup.getOffset();
+ MCSymbolData *SD_B = &Asm.getSymbolData(Target.getSymB()->getSymbol());
IsPCRel = 1;
+ FixedValue = (FixupAddress - Layout.getSymbolAddress(SD_B) +
+ Target.getConstant());
+ FixedValue += 1 << Log2Size;
} else {
FixedValue = 0;
}
More information about the llvm-commits
mailing list