Merge "Fix x86 dynamic linker build."

This commit is contained in:
Elliott Hughes 2012-12-18 18:16:09 -08:00 committed by Gerrit Code Review
commit 4b58214205
2 changed files with 6 additions and 5 deletions

View File

@ -26,14 +26,15 @@
* SUCH DAMAGE.
*/
#include <stdint.h>
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 */

View File

@ -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;