mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for darwin. The reader unconditionally handles this, and the writer could turn this on for more targets if we care. This change has two benefits for darwin: 1) it allows us to encode the cpu type of the file in an easy to read place that doesn't require decoding the bc file. 2) it works around a bug (IMO) in darwin's AR where it is incapable of handling files that are not a multiple of 8 bytes long. BC files are only guaranteed to be multiples of 4 bytes long. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53275 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -157,6 +157,15 @@ public:
|
||||
Emit(Val, CurCodeSize);
|
||||
}
|
||||
|
||||
// BackpatchWord - Backpatch a 32-bit word in the output with the specified
|
||||
// value.
|
||||
void BackpatchWord(unsigned ByteNo, unsigned NewWord) {
|
||||
Out[ByteNo++] = (unsigned char)(NewWord >> 0);
|
||||
Out[ByteNo++] = (unsigned char)(NewWord >> 8);
|
||||
Out[ByteNo++] = (unsigned char)(NewWord >> 16);
|
||||
Out[ByteNo ] = (unsigned char)(NewWord >> 24);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Block Manipulation
|
||||
//===--------------------------------------------------------------------===//
|
||||
@ -227,10 +236,7 @@ public:
|
||||
unsigned ByteNo = B.StartSizeWord*4;
|
||||
|
||||
// Update the block size field in the header of this sub-block.
|
||||
Out[ByteNo++] = (unsigned char)(SizeInWords >> 0);
|
||||
Out[ByteNo++] = (unsigned char)(SizeInWords >> 8);
|
||||
Out[ByteNo++] = (unsigned char)(SizeInWords >> 16);
|
||||
Out[ByteNo++] = (unsigned char)(SizeInWords >> 24);
|
||||
BackpatchWord(ByteNo, SizeInWords);
|
||||
|
||||
// Restore the inner block's code size and abbrev table.
|
||||
CurCodeSize = B.PrevCodeSize;
|
||||
|
Reference in New Issue
Block a user