summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-08 10:57:59 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-08 10:57:59 +0000
commitd1c8a862218dba86e6ae4eee78d108dc0ab30d8a (patch)
treef05a0644dc8be7ae4f39c962a53c77678b9b428f /ldso
parented1a862cdb8e86db4de96fe5e25d0634207ad0ae (diff)
Cleanup whitespace and formatting
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/dl-elf.c207
-rw-r--r--ldso/ldso/dl-hash.c18
-rw-r--r--ldso/ldso/dl-startup.c70
-rw-r--r--ldso/ldso/hash.c18
-rw-r--r--ldso/ldso/ldso.c177
-rw-r--r--ldso/ldso/readelflib1.c207
-rw-r--r--ldso/ldso/startup.c70
7 files changed, 377 insertions, 390 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 75c5972bf..95889deef 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -1,12 +1,11 @@
/* vi: set sw=4 ts=4: */
-/* Program to load an ELF binary on a linux system, and run it
- * after resolving ELF shared library symbols
+/*
+ * This file contains the helper routines to load an ELF shared
+ * library into memory and add the symbol table info to the chain.
*
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
* Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
* David Engel, Hongjiu Lu and Mitch D'Souza
- * Copyright (C) 2001-2004 Erik Andersen
- *
- * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,8 +30,7 @@
*/
-/* This file contains the helper routines to load an ELF sharable
- library into memory and add the symbol table info to the chain. */
+#include "ldso.h"
#ifdef USE_CACHE
@@ -53,7 +51,7 @@ int _dl_map_cache(void)
return 0;
if (_dl_stat(LDSO_CACHE, &st)
- || (fd = _dl_open(LDSO_CACHE, O_RDONLY)) < 0) {
+ || (fd = _dl_open(LDSO_CACHE, O_RDONLY)) < 0) {
_dl_dprintf(2, "%s: can't open cache '%s'\n", _dl_progname, LDSO_CACHE);
_dl_cache_addr = (caddr_t) - 1; /* so we won't try again */
return -1;
@@ -64,21 +62,21 @@ int _dl_map_cache(void)
_dl_close(fd);
if (_dl_mmap_check_error(_dl_cache_addr)) {
_dl_dprintf(2, "%s: can't map cache '%s'\n",
- _dl_progname, LDSO_CACHE);
+ _dl_progname, LDSO_CACHE);
return -1;
}
header = (header_t *) _dl_cache_addr;
if (_dl_cache_size < sizeof(header_t) ||
- _dl_memcmp(header->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN)
- || _dl_memcmp(header->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN)
- || _dl_cache_size <
- (sizeof(header_t) + header->nlibs * sizeof(libentry_t))
- || _dl_cache_addr[_dl_cache_size - 1] != '\0')
+ _dl_memcmp(header->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN)
+ || _dl_memcmp(header->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN)
+ || _dl_cache_size <
+ (sizeof(header_t) + header->nlibs * sizeof(libentry_t))
+ || _dl_cache_addr[_dl_cache_size - 1] != '\0')
{
_dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname,
- LDSO_CACHE);
+ LDSO_CACHE);
goto fail;
}
@@ -88,7 +86,7 @@ int _dl_map_cache(void)
for (i = 0; i < header->nlibs; i++) {
if (libent[i].sooffset >= strtabsize ||
- libent[i].liboffset >= strtabsize)
+ libent[i].liboffset >= strtabsize)
{
_dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname, LDSO_CACHE);
goto fail;
@@ -97,7 +95,7 @@ int _dl_map_cache(void)
return 0;
- fail:
+fail:
_dl_munmap(_dl_cache_addr, _dl_cache_size);
_dl_cache_addr = (caddr_t) - 1;
return -1;
@@ -115,7 +113,6 @@ int _dl_unmap_cache(void)
return 0;
}
-
#endif
/* This function's behavior must exactly match that
@@ -233,13 +230,9 @@ struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libnam
}
-/*
- * Used to return error codes back to dlopen et. al.
- */
-
+/* Used to return error codes back to dlopen et. al. */
unsigned long _dl_error_number;
unsigned long _dl_internal_error_number;
-extern char *_dl_ldsopath;
struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname, int trace_loaded_objects)
@@ -301,7 +294,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#endif
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
}
}
@@ -312,10 +305,10 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
#endif
- if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
- {
- return tpnt1;
- }
+ if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
+ {
+ return tpnt1;
+ }
}
/*
@@ -335,10 +328,10 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#endif
for (i = 0; i < header->nlibs; i++) {
if ((libent[i].flags == LIB_ELF ||
- libent[i].flags == LIB_ELF_LIBC5) &&
- _dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
- (tpnt1 = _dl_load_elf_shared_library(secure,
- rpnt, strs + libent[i].liboffset)))
+ libent[i].flags == LIB_ELF_LIBC5) &&
+ _dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
+ (tpnt1 = _dl_load_elf_shared_library(secure,
+ rpnt, strs + libent[i].liboffset)))
return tpnt1;
}
}
@@ -347,11 +340,11 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
/* Look for libraries wherever the shared library loader
* was installed */
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching ldso dir='%s'\n", _dl_ldsopath);
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching ldso dir='%s'\n", _dl_ldsopath);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_ldsopath, rpnt)) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
@@ -361,14 +354,14 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching full lib path list\n");
#endif
if ((tpnt1 = search_for_named_library(libname, secure,
- UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib:"
- UCLIBC_RUNTIME_PREFIX "usr/lib:"
- UCLIBC_RUNTIME_PREFIX "lib:"
- "/usr/lib:"
- "/lib", rpnt)
- ) != NULL)
+ UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib:"
+ UCLIBC_RUNTIME_PREFIX "usr/lib:"
+ UCLIBC_RUNTIME_PREFIX "lib:"
+ "/usr/lib:"
+ "/lib", rpnt)
+ ) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
goof:
@@ -449,8 +442,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
return NULL;
}
- header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (_dl_mmap_check_error(header)) {
_dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -461,12 +454,12 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
_dl_read(infile, header, PAGE_SIZE);
epnt = (ElfW(Ehdr) *) (intptr_t) header;
if (epnt->e_ident[0] != 0x7f ||
- epnt->e_ident[1] != 'E' ||
- epnt->e_ident[2] != 'L' ||
- epnt->e_ident[3] != 'F')
+ epnt->e_ident[1] != 'E' ||
+ epnt->e_ident[2] != 'L' ||
+ epnt->e_ident[3] != 'F')
{
_dl_dprintf(2, "%s: '%s' is not an ELF file\n", _dl_progname,
- libname);
+ libname);
_dl_internal_error_number = LD_ERROR_NOTELF;
_dl_close(infile);
_dl_munmap(header, PAGE_SIZE);
@@ -475,14 +468,14 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if ((epnt->e_type != ET_DYN) || (epnt->e_machine != MAGIC1
#ifdef MAGIC2
- && epnt->e_machine != MAGIC2
+ && epnt->e_machine != MAGIC2
#endif
- ))
+ ))
{
_dl_internal_error_number =
- (epnt->e_type != ET_DYN ? LD_ERROR_NOTDYN : LD_ERROR_NOTMAGIC);
+ (epnt->e_type != ET_DYN ? LD_ERROR_NOTDYN : LD_ERROR_NOTMAGIC);
_dl_dprintf(2, "%s: '%s' is not an ELF executable for " ELF_TARGET
- "\n", _dl_progname, libname);
+ "\n", _dl_progname, libname);
_dl_close(infile);
_dl_munmap(header, PAGE_SIZE);
return NULL;
@@ -496,7 +489,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (ppnt->p_type == PT_DYNAMIC) {
if (dynamic_addr)
_dl_dprintf(2, "%s: '%s' has more than one dynamic section\n",
- _dl_progname, libname);
+ _dl_progname, libname);
dynamic_addr = ppnt->p_vaddr;
dynamic_size = ppnt->p_filesz;
};
@@ -525,7 +518,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
flags |= MAP_FIXED;
status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma),
- maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
+ maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -555,13 +548,13 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
char *cpnt;
status = (char *) _dl_mmap((char *) ((piclib ? libaddr : 0) +
- (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN)
- + ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile,
- ppnt->p_offset & OFFS_ALIGN);
+ (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN)
+ + ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile,
+ ppnt->p_offset & OFFS_ALIGN);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map '%s'\n",
- _dl_progname, libname);
+ _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
_dl_munmap((char *) libaddr, maxvma - minvma);
_dl_close(infile);
@@ -571,7 +564,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/* Pad the last page with zeroes. */
cpnt = (char *) (status + (ppnt->p_vaddr & ADDR_ALIGN) +
- ppnt->p_filesz);
+ ppnt->p_filesz);
while (((unsigned long) cpnt) & ADDR_ALIGN)
*cpnt++ = 0;
@@ -585,14 +578,14 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (map_size < ppnt->p_vaddr + ppnt->p_memsz)
status = (char *) _dl_mmap((char *) map_size +
- (piclib ? libaddr : 0),
- ppnt->p_vaddr + ppnt->p_memsz - map_size,
- LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS, -1, 0);
+ (piclib ? libaddr : 0),
+ ppnt->p_vaddr + ppnt->p_memsz - map_size,
+ LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS, -1, 0);
} else
status = (char *) _dl_mmap((char *) (ppnt->p_vaddr & PAGE_ALIGN)
- + (piclib ? libaddr : 0), (ppnt->p_vaddr & ADDR_ALIGN) +
- ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags,
- infile, ppnt->p_offset & OFFS_ALIGN);
+ + (piclib ? libaddr : 0), (ppnt->p_vaddr & ADDR_ALIGN) +
+ ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags,
+ infile, ppnt->p_offset & OFFS_ALIGN);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -626,8 +619,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (!dynamic_addr) {
_dl_internal_error_number = LD_ERROR_NODYNAMIC;
_dl_dprintf(2, "%s: '%s' is missing a dynamic section\n",
- _dl_progname, libname);
- _dl_munmap(header, PAGE_SIZE);
+ _dl_progname, libname);
+ _dl_munmap(header, PAGE_SIZE);
return NULL;
}
@@ -676,9 +669,9 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
for (i = 0; i < epnt->e_phnum; i++, ppnt++) {
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
_dl_mprotect((void *) ((piclib ? libaddr : 0) +
- (ppnt->p_vaddr & PAGE_ALIGN)),
- (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ (ppnt->p_vaddr & PAGE_ALIGN)),
+ (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
}
#else
_dl_dprintf(_dl_debug_file, "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n",libname);
@@ -687,7 +680,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
}
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,
- dynamic_addr, dynamic_size);
+ dynamic_addr, dynamic_size);
tpnt->ppnt = (ElfW(Phdr) *)(intptr_t) (tpnt->loadaddr + epnt->e_phoff);
tpnt->n_phent = epnt->e_phnum;
@@ -716,7 +709,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (lpnt) {
lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT] +
- ((int) libaddr));
+ ((int) libaddr));
INIT_GOT(lpnt, tpnt);
};
@@ -744,10 +737,10 @@ void _dl_dprintf(int fd, const char *fmt, ...)
static char *buf;
buf = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (_dl_mmap_check_error(buf)) {
- _dl_write(fd, "mmap of a spare page failed!\n", 29);
- _dl_exit(20);
+ _dl_write(fd, "mmap of a spare page failed!\n", 29);
+ _dl_exit(20);
}
start = ptr = buf;
@@ -773,38 +766,38 @@ void _dl_dprintf(int fd, const char *fmt, ...)
_dl_write(fd, start, _dl_strlen(start));
switch (*ptr++) {
- case 's':
- string = va_arg(args, char *);
-
- if (!string)
+ case 's':
+ string = va_arg(args, char *);
+
+ if (!string)
+ _dl_write(fd, "(null)", 6);
+ else
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+
+ case 'i':
+ case 'd':
+ {
+ char tmp[22];
+ num = va_arg(args, int);
+
+ string = _dl_simple_ltoa(tmp, num);
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+ }
+ case 'x':
+ case 'X':
+ {
+ char tmp[22];
+ num = va_arg(args, int);
+
+ string = _dl_simple_ltoahex(tmp, num);
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+ }
+ default:
_dl_write(fd, "(null)", 6);
- else
- _dl_write(fd, string, _dl_strlen(string));
- break;
-
- case 'i':
- case 'd':
- {
- char tmp[22];
- num = va_arg(args, int);
-
- string = _dl_simple_ltoa(tmp, num);
- _dl_write(fd, string, _dl_strlen(string));
- break;
- }
- case 'x':
- case 'X':
- {
- char tmp[22];
- num = va_arg(args, int);
-
- string = _dl_simple_ltoahex(tmp, num);
- _dl_write(fd, string, _dl_strlen(string));
- break;
- }
- default:
- _dl_write(fd, "(null)", 6);
- break;
+ break;
}
start = ptr;
@@ -916,8 +909,8 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
return goof;
tpnt->init_flag |= COPY_RELOCS_DONE;
goof += _dl_parse_copy_information(rpnt,
- tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
- tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
+ tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
+ tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) {
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index 1e4acd979..c33b329ec 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -79,7 +79,7 @@ struct elf_resolve *_dl_check_hashed_files(const char *libname)
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
if (_dl_strncmp(tpnt->libname, libname, len) == 0 &&
- (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
+ (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
return tpnt;
}
@@ -242,18 +242,18 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt1,
continue;
switch (ELF32_ST_BIND(sym->st_info)) {
- case STB_WEAK:
+ case STB_WEAK:
//Disable this to match current glibc behavior. Of course,
//this doesn't actually work yet and will cause segfaults...
#if 1
- if (!weak_result)
- weak_result = (char *)tpnt->loadaddr + sym->st_value;
- break;
+ if (!weak_result)
+ weak_result = (char *)tpnt->loadaddr + sym->st_value;
+ break;
#endif
- case STB_GLOBAL:
- return (char*)tpnt->loadaddr + sym->st_value;
- default: /* Local symbols not handled here */
- break;
+ case STB_GLOBAL:
+ return (char*)tpnt->loadaddr + sym->st_value;
+ default: /* Local symbols not handled here */
+ break;
}
}
}
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 0da911f8c..6a131633a 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -185,16 +185,16 @@ DL_BOOT(unsigned long args)
/* Check the ELF header to make sure everything looks ok. */
if (!header || header->e_ident[EI_CLASS] != ELFCLASS32 ||
- header->e_ident[EI_VERSION] != EV_CURRENT
+ header->e_ident[EI_VERSION] != EV_CURRENT
#if !defined(__powerpc__) && !defined(__mips__) && !defined(__sh__)
- || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0
+ || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0
#else
- || header->e_ident[EI_MAG0] != ELFMAG0
- || header->e_ident[EI_MAG1] != ELFMAG1
- || header->e_ident[EI_MAG2] != ELFMAG2
- || header->e_ident[EI_MAG3] != ELFMAG3
+ || header->e_ident[EI_MAG0] != ELFMAG0
+ || header->e_ident[EI_MAG1] != ELFMAG1
+ || header->e_ident[EI_MAG2] != ELFMAG2
+ || header->e_ident[EI_MAG3] != ELFMAG3
#endif
- ) {
+ ) {
SEND_STDERR("Invalid ELF header\n");
_dl_exit(0);
}
@@ -209,28 +209,28 @@ DL_BOOT(unsigned long args)
* happen to know what that is for this architecture. If not,
* we can always read stuff out of the ELF file to find it... */
#if defined(__i386__)
- __asm__("\tmovl %%ebx,%0\n\t":"=a"(got));
+ __asm__("\tmovl %%ebx,%0\n\t":"=a"(got));
#elif defined(__m68k__)
- __asm__("movel %%a5,%0":"=g"(got));
+ __asm__("movel %%a5,%0":"=g"(got));
#elif defined(__sparc__)
- __asm__("\tmov %%l7,%0\n\t":"=r"(got));
+ __asm__("\tmov %%l7,%0\n\t":"=r"(got));
#elif defined(__arm__)
- __asm__("\tmov %0, r10\n\t":"=r"(got));
+ __asm__("\tmov %0, r10\n\t":"=r"(got));
#elif defined(__powerpc__)
- __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
+ __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
#elif defined(__mips__)
- __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got));
+ __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got));
#elif defined(__sh__) && !defined(__SH5__)
- __asm__(
-" mov.l 1f, %0\n"
-" mova 1f, r0\n"
-" bra 2f\n"
-" add r0, %0\n"
-" .balign 4\n"
-"1: .long _GLOBAL_OFFSET_TABLE_\n"
-"2:" : "=r" (got) : : "r0");
+ __asm__(
+ " mov.l 1f, %0\n"
+ " mova 1f, r0\n"
+ " bra 2f\n"
+ " add r0, %0\n"
+ " .balign 4\n"
+ "1: .long _GLOBAL_OFFSET_TABLE_\n"
+ "2:" : "=r" (got) : : "r0");
#elif defined(__cris__)
- __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got));
+ __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got));
#else
/* Do things the slow way in C */
{
@@ -252,7 +252,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing dynamic linking information section \n");
_dl_exit(0);
- found_dynamic:
+found_dynamic:
dynamic = (Elf32_Dyn *) (shdr->sh_offset + (char *) header);
/* Find where PT_LOAD is hiding */
@@ -265,7 +265,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing loadable program segment\n");
_dl_exit(0);
- found_pt_load:
+found_pt_load:
/* Now (finally) find where DT_PLTGOT is hiding */
tx_reloc = pt_load->p_vaddr - pt_load->p_offset;
for (; DT_NULL != dynamic->d_tag; ++dynamic) {
@@ -276,7 +276,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing global offset table\n");
_dl_exit(0);
- found_got:
+found_got:
got = (unsigned long *) (dynamic->d_un.d_val - tx_reloc +
(char *) header);
}
@@ -306,7 +306,7 @@ DL_BOOT(unsigned long args)
#ifdef __UCLIBC_PIE_SUPPORT__
/* Find the runtime load address of the main executable, this may be
- * different from what the ELF header says for ET_DYN/PIE executables.
+ * different from what the ELF header says for ET_DYN/PIE executables.
*/
{
ElfW(Phdr) *ppnt;
@@ -462,14 +462,14 @@ DL_BOOT(unsigned long args)
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
#ifndef __UCLIBC_PIE_SUPPORT__
_dl_mprotect((void *) (ppnt->p_vaddr & PAGE_ALIGN),
- (ppnt->p_vaddr & ADDR_ALIGN) +
- (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ (ppnt->p_vaddr & ADDR_ALIGN) +
+ (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
#else
- _dl_mprotect((void *) ((ppnt->p_vaddr + app_tpnt->loadaddr) & PAGE_ALIGN),
- ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
- (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ _dl_mprotect((void *) ((ppnt->p_vaddr + app_tpnt->loadaddr) & PAGE_ALIGN),
+ ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
+ (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
#endif
}
}
@@ -501,9 +501,9 @@ DL_BOOT(unsigned long args)
rel_addr = (indx ? tpnt->dynamic_info[DT_JMPREL] : tpnt->
- dynamic_info[DT_RELOC_TABLE_ADDR]);
+ dynamic_info[DT_RELOC_TABLE_ADDR]);
rel_size = (indx ? tpnt->dynamic_info[DT_PLTRELSZ] : tpnt->
- dynamic_info[DT_RELOC_TABLE_SIZE]);
+ dynamic_info[DT_RELOC_TABLE_SIZE]);
if (!rel_addr)
continue;
diff --git a/ldso/ldso/hash.c b/ldso/ldso/hash.c
index 1e4acd979..c33b329ec 100644
--- a/ldso/ldso/hash.c
+++ b/ldso/ldso/hash.c
@@ -79,7 +79,7 @@ struct elf_resolve *_dl_check_hashed_files(const char *libname)
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
if (_dl_strncmp(tpnt->libname, libname, len) == 0 &&
- (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
+ (tpnt->libname[len] == '\0' || tpnt->libname[len] == '.'))
return tpnt;
}
@@ -242,18 +242,18 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt1,
continue;
switch (ELF32_ST_BIND(sym->st_info)) {
- case STB_WEAK:
+ case STB_WEAK:
//Disable this to match current glibc behavior. Of course,
//this doesn't actually work yet and will cause segfaults...
#if 1
- if (!weak_result)
- weak_result = (char *)tpnt->loadaddr + sym->st_value;
- break;
+ if (!weak_result)
+ weak_result = (char *)tpnt->loadaddr + sym->st_value;
+ break;
#endif
- case STB_GLOBAL:
- return (char*)tpnt->loadaddr + sym->st_value;
- default: /* Local symbols not handled here */
- break;
+ case STB_GLOBAL:
+ return (char*)tpnt->loadaddr + sym->st_value;
+ default: /* Local symbols not handled here */
+ break;
}
}
}
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 5dca362b5..29adcc1a2 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -104,8 +104,8 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#ifdef __SUPPORT_LD_DEBUG_EARLY__
- /* Wahoo!!! */
- SEND_STDERR("Cool, we managed to make a function call.\n");
+ /* Wahoo!!! */
+ SEND_STDERR("Cool, we managed to make a function call.\n");
#endif
/* Make it so _dl_malloc can use the page of memory we have already
@@ -188,7 +188,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#endif
/* OK, we have what we need - slip this one into the list. */
#ifndef __UCLIBC_PIE_SUPPORT__
- app_tpnt = _dl_add_elf_hash_table("", 0,
+ app_tpnt = _dl_add_elf_hash_table("", 0,
app_tpnt->dynamic_info, ppnt->p_vaddr, ppnt->p_filesz);
#else
app_tpnt = _dl_add_elf_hash_table("", (char *)app_tpnt->loadaddr,
@@ -214,12 +214,12 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
}
/* OK, fill this in - we did not have this before */
- if (ppnt->p_type == PT_INTERP) {
+ if (ppnt->p_type == PT_INTERP) {
int readsize = 0;
char *pnt, *pnt1, buf[1024];
tpnt->libname = _dl_strdup((char *) ppnt->p_offset +
(auxvt[AT_PHDR].a_un.a_val & PAGE_ALIGN));
-
+
/* Determine if the shared lib loader is a symlink */
_dl_memset(buf, 0, sizeof(buf));
readsize = _dl_readlink(tpnt->libname, buf, sizeof(buf));
@@ -233,7 +233,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
}
}
- /* Store the path where the shared lib loader was found for
+ /* Store the path where the shared lib loader was found for
* later use */
pnt = _dl_strdup(tpnt->libname);
pnt1 = _dl_strrchr(pnt, '/');
@@ -257,7 +257,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
be_lazy = 0;
if ((auxvt[AT_UID].a_un.a_val == -1 && _dl_suid_ok()) ||
- (auxvt[AT_UID].a_un.a_val != -1 &&
+ (auxvt[AT_UID].a_un.a_val != -1 &&
auxvt[AT_UID].a_un.a_val == auxvt[AT_EUID].a_un.a_val
&& auxvt[AT_GID].a_un.a_val== auxvt[AT_EGID].a_un.a_val)) {
_dl_secure = 0;
@@ -277,55 +277,55 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
_dl_debug = _dl_getenv("LD_DEBUG", envp);
if (_dl_debug)
{
- if (_dl_strstr(_dl_debug, "all")) {
- _dl_debug_detail = _dl_debug_move = _dl_debug_symbols
- = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_strstr(_dl_debug, "all");
- }
- else {
- _dl_debug_detail = _dl_strstr(_dl_debug, "detail");
- _dl_debug_move = _dl_strstr(_dl_debug, "move");
- _dl_debug_symbols = _dl_strstr(_dl_debug, "sym");
- _dl_debug_reloc = _dl_strstr(_dl_debug, "reloc");
- _dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix");
- _dl_debug_bindings = _dl_strstr(_dl_debug, "bind");
- }
+ if (_dl_strstr(_dl_debug, "all")) {
+ _dl_debug_detail = _dl_debug_move = _dl_debug_symbols
+ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_strstr(_dl_debug, "all");
+ }
+ else {
+ _dl_debug_detail = _dl_strstr(_dl_debug, "detail");
+ _dl_debug_move = _dl_strstr(_dl_debug, "move");
+ _dl_debug_symbols = _dl_strstr(_dl_debug, "sym");
+ _dl_debug_reloc = _dl_strstr(_dl_debug, "reloc");
+ _dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix");
+ _dl_debug_bindings = _dl_strstr(_dl_debug, "bind");
+ }
}
{
- const char *dl_debug_output;
-
- dl_debug_output = _dl_getenv("LD_DEBUG_OUTPUT", envp);
-
- if (dl_debug_output)
- {
- char tmp[22], *tmp1, *filename;
- int len1, len2;
-
- _dl_memset(tmp, 0, sizeof(tmp));
- tmp1=_dl_simple_ltoa( tmp, (unsigned long)_dl_getpid());
-
- len1 = _dl_strlen(dl_debug_output);
- len2 = _dl_strlen(tmp1);
-
- filename = _dl_malloc(len1+len2+2);
-
- if (filename)
- {
- _dl_strcpy (filename, dl_debug_output);
- filename[len1] = '.';
- _dl_strcpy (&filename[len1+1], tmp1);
-
- _dl_debug_file= _dl_open (filename, O_WRONLY|O_CREAT, 0644);
- if (_dl_debug_file<0)
- {
- _dl_debug_file = 2;
- _dl_dprintf (2, "can't open file: '%s'\n",filename);
- }
- }
- }
+ const char *dl_debug_output;
+
+ dl_debug_output = _dl_getenv("LD_DEBUG_OUTPUT", envp);
+
+ if (dl_debug_output)
+ {
+ char tmp[22], *tmp1, *filename;
+ int len1, len2;
+
+ _dl_memset(tmp, 0, sizeof(tmp));
+ tmp1=_dl_simple_ltoa( tmp, (unsigned long)_dl_getpid());
+
+ len1 = _dl_strlen(dl_debug_output);
+ len2 = _dl_strlen(tmp1);
+
+ filename = _dl_malloc(len1+len2+2);
+
+ if (filename)
+ {
+ _dl_strcpy (filename, dl_debug_output);
+ filename[len1] = '.';
+ _dl_strcpy (&filename[len1+1], tmp1);
+
+ _dl_debug_file= _dl_open (filename, O_WRONLY|O_CREAT, 0644);
+ if (_dl_debug_file<0)
+ {
+ _dl_debug_file = 2;
+ _dl_dprintf (2, "can't open file: '%s'\n",filename);
+ }
+ }
+ }
}
-
-
-#endif
+
+
+#endif
if (_dl_getenv("LD_TRACE_LOADED_OBJECTS", envp) != NULL) {
trace_loaded_objects++;
}
@@ -359,28 +359,28 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
_dl_map_cache();
- if (_dl_preload)
+ if (_dl_preload)
{
char c, *str, *str2;
str = _dl_preload;
while (*str == ':' || *str == ' ' || *str == '\t')
str++;
- while (*str)
+ while (*str)
{
str2 = str;
while (*str2 && *str2 != ':' && *str2 != ' ' && *str2 != '\t')
str2++;
c = *str2;
*str2 = '\0';
- if (!_dl_secure || _dl_strchr(str, '/') == NULL)
+ if (!_dl_secure || _dl_strchr(str, '/') == NULL)
{
- if ((tpnt1 = _dl_check_if_named_library_is_loaded(str, trace_loaded_objects)))
+ if ((tpnt1 = _dl_check_if_named_library_is_loaded(str, trace_loaded_objects)))
{
continue;
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
str, _dl_progname);
#endif
tpnt1 = _dl_load_shared_library(_dl_secure, &rpnt, NULL, str, trace_loaded_objects);
@@ -388,7 +388,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects)
_dl_dprintf(1, "\t%s => not found\n", str);
- else
+ else
#endif
{
_dl_dprintf(2, "%s: can't load " "library '%s'\n", _dl_progname, str);
@@ -400,10 +400,10 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#endif
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && tpnt1->usage_count==1) {
- /* this is a real hack to make ldd not print
+ /* this is a real hack to make ldd not print
* the library itself when run on a library. */
if (_dl_strcmp(_dl_progname, str) != 0)
- _dl_dprintf(1, "\t%s => %s (%x)\n", str, tpnt1->libname,
+ _dl_dprintf(1, "\t%s => %s (%x)\n", str, tpnt1->libname,
(unsigned) tpnt1->loadaddr);
}
#endif
@@ -423,14 +423,14 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
char *preload;
if (!_dl_stat(LDSO_PRELOAD, &st) && st.st_size > 0) {
if ((fd = _dl_open(LDSO_PRELOAD, O_RDONLY)) < 0) {
- _dl_dprintf(2, "%s: can't open file '%s'\n",
+ _dl_dprintf(2, "%s: can't open file '%s'\n",
_dl_progname, LDSO_PRELOAD);
} else {
- preload = (caddr_t) _dl_mmap(0, st.st_size + 1,
+ preload = (caddr_t) _dl_mmap(0, st.st_size + 1,
PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
_dl_close(fd);
if (preload == (caddr_t) - 1) {
- _dl_dprintf(2, "%s: can't map file '%s'\n",
+ _dl_dprintf(2, "%s: can't map file '%s'\n",
_dl_progname, LDSO_PRELOAD);
} else {
char c, *cp, *cp2;
@@ -459,12 +459,12 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
c = *cp;
*cp = '\0';
- if ((tpnt1 = _dl_check_if_named_library_is_loaded(cp2, trace_loaded_objects)))
+ if ((tpnt1 = _dl_check_if_named_library_is_loaded(cp2, trace_loaded_objects)))
{
continue;
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
cp2, _dl_progname);
#endif
tpnt1 = _dl_load_shared_library(0, &rpnt, NULL, cp2, trace_loaded_objects);
@@ -472,7 +472,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects)
_dl_dprintf(1, "\t%s => not found\n", cp2);
- else
+ else
#endif
{
_dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, cp2);
@@ -484,7 +484,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#endif
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && tpnt1->usage_count==1) {
- _dl_dprintf(1, "\t%s => %s (%x)\n", cp2,
+ _dl_dprintf(1, "\t%s => %s (%x)\n", cp2,
tpnt1->libname, (unsigned) tpnt1->loadaddr);
}
#endif
@@ -503,23 +503,23 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
}
#endif
- for (tcurr = _dl_loaded_modules; tcurr; tcurr = tcurr->next)
+ for (tcurr = _dl_loaded_modules; tcurr; tcurr = tcurr->next)
{
Elf32_Dyn *dpnt;
- for (dpnt = (Elf32_Dyn *) tcurr->dynamic_addr; dpnt->d_tag; dpnt++)
+ for (dpnt = (Elf32_Dyn *) tcurr->dynamic_addr; dpnt->d_tag; dpnt++)
{
- if (dpnt->d_tag == DT_NEEDED)
+ if (dpnt->d_tag == DT_NEEDED)
{
char *name;
lpntstr = (char*) (tcurr->loadaddr + tcurr->dynamic_info[DT_STRTAB] + dpnt->d_un.d_val);
name = _dl_get_last_path_component(lpntstr);
- if ((tpnt1 = _dl_check_if_named_library_is_loaded(name, trace_loaded_objects)))
+ if ((tpnt1 = _dl_check_if_named_library_is_loaded(name, trace_loaded_objects)))
{
continue;
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tfile='%s'; needed by '%s'\n",
lpntstr, _dl_progname);
#endif
if (!(tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr, trace_loaded_objects)))
@@ -528,7 +528,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
if (trace_loaded_objects) {
_dl_dprintf(1, "\t%s => not found\n", lpntstr);
continue;
- } else
+ } else
#endif
{
_dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, lpntstr);
@@ -540,7 +540,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#endif
#ifdef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects && tpnt1->usage_count==1) {
- _dl_dprintf(1, "\t%s => %s (%x)\n", lpntstr, tpnt1->libname,
+ _dl_dprintf(1, "\t%s => %s (%x)\n", lpntstr, tpnt1->libname,
(unsigned) tpnt1->loadaddr);
}
#endif
@@ -554,7 +554,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
/*
* If the program interpreter is not in the module chain, add it. This will
- * be required for dlopen to be able to access the internal functions in the
+ * be required for dlopen to be able to access the internal functions in the
* dynamic linker.
*/
if (tpnt) {
@@ -588,8 +588,8 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#ifdef __LDSO_LDD_SUPPORT__
/* End of the line for ldd.... */
if (trace_loaded_objects) {
- _dl_dprintf(1, "\t%s => %s (%x)\n", rpnt->dyn->libname + (_dl_strlen(_dl_ldsopath)) + 1,
- rpnt->dyn->libname, rpnt->dyn->loadaddr);
+ _dl_dprintf(1, "\t%s => %s (%x)\n", rpnt->dyn->libname + (_dl_strlen(_dl_ldsopath)) + 1,
+ rpnt->dyn->libname, rpnt->dyn->loadaddr);
_dl_exit(0);
}
#endif
@@ -624,7 +624,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
_dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("___brk_addr", NULL, NULL, symbolrel);
-
+
if (_dl_brkp) {
*_dl_brkp = brk_addr;
}
@@ -644,7 +644,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) {
for (myppnt = tpnt->ppnt, j = 0; j < tpnt->n_phent; j++, myppnt++) {
if (myppnt->p_type == PT_LOAD && !(myppnt->p_flags & PF_W) && tpnt->dynamic_info[DT_TEXTREL]) {
- _dl_mprotect((void *) (tpnt->loadaddr + (myppnt->p_vaddr & PAGE_ALIGN)),
+ _dl_mprotect((void *) (tpnt->loadaddr + (myppnt->p_vaddr & PAGE_ALIGN)),
(myppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) myppnt->p_filesz, LXFLAGS(myppnt->p_flags));
}
}
@@ -654,7 +654,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
#endif
_dl_atexit = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", NULL, NULL, symbolrel);
#if defined (__SUPPORT_LD_DEBUG__)
- _dl_on_exit = (int (*)(void (*)(int, void *),void*))
+ _dl_on_exit = (int (*)(void (*)(int, void *),void*))
(intptr_t) _dl_find_hash("on_exit", NULL, NULL, symbolrel);
#endif
@@ -663,19 +663,19 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
_dl_debug_state();
for (rpnt = _dl_symbol_tables; rpnt!=NULL&& rpnt->next!=NULL; rpnt=rpnt->next)
- ;
-
+ ;
+
for (;rpnt!=NULL; rpnt=rpnt->prev)
{
- tpnt = rpnt->dyn;
+ tpnt = rpnt->dyn;
- if (tpnt->libtype == program_interpreter)
+ if (tpnt->libtype == program_interpreter)
continue;
/* Apparently crt0/1 for the application is responsible for handling this.
* We only need to run the init/fini for shared libraries
*/
- if (tpnt->libtype == elf_executable)
+ if (tpnt->libtype == elf_executable)
break; /* at this point all shared libs are initialized !! */
if (tpnt->init_flag & INIT_FUNCS_CALLED)
@@ -686,8 +686,8 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt
void (*dl_elf_func) (void);
dl_elf_func = (void (*)(void)) (intptr_t) (tpnt->loadaddr + tpnt->dynamic_info[DT_INIT]);
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ncalling init: %s\n\n", tpnt->libname);
-#endif
+ if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ncalling init: %s\n\n", tpnt->libname);
+#endif
(*dl_elf_func) ();
}
if (_dl_atexit && tpnt->dynamic_info[DT_FINI]) {
@@ -767,5 +767,6 @@ static int _dl_suid_ok(void)
return 0;
}
+
#include "hash.c"
#include "readelflib1.c"
diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c
index 75c5972bf..95889deef 100644
--- a/ldso/ldso/readelflib1.c
+++ b/ldso/ldso/readelflib1.c
@@ -1,12 +1,11 @@
/* vi: set sw=4 ts=4: */
-/* Program to load an ELF binary on a linux system, and run it
- * after resolving ELF shared library symbols
+/*
+ * This file contains the helper routines to load an ELF shared
+ * library into memory and add the symbol table info to the chain.
*
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
* Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
* David Engel, Hongjiu Lu and Mitch D'Souza
- * Copyright (C) 2001-2004 Erik Andersen
- *
- * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,8 +30,7 @@
*/
-/* This file contains the helper routines to load an ELF sharable
- library into memory and add the symbol table info to the chain. */
+#include "ldso.h"
#ifdef USE_CACHE
@@ -53,7 +51,7 @@ int _dl_map_cache(void)
return 0;
if (_dl_stat(LDSO_CACHE, &st)
- || (fd = _dl_open(LDSO_CACHE, O_RDONLY)) < 0) {
+ || (fd = _dl_open(LDSO_CACHE, O_RDONLY)) < 0) {
_dl_dprintf(2, "%s: can't open cache '%s'\n", _dl_progname, LDSO_CACHE);
_dl_cache_addr = (caddr_t) - 1; /* so we won't try again */
return -1;
@@ -64,21 +62,21 @@ int _dl_map_cache(void)
_dl_close(fd);
if (_dl_mmap_check_error(_dl_cache_addr)) {
_dl_dprintf(2, "%s: can't map cache '%s'\n",
- _dl_progname, LDSO_CACHE);
+ _dl_progname, LDSO_CACHE);
return -1;
}
header = (header_t *) _dl_cache_addr;
if (_dl_cache_size < sizeof(header_t) ||
- _dl_memcmp(header->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN)
- || _dl_memcmp(header->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN)
- || _dl_cache_size <
- (sizeof(header_t) + header->nlibs * sizeof(libentry_t))
- || _dl_cache_addr[_dl_cache_size - 1] != '\0')
+ _dl_memcmp(header->magic, LDSO_CACHE_MAGIC, LDSO_CACHE_MAGIC_LEN)
+ || _dl_memcmp(header->version, LDSO_CACHE_VER, LDSO_CACHE_VER_LEN)
+ || _dl_cache_size <
+ (sizeof(header_t) + header->nlibs * sizeof(libentry_t))
+ || _dl_cache_addr[_dl_cache_size - 1] != '\0')
{
_dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname,
- LDSO_CACHE);
+ LDSO_CACHE);
goto fail;
}
@@ -88,7 +86,7 @@ int _dl_map_cache(void)
for (i = 0; i < header->nlibs; i++) {
if (libent[i].sooffset >= strtabsize ||
- libent[i].liboffset >= strtabsize)
+ libent[i].liboffset >= strtabsize)
{
_dl_dprintf(2, "%s: cache '%s' is corrupt\n", _dl_progname, LDSO_CACHE);
goto fail;
@@ -97,7 +95,7 @@ int _dl_map_cache(void)
return 0;
- fail:
+fail:
_dl_munmap(_dl_cache_addr, _dl_cache_size);
_dl_cache_addr = (caddr_t) - 1;
return -1;
@@ -115,7 +113,6 @@ int _dl_unmap_cache(void)
return 0;
}
-
#endif
/* This function's behavior must exactly match that
@@ -233,13 +230,9 @@ struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libnam
}
-/*
- * Used to return error codes back to dlopen et. al.
- */
-
+/* Used to return error codes back to dlopen et. al. */
unsigned long _dl_error_number;
unsigned long _dl_internal_error_number;
-extern char *_dl_ldsopath;
struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname, int trace_loaded_objects)
@@ -301,7 +294,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#endif
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
}
}
@@ -312,10 +305,10 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
#endif
- if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
- {
- return tpnt1;
- }
+ if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
+ {
+ return tpnt1;
+ }
}
/*
@@ -335,10 +328,10 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
#endif
for (i = 0; i < header->nlibs; i++) {
if ((libent[i].flags == LIB_ELF ||
- libent[i].flags == LIB_ELF_LIBC5) &&
- _dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
- (tpnt1 = _dl_load_elf_shared_library(secure,
- rpnt, strs + libent[i].liboffset)))
+ libent[i].flags == LIB_ELF_LIBC5) &&
+ _dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
+ (tpnt1 = _dl_load_elf_shared_library(secure,
+ rpnt, strs + libent[i].liboffset)))
return tpnt1;
}
}
@@ -347,11 +340,11 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
/* Look for libraries wherever the shared library loader
* was installed */
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching ldso dir='%s'\n", _dl_ldsopath);
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching ldso dir='%s'\n", _dl_ldsopath);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_ldsopath, rpnt)) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
@@ -361,14 +354,14 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
if(_dl_debug) _dl_dprintf(_dl_debug_file, "\tsearching full lib path list\n");
#endif
if ((tpnt1 = search_for_named_library(libname, secure,
- UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib:"
- UCLIBC_RUNTIME_PREFIX "usr/lib:"
- UCLIBC_RUNTIME_PREFIX "lib:"
- "/usr/lib:"
- "/lib", rpnt)
- ) != NULL)
+ UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib:"
+ UCLIBC_RUNTIME_PREFIX "usr/lib:"
+ UCLIBC_RUNTIME_PREFIX "lib:"
+ "/usr/lib:"
+ "/lib", rpnt)
+ ) != NULL)
{
- return tpnt1;
+ return tpnt1;
}
goof:
@@ -449,8 +442,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
return NULL;
}
- header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (_dl_mmap_check_error(header)) {
_dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -461,12 +454,12 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
_dl_read(infile, header, PAGE_SIZE);
epnt = (ElfW(Ehdr) *) (intptr_t) header;
if (epnt->e_ident[0] != 0x7f ||
- epnt->e_ident[1] != 'E' ||
- epnt->e_ident[2] != 'L' ||
- epnt->e_ident[3] != 'F')
+ epnt->e_ident[1] != 'E' ||
+ epnt->e_ident[2] != 'L' ||
+ epnt->e_ident[3] != 'F')
{
_dl_dprintf(2, "%s: '%s' is not an ELF file\n", _dl_progname,
- libname);
+ libname);
_dl_internal_error_number = LD_ERROR_NOTELF;
_dl_close(infile);
_dl_munmap(header, PAGE_SIZE);
@@ -475,14 +468,14 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if ((epnt->e_type != ET_DYN) || (epnt->e_machine != MAGIC1
#ifdef MAGIC2
- && epnt->e_machine != MAGIC2
+ && epnt->e_machine != MAGIC2
#endif
- ))
+ ))
{
_dl_internal_error_number =
- (epnt->e_type != ET_DYN ? LD_ERROR_NOTDYN : LD_ERROR_NOTMAGIC);
+ (epnt->e_type != ET_DYN ? LD_ERROR_NOTDYN : LD_ERROR_NOTMAGIC);
_dl_dprintf(2, "%s: '%s' is not an ELF executable for " ELF_TARGET
- "\n", _dl_progname, libname);
+ "\n", _dl_progname, libname);
_dl_close(infile);
_dl_munmap(header, PAGE_SIZE);
return NULL;
@@ -496,7 +489,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (ppnt->p_type == PT_DYNAMIC) {
if (dynamic_addr)
_dl_dprintf(2, "%s: '%s' has more than one dynamic section\n",
- _dl_progname, libname);
+ _dl_progname, libname);
dynamic_addr = ppnt->p_vaddr;
dynamic_size = ppnt->p_filesz;
};
@@ -525,7 +518,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
flags |= MAP_FIXED;
status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma),
- maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
+ maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -555,13 +548,13 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
char *cpnt;
status = (char *) _dl_mmap((char *) ((piclib ? libaddr : 0) +
- (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN)
- + ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile,
- ppnt->p_offset & OFFS_ALIGN);
+ (ppnt->p_vaddr & PAGE_ALIGN)), (ppnt->p_vaddr & ADDR_ALIGN)
+ + ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags, infile,
+ ppnt->p_offset & OFFS_ALIGN);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map '%s'\n",
- _dl_progname, libname);
+ _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
_dl_munmap((char *) libaddr, maxvma - minvma);
_dl_close(infile);
@@ -571,7 +564,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/* Pad the last page with zeroes. */
cpnt = (char *) (status + (ppnt->p_vaddr & ADDR_ALIGN) +
- ppnt->p_filesz);
+ ppnt->p_filesz);
while (((unsigned long) cpnt) & ADDR_ALIGN)
*cpnt++ = 0;
@@ -585,14 +578,14 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (map_size < ppnt->p_vaddr + ppnt->p_memsz)
status = (char *) _dl_mmap((char *) map_size +
- (piclib ? libaddr : 0),
- ppnt->p_vaddr + ppnt->p_memsz - map_size,
- LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS, -1, 0);
+ (piclib ? libaddr : 0),
+ ppnt->p_vaddr + ppnt->p_memsz - map_size,
+ LXFLAGS(ppnt->p_flags), flags | MAP_ANONYMOUS, -1, 0);
} else
status = (char *) _dl_mmap((char *) (ppnt->p_vaddr & PAGE_ALIGN)
- + (piclib ? libaddr : 0), (ppnt->p_vaddr & ADDR_ALIGN) +
- ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags,
- infile, ppnt->p_offset & OFFS_ALIGN);
+ + (piclib ? libaddr : 0), (ppnt->p_vaddr & ADDR_ALIGN) +
+ ppnt->p_filesz, LXFLAGS(ppnt->p_flags), flags,
+ infile, ppnt->p_offset & OFFS_ALIGN);
if (_dl_mmap_check_error(status)) {
_dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname);
_dl_internal_error_number = LD_ERROR_MMAP_FAILED;
@@ -626,8 +619,8 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (!dynamic_addr) {
_dl_internal_error_number = LD_ERROR_NODYNAMIC;
_dl_dprintf(2, "%s: '%s' is missing a dynamic section\n",
- _dl_progname, libname);
- _dl_munmap(header, PAGE_SIZE);
+ _dl_progname, libname);
+ _dl_munmap(header, PAGE_SIZE);
return NULL;
}
@@ -676,9 +669,9 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
for (i = 0; i < epnt->e_phnum; i++, ppnt++) {
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
_dl_mprotect((void *) ((piclib ? libaddr : 0) +
- (ppnt->p_vaddr & PAGE_ALIGN)),
- (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ (ppnt->p_vaddr & PAGE_ALIGN)),
+ (ppnt->p_vaddr & ADDR_ALIGN) + (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
}
#else
_dl_dprintf(_dl_debug_file, "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n",libname);
@@ -687,7 +680,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
}
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,
- dynamic_addr, dynamic_size);
+ dynamic_addr, dynamic_size);
tpnt->ppnt = (ElfW(Phdr) *)(intptr_t) (tpnt->loadaddr + epnt->e_phoff);
tpnt->n_phent = epnt->e_phnum;
@@ -716,7 +709,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (lpnt) {
lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT] +
- ((int) libaddr));
+ ((int) libaddr));
INIT_GOT(lpnt, tpnt);
};
@@ -744,10 +737,10 @@ void _dl_dprintf(int fd, const char *fmt, ...)
static char *buf;
buf = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (_dl_mmap_check_error(buf)) {
- _dl_write(fd, "mmap of a spare page failed!\n", 29);
- _dl_exit(20);
+ _dl_write(fd, "mmap of a spare page failed!\n", 29);
+ _dl_exit(20);
}
start = ptr = buf;
@@ -773,38 +766,38 @@ void _dl_dprintf(int fd, const char *fmt, ...)
_dl_write(fd, start, _dl_strlen(start));
switch (*ptr++) {
- case 's':
- string = va_arg(args, char *);
-
- if (!string)
+ case 's':
+ string = va_arg(args, char *);
+
+ if (!string)
+ _dl_write(fd, "(null)", 6);
+ else
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+
+ case 'i':
+ case 'd':
+ {
+ char tmp[22];
+ num = va_arg(args, int);
+
+ string = _dl_simple_ltoa(tmp, num);
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+ }
+ case 'x':
+ case 'X':
+ {
+ char tmp[22];
+ num = va_arg(args, int);
+
+ string = _dl_simple_ltoahex(tmp, num);
+ _dl_write(fd, string, _dl_strlen(string));
+ break;
+ }
+ default:
_dl_write(fd, "(null)", 6);
- else
- _dl_write(fd, string, _dl_strlen(string));
- break;
-
- case 'i':
- case 'd':
- {
- char tmp[22];
- num = va_arg(args, int);
-
- string = _dl_simple_ltoa(tmp, num);
- _dl_write(fd, string, _dl_strlen(string));
- break;
- }
- case 'x':
- case 'X':
- {
- char tmp[22];
- num = va_arg(args, int);
-
- string = _dl_simple_ltoahex(tmp, num);
- _dl_write(fd, string, _dl_strlen(string));
- break;
- }
- default:
- _dl_write(fd, "(null)", 6);
- break;
+ break;
}
start = ptr;
@@ -916,8 +909,8 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
return goof;
tpnt->init_flag |= COPY_RELOCS_DONE;
goof += _dl_parse_copy_information(rpnt,
- tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
- tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
+ tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
+ tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) {
diff --git a/ldso/ldso/startup.c b/ldso/ldso/startup.c
index 0da911f8c..6a131633a 100644
--- a/ldso/ldso/startup.c
+++ b/ldso/ldso/startup.c
@@ -185,16 +185,16 @@ DL_BOOT(unsigned long args)
/* Check the ELF header to make sure everything looks ok. */
if (!header || header->e_ident[EI_CLASS] != ELFCLASS32 ||
- header->e_ident[EI_VERSION] != EV_CURRENT
+ header->e_ident[EI_VERSION] != EV_CURRENT
#if !defined(__powerpc__) && !defined(__mips__) && !defined(__sh__)
- || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0
+ || _dl_strncmp((void *) header, ELFMAGIC, SELFMAG) != 0
#else
- || header->e_ident[EI_MAG0] != ELFMAG0
- || header->e_ident[EI_MAG1] != ELFMAG1
- || header->e_ident[EI_MAG2] != ELFMAG2
- || header->e_ident[EI_MAG3] != ELFMAG3
+ || header->e_ident[EI_MAG0] != ELFMAG0
+ || header->e_ident[EI_MAG1] != ELFMAG1
+ || header->e_ident[EI_MAG2] != ELFMAG2
+ || header->e_ident[EI_MAG3] != ELFMAG3
#endif
- ) {
+ ) {
SEND_STDERR("Invalid ELF header\n");
_dl_exit(0);
}
@@ -209,28 +209,28 @@ DL_BOOT(unsigned long args)
* happen to know what that is for this architecture. If not,
* we can always read stuff out of the ELF file to find it... */
#if defined(__i386__)
- __asm__("\tmovl %%ebx,%0\n\t":"=a"(got));
+ __asm__("\tmovl %%ebx,%0\n\t":"=a"(got));
#elif defined(__m68k__)
- __asm__("movel %%a5,%0":"=g"(got));
+ __asm__("movel %%a5,%0":"=g"(got));
#elif defined(__sparc__)
- __asm__("\tmov %%l7,%0\n\t":"=r"(got));
+ __asm__("\tmov %%l7,%0\n\t":"=r"(got));
#elif defined(__arm__)
- __asm__("\tmov %0, r10\n\t":"=r"(got));
+ __asm__("\tmov %0, r10\n\t":"=r"(got));
#elif defined(__powerpc__)
- __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
+ __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
#elif defined(__mips__)
- __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got));
+ __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got));
#elif defined(__sh__) && !defined(__SH5__)
- __asm__(
-" mov.l 1f, %0\n"
-" mova 1f, r0\n"
-" bra 2f\n"
-" add r0, %0\n"
-" .balign 4\n"
-"1: .long _GLOBAL_OFFSET_TABLE_\n"
-"2:" : "=r" (got) : : "r0");
+ __asm__(
+ " mov.l 1f, %0\n"
+ " mova 1f, r0\n"
+ " bra 2f\n"
+ " add r0, %0\n"
+ " .balign 4\n"
+ "1: .long _GLOBAL_OFFSET_TABLE_\n"
+ "2:" : "=r" (got) : : "r0");
#elif defined(__cris__)
- __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got));
+ __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got));
#else
/* Do things the slow way in C */
{
@@ -252,7 +252,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing dynamic linking information section \n");
_dl_exit(0);
- found_dynamic:
+found_dynamic:
dynamic = (Elf32_Dyn *) (shdr->sh_offset + (char *) header);
/* Find where PT_LOAD is hiding */
@@ -265,7 +265,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing loadable program segment\n");
_dl_exit(0);
- found_pt_load:
+found_pt_load:
/* Now (finally) find where DT_PLTGOT is hiding */
tx_reloc = pt_load->p_vaddr - pt_load->p_offset;
for (; DT_NULL != dynamic->d_tag; ++dynamic) {
@@ -276,7 +276,7 @@ DL_BOOT(unsigned long args)
SEND_STDERR("missing global offset table\n");
_dl_exit(0);
- found_got:
+found_got:
got = (unsigned long *) (dynamic->d_un.d_val - tx_reloc +
(char *) header);
}
@@ -306,7 +306,7 @@ DL_BOOT(unsigned long args)
#ifdef __UCLIBC_PIE_SUPPORT__
/* Find the runtime load address of the main executable, this may be
- * different from what the ELF header says for ET_DYN/PIE executables.
+ * different from what the ELF header says for ET_DYN/PIE executables.
*/
{
ElfW(Phdr) *ppnt;
@@ -462,14 +462,14 @@ DL_BOOT(unsigned long args)
if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
#ifndef __UCLIBC_PIE_SUPPORT__
_dl_mprotect((void *) (ppnt->p_vaddr & PAGE_ALIGN),
- (ppnt->p_vaddr & ADDR_ALIGN) +
- (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ (ppnt->p_vaddr & ADDR_ALIGN) +
+ (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
#else
- _dl_mprotect((void *) ((ppnt->p_vaddr + app_tpnt->loadaddr) & PAGE_ALIGN),
- ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
- (unsigned long) ppnt->p_filesz,
- PROT_READ | PROT_WRITE | PROT_EXEC);
+ _dl_mprotect((void *) ((ppnt->p_vaddr + app_tpnt->loadaddr) & PAGE_ALIGN),
+ ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
+ (unsigned long) ppnt->p_filesz,
+ PROT_READ | PROT_WRITE | PROT_EXEC);
#endif
}
}
@@ -501,9 +501,9 @@ DL_BOOT(unsigned long args)
rel_addr = (indx ? tpnt->dynamic_info[DT_JMPREL] : tpnt->
- dynamic_info[DT_RELOC_TABLE_ADDR]);
+ dynamic_info[DT_RELOC_TABLE_ADDR]);
rel_size = (indx ? tpnt->dynamic_info[DT_PLTRELSZ] : tpnt->
- dynamic_info[DT_RELOC_TABLE_SIZE]);
+ dynamic_info[DT_RELOC_TABLE_SIZE]);
if (!rel_addr)
continue;