summaryrefslogtreecommitdiffstats
path: root/ldso
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-08-29 22:45:11 +0000
committerMike Frysinger <vapier@gentoo.org>2005-08-29 22:45:11 +0000
commitee375653ed779d95d5467b941371fd81ad6399b7 (patch)
tree94e6710c0abc65e579cb797c1bac9255af708469 /ldso
parent7377d34eefccb1a9c0c3728495928c5b30fa4f05 (diff)
downloaduClibc-alpine-ee375653ed779d95d5467b941371fd81ad6399b7.tar.bz2
uClibc-alpine-ee375653ed779d95d5467b941371fd81ad6399b7.tar.xz
some fixes by anemo in Bug 9 to play nicely with 32 or 64 bit hosts
Diffstat (limited to 'ldso')
-rw-r--r--ldso/include/dl-hash.h8
-rw-r--r--ldso/include/ldso.h1
-rw-r--r--ldso/ldso/dl-elf.c22
-rw-r--r--ldso/ldso/dl-hash.c6
4 files changed, 24 insertions, 13 deletions
diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h
index 162c7b425..af6c2b93f 100644
--- a/ldso/include/dl-hash.h
+++ b/ldso/include/dl-hash.h
@@ -32,15 +32,15 @@ struct elf_resolve{
unsigned short usage_count;
unsigned short int init_flag;
unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */
- Elf32_Word nbucket;
- Elf32_Word *elf_buckets;
+ Elf_Symndx nbucket;
+ Elf_Symndx *elf_buckets;
struct init_fini_list *init_fini;
struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */
/*
* These are only used with ELF style shared libraries
*/
- Elf32_Word nchain;
- Elf32_Word *chains;
+ Elf_Symndx nchain;
+ Elf_Symndx *chains;
unsigned long dynamic_info[DYNAMIC_SIZE];
unsigned long n_phent;
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index ceb8aaeb1..300a7292e 100644
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -20,6 +20,7 @@
/* Pull in compiler and arch stuff */
#include <stdlib.h>
#include <stdarg.h>
+#include <bits/wordsize.h>
/* Pull in the arch specific type information */
#include <sys/types.h>
/* Pull in the ldso syscalls and string functions */
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 15ba3b947..14a10bc1f 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -693,7 +693,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
if (lpnt) {
lpnt = (unsigned long *) (dynamic_info[DT_PLTGOT]);
INIT_GOT(lpnt, tpnt);
- };
+ }
_dl_if_debug_dprint("\n\tfile='%s'; generating link map\n", libname);
_dl_if_debug_dprint("\t\tdynamic: %x base: %x\n", dynamic_addr, libaddr);
@@ -770,7 +770,11 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag)
/* Minimal printf which handles only %s, %d, and %x */
void _dl_dprintf(int fd, const char *fmt, ...)
{
- long num;
+#if __WORDSIZE > 32
+ long int num;
+#else
+ int num;
+#endif
va_list args;
char *start, *ptr, *string;
static char *buf;
@@ -818,8 +822,11 @@ void _dl_dprintf(int fd, const char *fmt, ...)
case 'd':
{
char tmp[22];
- num = va_arg(args, long);
-
+#if __WORDSIZE > 32
+ num = va_arg(args, long int);
+#else
+ num = va_arg(args, int);
+#endif
string = _dl_simple_ltoa(tmp, num);
_dl_write(fd, string, _dl_strlen(string));
break;
@@ -828,8 +835,11 @@ void _dl_dprintf(int fd, const char *fmt, ...)
case 'X':
{
char tmp[22];
- num = va_arg(args, long);
-
+#if __WORDSIZE > 32
+ num = va_arg(args, long int);
+#else
+ num = va_arg(args, int);
+#endif
string = _dl_simple_ltoahex(tmp, num);
_dl_write(fd, string, _dl_strlen(string));
break;
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index 977934e8f..188b2917a 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -57,7 +57,7 @@ struct dyn_elf *_dl_handles = NULL;
/* This is the hash function that is used by the ELF linker to generate the
* hash table that each executable and library is required to have. We need
* it to decode the hash table. */
-static inline Elf32_Word _dl_elf_hash(const char *name)
+static inline Elf_Symndx _dl_elf_hash(const char *name)
{
unsigned long hash=0;
unsigned long tmp;
@@ -101,7 +101,7 @@ struct elf_resolve *_dl_add_elf_hash_table(const char *libname,
char *loadaddr, unsigned long *dynamic_info, unsigned long dynamic_addr,
unsigned long dynamic_size)
{
- Elf32_Word *hash_addr;
+ Elf_Symndx *hash_addr;
struct elf_resolve *tpnt;
int i;
@@ -125,7 +125,7 @@ struct elf_resolve *_dl_add_elf_hash_table(const char *libname,
tpnt->libtype = loaded_file;
if (dynamic_info[DT_HASH] != 0) {
- hash_addr = (Elf32_Word*)dynamic_info[DT_HASH];
+ hash_addr = (Elf_Symndx*)dynamic_info[DT_HASH];
tpnt->nbucket = *hash_addr++;
tpnt->nchain = *hash_addr++;
tpnt->elf_buckets = hash_addr;