From 45288c5ce3d2a40f1426fbeb099e3a90cd10dc20 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 18 Dec 2012 18:13:19 -0800 Subject: [PATCH] Fix x86 dynamic linker build. Change-Id: Ia9fc6342e3d409de86dcd187c7402e8ac2ae96c8 --- linker/arch/x86/begin.c | 5 +++-- linker/linker_format.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/linker/arch/x86/begin.c b/linker/arch/x86/begin.c index 2ca15c4e9..4f3e0ab3a 100755 --- a/linker/arch/x86/begin.c +++ b/linker/arch/x86/begin.c @@ -26,14 +26,15 @@ * SUCH DAMAGE. */ +#include + extern unsigned __linker_init(unsigned int *elfdata); __attribute__((visibility("hidden"))) void _start() { - void *elfdata; void (*start)(void); - elfdata = __builtin_frame_address(0) + sizeof(void *); + void* elfdata = (void*) ((uintptr_t) __builtin_frame_address(0) + sizeof(void*)); start = (void(*)(void))__linker_init(elfdata); /* linker init returns (%eax) the _entry address in the main image */ diff --git a/linker/linker_format.cpp b/linker/linker_format.cpp index 65c626447..c56d8a1a2 100644 --- a/linker/linker_format.cpp +++ b/linker/linker_format.cpp @@ -371,14 +371,14 @@ format_number(char *buffer, size_t bufsize, uint64_t value, int base, const char while (value) { unsigned d = value % base; value /= base; - if (pos < end) { + if (pos != end) { *pos++ = digits[d]; } } /* special case for 0 */ if (pos == buffer) { - if (pos < end) { + if (pos != end) { *pos++ = '0'; } } @@ -387,7 +387,7 @@ format_number(char *buffer, size_t bufsize, uint64_t value, int base, const char /* now reverse digit string in-place */ end = pos - 1; pos = buffer; - while (pos < end) { + while (pos != end) { int ch = pos[0]; pos[0] = end[0]; end[0] = (char) ch;