[llvm-commits] [llvm] r121198 - /llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
Bill Wendling
isanbard at gmail.com
Tue Dec 7 15:11:00 PST 2010
Author: void
Date: Tue Dec 7 17:11:00 2010
New Revision: 121198
URL: http://llvm.org/viewvc/llvm-project?rev=121198&view=rev
Log:
Cleanup in the Darwin end. No functionality change.
Modified:
llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp?rev=121198&r1=121197&r2=121198&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Tue Dec 7 17:11:00 2010
@@ -165,9 +165,8 @@
void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, char *Data,
unsigned DataSize, uint64_t Value) const {
unsigned NumBytes = 4; // FIXME: 2 for Thumb
-
Value = adjustFixupValue(Fixup.getKind(), Value);
- if (!Value) return; // No need to encode nothing.
+ if (!Value) return; // Doesn't change encoding.
unsigned Offset = Fixup.getOffset();
assert(Offset % NumBytes == 0 && "Offset mod NumBytes is nonzero!");
@@ -207,6 +206,7 @@
}
};
+/// getFixupKindNumBytes - The number of bytes the fixup may change.
static unsigned getFixupKindNumBytes(unsigned Kind) {
switch (Kind) {
default:
@@ -227,13 +227,15 @@
unsigned DataSize, uint64_t Value) const {
unsigned NumBytes = getFixupKindNumBytes(Fixup.getKind());
Value = adjustFixupValue(Fixup.getKind(), Value);
+ if (!Value) return; // Doesn't change encoding.
+
+ unsigned Offset = Fixup.getOffset();
+ assert(Offset + NumBytes <= DataSize && "Invalid fixup offset!");
- assert(Fixup.getOffset() + NumBytes <= DataSize &&
- "Invalid fixup offset!");
// For each byte of the fragment that the fixup touches, mask in the
// bits from the fixup value.
for (unsigned i = 0; i != NumBytes; ++i)
- Data[Fixup.getOffset() + i] |= uint8_t(Value >> (i * 8));
+ Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);
}
} // end anonymous namespace
More information about the llvm-commits
mailing list