Merge changes Ia880cd5a,I899c7801
* changes:
Cosmetic changes to linker allocator and config
Allow building the linker with -O0
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 56e85e4..fc6d102 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3133,7 +3133,7 @@
}
}
break;
-#endif // defined(R_GENERIC_TLSDESC)
+#endif // defined(__aarch64__)
#if defined(__aarch64__)
case R_AARCH64_ABS64:
@@ -3305,11 +3305,14 @@
}
}
+#if defined(__aarch64__)
+ // Bionic currently only implements TLSDESC for arm64.
for (const std::pair<TlsDescriptor*, size_t>& pair : deferred_tlsdesc_relocs) {
TlsDescriptor* desc = pair.first;
desc->func = tlsdesc_resolver_dynamic;
desc->arg = reinterpret_cast<size_t>(&tlsdesc_args_[pair.second]);
}
+#endif
return true;
}
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index fdb4c85..1e2f9a2 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -134,7 +134,7 @@
FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
first_block->next_block = free_block_list_;
- first_block->num_free_blocks = (kAllocateSize - sizeof(LinkerBlockAllocatorPage*))/block_size_;
+ first_block->num_free_blocks = sizeof(page->bytes) / block_size_;
free_block_list_ = first_block;
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 5a728d3..ba48b51 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -80,7 +80,7 @@
continue;
}
- if (line[0] == '[' && line[line.size() - 1] == ']') {
+ if (line[0] == '[' && line.back() == ']') {
*name = line.substr(1, line.size() - 2);
return kSection;
}