mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
MemoryBuffer: Increase the alignment of small file buffers to 16
This was manifesting as an LLVM_ASSUME_ALIGNED() failure in an ELF debug info test when building LLVM with clang in the Microsoft C++ ABI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ea53c6ae30
commit
9291a78aa8
@ -131,9 +131,10 @@ MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
|
|||||||
StringRef BufferName) {
|
StringRef BufferName) {
|
||||||
// Allocate space for the MemoryBuffer, the data and the name. It is important
|
// Allocate space for the MemoryBuffer, the data and the name. It is important
|
||||||
// that MemoryBuffer and data are aligned so PointerIntPair works with them.
|
// that MemoryBuffer and data are aligned so PointerIntPair works with them.
|
||||||
|
// TODO: Is 16-byte alignment enough? We copy small object files with large
|
||||||
|
// alignment expectations into this buffer.
|
||||||
size_t AlignedStringLen =
|
size_t AlignedStringLen =
|
||||||
RoundUpToAlignment(sizeof(MemoryBufferMem) + BufferName.size() + 1,
|
RoundUpToAlignment(sizeof(MemoryBufferMem) + BufferName.size() + 1, 16);
|
||||||
sizeof(void*)); // TODO: Is sizeof(void*) enough?
|
|
||||||
size_t RealLen = AlignedStringLen + Size + 1;
|
size_t RealLen = AlignedStringLen + Size + 1;
|
||||||
char *Mem = static_cast<char*>(operator new(RealLen, std::nothrow));
|
char *Mem = static_cast<char*>(operator new(RealLen, std::nothrow));
|
||||||
if (!Mem) return 0;
|
if (!Mem) return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user