Use trivial types to avoid calls to new for globals
To avoid initialization ordering problem avoid constructing
non-trivial global objects for linker_logger.
This patch also adds explicit check for bloc_size_ on alloc
Change-Id: I2cb3b13a10b7fac1f52a20038af77266d3e1da96
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index 57811d8..7deddea 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -15,6 +15,7 @@
*/
#include "linker_allocator.h"
+#include "linker_debug.h"
#include "linker.h"
#include <algorithm>
@@ -73,6 +74,8 @@
: type_(0), block_size_(0), free_pages_cnt_(0), free_blocks_list_(nullptr) {}
void* LinkerSmallObjectAllocator::alloc() {
+ CHECK(block_size_ != 0);
+
if (free_blocks_list_ == nullptr) {
alloc_page();
}