summaryrefslogtreecommitdiff
path: root/include/llvm/Support/OutputBuffer.h
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-07 21:22:38 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-07 21:22:38 +0000
commita029a27fae25628fa7805aba6d7ae3216a4e026b (patch)
tree5f353df4c5e7e55748682c997d11b1e0e014f36c /include/llvm/Support/OutputBuffer.h
parentfaeedf1254a4f79004cb94c3d2b738f138af450e (diff)
downloadllvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.gz
llvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.bz2
llvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.xz
Simple ELF32/64 binary files can now be emitted for x86 and x86_64 without
relocation sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73038 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/OutputBuffer.h')
-rw-r--r--include/llvm/Support/OutputBuffer.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm/Support/OutputBuffer.h b/include/llvm/Support/OutputBuffer.h
index b2077c5514..1adff2d270 100644
--- a/include/llvm/Support/OutputBuffer.h
+++ b/include/llvm/Support/OutputBuffer.h
@@ -134,11 +134,22 @@ namespace llvm {
P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255;
P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255;
}
+ void fixxword(uint64_t X, unsigned Offset) {
+ unsigned char *P = &Output[Offset];
+ P[0] = (X >> (isLittleEndian ? 0 : 56)) & 255;
+ P[1] = (X >> (isLittleEndian ? 8 : 48)) & 255;
+ P[2] = (X >> (isLittleEndian ? 16 : 40)) & 255;
+ P[3] = (X >> (isLittleEndian ? 24 : 32)) & 255;
+ P[4] = (X >> (isLittleEndian ? 32 : 24)) & 255;
+ P[5] = (X >> (isLittleEndian ? 40 : 16)) & 255;
+ P[6] = (X >> (isLittleEndian ? 48 : 8)) & 255;
+ P[7] = (X >> (isLittleEndian ? 56 : 0)) & 255;
+ }
void fixaddr(uint64_t X, unsigned Offset) {
if (!is64Bit)
fixword((unsigned)X, Offset);
else
- assert(0 && "Emission of 64-bit data not implemented yet!");
+ fixxword(X, Offset);
}
unsigned char &operator[](unsigned Index) {