Fix linker compilation when STATS is set
Test: Compiles with STATS set in linker_debug.h
Change-Id: I8ea6ca9a61ad316473dab51999885008f2721cee
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 55d684f..ac7455b 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -282,6 +282,14 @@
void count_relocation(RelocationKind kind) {
++linker_stats.count[kind];
}
+
+void print_linker_stats() {
+ PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol", g_argv[0],
+ linker_stats.count[kRelocAbsolute],
+ linker_stats.count[kRelocRelative],
+ linker_stats.count[kRelocCopy],
+ linker_stats.count[kRelocSymbol]);
+}
#else
void count_relocation(RelocationKind) {
}
diff --git a/linker/linker.h b/linker/linker.h
index 0f30946..a26b79d 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -99,6 +99,8 @@
void count_relocation(RelocationKind kind);
+void print_linker_stats();
+
soinfo* get_libdl_info(const soinfo& linker_si);
soinfo* find_containing_library(const void* p);
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 612f52f..11d3d29 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -490,11 +490,7 @@
static_cast<long long>(t0.tv_usec))));
#endif
#if STATS
- PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol", g_argv[0],
- linker_stats.count[kRelocAbsolute],
- linker_stats.count[kRelocRelative],
- linker_stats.count[kRelocCopy],
- linker_stats.count[kRelocSymbol]);
+ print_linker_stats();
#endif
#if COUNT_PAGES
{