2001-06-07  David Mosberger  <davidm@hpl.hp.com>

	* sysdeps/ia64/dl-symaddr.c (_dl_symbol_address): Update call to
	__ia64_make_fptr() for new interface.
	(_dl_function_address): Remove.

	* sysdeps/ia64/dl-machine.h (IA64_BOOT_FPTR_TABLE_LEN): Rename
	from IA64_BOOT_FPTR_SIZE and reduce its value from 256 to 200.
	(struct ia64_fdesc): Rename from struct ia64_fptr and drop "next"
	pointer.  Rename member "func" to "ip".
	(struct ia64_fdesc_table): New type.
	(__ia64_make_fptr): Change prototype.
	(__ia64_init_bootstrap_fdesc_table): New function.
	(ELF_MACHINE_BEFORE_RTLD_RELOC): New macro.
	(__boot_ldso_fptr): Removed.
	(__fptr_next): Removed.
	(__fptr_root): Removed.
	(__fptr_count): Removed.
	(TRAMPOLINE_TEMPLATE): Fix typo in comment.  Don't use multi-line
	strings to avoid warning from gcc3.
	(RTLD_START): Don't use multi-line strings.
	(ELF_MACHINE_START_ADDRESS): Use DL_STATIC_FUNCTION_ADDRESS.
	(elf_machine_fixup_plt): Update the code entry point in the
	function descriptor through a "volatile" pointer to ensure proper
	write ordering.
	(elf_machine_rela): Simplify handling of FPTR relocs: always call
	__ia64_make_fptr().

	* sysdeps/ia64/dl-lookupcfg.h (DL_AUTO_FUNCTION_ADDRESS): New macro.
	(DL_STATIC_FUNCTION_ADDRESS): Likewise.
	(DL_DT_INIT_ADDRESS): Use DL_AUTO_FUNCTION_ADDRESS.
	(DL_DT_FINI_ADDRESS): Likewise.

	* sysdeps/ia64/dl-fptr.c: Rewrite for better scalability and to
	avoid deadlocks.

	* include/link.h: Add member machine specific "l_mach" member to
	link_map.

	* sysdeps/generic/bits/link.h: New file.
	* sysdeps/ia64/bits/link.h: Likewise.

	* elf/rtld.c (_dl_start): Fix typo in comment.
	(_dl_start_final): Copy new "l_mach" member from temporary to
	final bootstrap map.
This commit is contained in:
Ulrich Drepper 2001-07-26 00:27:15 +00:00
parent ca13ce66be
commit 370f00c3a7
10 changed files with 599 additions and 463 deletions

View File

@ -1,3 +1,49 @@
2001-06-07 David Mosberger <davidm@hpl.hp.com>
* sysdeps/ia64/dl-symaddr.c (_dl_symbol_address): Update call to
__ia64_make_fptr() for new interface.
(_dl_function_address): Remove.
* sysdeps/ia64/dl-machine.h (IA64_BOOT_FPTR_TABLE_LEN): Rename
from IA64_BOOT_FPTR_SIZE and reduce its value from 256 to 200.
(struct ia64_fdesc): Rename from struct ia64_fptr and drop "next"
pointer. Rename member "func" to "ip".
(struct ia64_fdesc_table): New type.
(__ia64_make_fptr): Change prototype.
(__ia64_init_bootstrap_fdesc_table): New function.
(ELF_MACHINE_BEFORE_RTLD_RELOC): New macro.
(__boot_ldso_fptr): Removed.
(__fptr_next): Removed.
(__fptr_root): Removed.
(__fptr_count): Removed.
(TRAMPOLINE_TEMPLATE): Fix typo in comment. Don't use multi-line
strings to avoid warning from gcc3.
(RTLD_START): Don't use multi-line strings.
(ELF_MACHINE_START_ADDRESS): Use DL_STATIC_FUNCTION_ADDRESS.
(elf_machine_fixup_plt): Update the code entry point in the
function descriptor through a "volatile" pointer to ensure proper
write ordering.
(elf_machine_rela): Simplify handling of FPTR relocs: always call
__ia64_make_fptr().
* sysdeps/ia64/dl-lookupcfg.h (DL_AUTO_FUNCTION_ADDRESS): New macro.
(DL_STATIC_FUNCTION_ADDRESS): Likewise.
(DL_DT_INIT_ADDRESS): Use DL_AUTO_FUNCTION_ADDRESS.
(DL_DT_FINI_ADDRESS): Likewise.
* sysdeps/ia64/dl-fptr.c: Rewrite for better scalability and to
avoid deadlocks.
* include/link.h: Add member machine specific "l_mach" member to
link_map.
* sysdeps/generic/bits/link.h: New file.
* sysdeps/ia64/bits/link.h: Likewise.
* elf/rtld.c (_dl_start): Fix typo in comment.
(_dl_start_final): Copy new "l_mach" member from temporary to
final bootstrap map.
2001-07-25 Ulrich Drepper <drepper@redhat.com> 2001-07-25 Ulrich Drepper <drepper@redhat.com>
* csu/gmon-start.c: Use ENTRY_POINT_DECL is defined instead of a * csu/gmon-start.c: Use ENTRY_POINT_DECL is defined instead of a

4
bits/link.h Normal file
View File

@ -0,0 +1,4 @@
struct link_map_machine
{
/* empty by default */
};

View File

@ -157,7 +157,7 @@ _dl_start (void *arg)
HP_TIMING_NOW (start_time); HP_TIMING_NOW (start_time);
/* Partly clean the `bootstrap_map' structure up. Don't use `memset' /* Partly clean the `bootstrap_map' structure up. Don't use `memset'
since it might nor be built in or inlined and we cannot make function since it might not be built in or inlined and we cannot make function
calls at this point. */ calls at this point. */
for (cnt = 0; for (cnt = 0;
cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]); cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
@ -228,6 +228,7 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p,
memcpy (_dl_rtld_map.l_info, bootstrap_map_p->l_info, memcpy (_dl_rtld_map.l_info, bootstrap_map_p->l_info,
sizeof _dl_rtld_map.l_info); sizeof _dl_rtld_map.l_info);
_dl_setup_hash (&_dl_rtld_map); _dl_setup_hash (&_dl_rtld_map);
_dl_rtld_map.l_mach = bootstrap_map_p->l_mach;
/* Don't bother trying to work out how ld.so is mapped in memory. */ /* Don't bother trying to work out how ld.so is mapped in memory. */
_dl_rtld_map.l_map_start = ~0; _dl_rtld_map.l_map_start = ~0;

View File

@ -33,6 +33,7 @@
#define _ElfW_1(e,w,t) e##w##t #define _ElfW_1(e,w,t) e##w##t
#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */ #include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
#include <bits/link.h>
/* Rendezvous structure used by the run-time dynamic linker to communicate /* Rendezvous structure used by the run-time dynamic linker to communicate
details of shared object loading to the debugger. If the executable's details of shared object loading to the debugger. If the executable's
@ -228,6 +229,8 @@ struct link_map
/* Temporarily used in `dl_close'. */ /* Temporarily used in `dl_close'. */
unsigned int l_idx; unsigned int l_idx;
struct link_map_machine l_mach;
}; };
struct dl_phdr_info struct dl_phdr_info

View File

@ -0,0 +1,4 @@
struct link_map_machine
{
/* empty by default */
};

5
sysdeps/ia64/bits/link.h Normal file
View File

@ -0,0 +1,5 @@
struct link_map_machine
{
size_t fptr_table_len;
Elf64_Addr *fptr_table;
};

View File

@ -1,5 +1,5 @@
/* Unmap a loaded object. IA-64 version. /* Manage function descriptors. IA-64 version.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */ 02111-1307 USA. */
#include <ia64intrin.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <sys/param.h> #include <sys/param.h>
@ -27,186 +28,260 @@
#include <dl-machine.h> #include <dl-machine.h>
#ifdef _LIBC_REENTRANT #ifdef _LIBC_REENTRANT
# include <pt-machine.h> # include <pt-machine.h>
# include <signal.h>
static int __ia64_fptr_lock = 0; # include <time.h>
#endif #endif
/* Because ld.so is now versioned, these functions can be in their own Elf64_Addr __ia64_boot_fptr_table[IA64_BOOT_FPTR_TABLE_LEN];
file; no relocations need to be done to call them. Of course, if
ld.so is not versioned... */
#if 0
#ifndef DO_VERSIONING
# error "This will not work with versioning turned off, sorry."
#endif
#endif
#ifdef MAP_ANON static struct local
/* The fd is not examined when using MAP_ANON. */ {
#define ANONFD -1 struct ia64_fdesc_table *root;
struct ia64_fdesc *free_list;
unsigned int npages; /* # of pages to allocate */
#ifdef _LIBC_REENTRANT
volatile int lock;
sigset_t full_sigset;
#endif
/* the next to members MUST be consecutive! */
struct ia64_fdesc_table boot_table;
struct ia64_fdesc boot_fdescs[1024];
}
local =
{
root: &local.boot_table,
npages: 2,
boot_table:
{
len: sizeof (local.boot_fdescs) / sizeof (local.boot_fdescs[0]),
first_unused: 0
}
};
/* Locking is tricky: we may get a signal while holding the lock and
the signal handler may end up calling into the dynamic loader
again. Also, if a real-time process spins on the lock, a
non-realtime process may never get the chance to release it's lock,
unless the realtime process relinquishes the CPU from time to time.
Hence we (a) block signals before acquiring the lock and (b) do a
nanosleep() when we detect prolongued contention. */
#ifdef _LIBC_REENTRANT
# define lock(l) \
{ \
sigset_t _saved_set; \
int i = 10000; \
if (!__sigismember (&(l)->full_sigset, SIGINT)) \
__sigfillset (&(l)->full_sigset); \
\
while (testandset ((int *) &(l)->lock)) \
{ \
struct timespec ts; \
if (i > 0) \
{ \
--i; \
continue; \
} \
ts.tv_sec = 0; \
ts.tv_nsec = 1*1000*1000; \
__nanosleep (&ts, NULL); \
} \
__sigprocmask (SIG_BLOCK, &(l)->full_sigset, &_saved_set);
# define unlock(l) \
__sigprocmask (SIG_SETMASK, &_saved_set, NULL); \
(l)->lock = 0; \
}
#else #else
extern int _dl_zerofd; # define lock(l)
#define ANONFD _dl_zerofd # define unlock(l)
#endif #endif
/* Create a new fdesc table and return a pointer to the first fdesc
entry. The fdesc lock must have been acquired already. */
/* ld.so currently has 14 FPTR relocs, we take 256 and use them for static struct ia64_fdesc *
the relocs for the dynamic app itself. */ new_fdesc_table (struct local *l)
struct ia64_fptr __boot_ldso_fptr[IA64_BOOT_FPTR_SIZE]; {
struct ia64_fptr *__fptr_root = NULL; size_t size = l->npages * _dl_pagesize;
struct ia64_fptr *__fptr_next = __boot_ldso_fptr; struct ia64_fdesc_table *new_table;
static struct ia64_fptr *__fptr_free = NULL; struct ia64_fdesc *fdesc;
int __fptr_count = IA64_BOOT_FPTR_SIZE;
l->npages += l->npages;
new_table = __mmap (0, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (new_table == MAP_FAILED)
_dl_signal_error (errno, NULL, "cannot map pages for fdesc table");
new_table->len = (size - sizeof (*new_table)) / sizeof (struct ia64_fdesc);
fdesc = &new_table->fdesc[0];
new_table->first_unused = 1;
new_table->next = l->root;
l->root = new_table;
return fdesc;
}
static Elf64_Addr
make_fdesc (Elf64_Addr ip, Elf64_Addr gp)
{
struct ia64_fdesc *fdesc = NULL;
struct ia64_fdesc_table *t;
unsigned int old;
struct local *l;
asm ("addl %0 = @gprel (local), gp" : "=r" (l));
t = l->root;
while (1)
{
old = t->first_unused;
if (old >= t->len)
break;
else if (__sync_bool_compare_and_swap (&t->first_unused, old, old + 1))
{
fdesc = &t->fdesc[old];
goto install;
}
}
lock (l);
{
if (l->free_list)
{
fdesc = l->free_list; /* get it from free-list */
l->free_list = (struct ia64_fdesc *) fdesc->ip;
}
else
fdesc = new_fdesc_table (l); /* create new fdesc table */
}
unlock (l);
install:
fdesc->ip = ip;
fdesc->gp = gp;
return (Elf64_Addr) fdesc;
}
static inline Elf64_Addr *
make_fptr_table (struct link_map *map)
{
const Elf64_Sym *symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
Elf64_Addr *fptr_table;
size_t size;
size_t len;
/* XXX Apparently the only way to find out the size of the dynamic
symbol section is to assume that the string table follows right
afterwards... */
len = ((strtab - (char *) symtab) / map->l_info[DT_SYMENT]->d_un.d_val);
size = ((len * sizeof (fptr_table[0]) + _dl_pagesize - 1) & -_dl_pagesize);
/* XXX We don't support here in the moment systems without MAP_ANON.
There probably are none for IA-64. In case this is proven wrong
we will have to open /dev/null here and use the file descriptor
instead of the hard-coded -1. */
fptr_table = __mmap (NULL, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (fptr_table == MAP_FAILED)
_dl_signal_error (errno, NULL, "cannot map pages for fptr table");
map->l_mach.fptr_table_len = len;
map->l_mach.fptr_table = fptr_table;
return fptr_table;
}
Elf64_Addr Elf64_Addr
__ia64_make_fptr (const struct link_map *sym_map, Elf64_Addr value, __ia64_make_fptr (struct link_map *map, const Elf64_Sym *sym, Elf64_Addr ip)
struct ia64_fptr **root, struct ia64_fptr *mem)
{ {
struct ia64_fptr **loc; Elf64_Addr *ftab = map->l_mach.fptr_table;
struct ia64_fptr *f; const Elf64_Sym *symtab;
Elf_Symndx symidx;
#ifdef _LIBC_REENTRANT if (__builtin_expect (!map->l_mach.fptr_table, 0))
/* Make sure we are alone. We don't need a lock during bootstrap. */ ftab = make_fptr_table (map);
if (mem == NULL)
while (testandset (&__ia64_fptr_lock));
#endif
/* Search the sorted linked list for an existing entry for this symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
symbol. */ symidx = sym - symtab;
loc = root;
f = *loc; if (symidx >= map->l_mach.fptr_table_len)
while (f != NULL && f->func <= value) _dl_signal_error (0, NULL,
"internal error: symidx out of range of fptr table");
if (!ftab[symidx])
{ {
if (f->func == value) /* GOT has already been relocated in elf_get_dynamic_info -
goto found; don't try to relocate it again. */
loc = &f->next; ftab[symidx] = make_fdesc (ip, map->l_info[DT_PLTGOT]->d_un.d_ptr);
f = *loc; #if 0
{
const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
struct local *l;
asm ("addl %0 = @gprel (local), gp" : "=r" (l));
if (l->root != &l->boot_table || l->boot_table.first_unused > 20)
_dl_debug_printf ("created fdesc symbol `%s' at %lx\n",
strtab + sym->st_name, ftab[symidx]);
}
#endif
} }
/* Not found. Create a new one. */ return ftab[symidx];
if (mem != NULL)
f = mem;
else if (__fptr_free != NULL)
{
f = __fptr_free;
__fptr_free = f->next;
}
else
{
if (__fptr_count == 0)
{
#ifndef MAP_ANON
# define MAP_ANON 0
if (_dl_zerofd == -1)
{
_dl_zerofd = _dl_sysdep_open_zero_fill ();
if (_dl_zerofd == -1)
{
__close (fd);
_dl_signal_error (errno, NULL,
"cannot open zero fill device");
}
}
#endif
__fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, ANONFD, 0);
if (__fptr_next == MAP_FAILED)
_dl_signal_error(errno, NULL, "cannot map page for fptr");
__fptr_count = _dl_pagesize / sizeof (struct ia64_fptr);
}
f = __fptr_next++;
__fptr_count--;
}
f->func = value;
/* GOT has already been relocated in elf_get_dynamic_info - don't
try to relocate it again. */
f->gp = sym_map->l_info[DT_PLTGOT]->d_un.d_ptr;
f->next = *loc;
*loc = f;
found:
#ifdef _LIBC_REENTRANT
/* Release the lock. */
if (mem == NULL)
__ia64_fptr_lock = 0;
#endif
return (Elf64_Addr) f;
} }
void void
_dl_unmap (struct link_map *map) _dl_unmap (struct link_map *map)
{ {
struct ia64_fptr **floc; Elf64_Addr *ftab = map->l_mach.fptr_table;
struct ia64_fptr *f; struct ia64_fdesc *head = NULL, *tail = NULL;
struct ia64_fptr **lloc; size_t i;
struct ia64_fptr *l;
__munmap ((void *) map->l_map_start, map->l_map_end - map->l_map_start); __munmap ((void *) map->l_map_start, map->l_map_end - map->l_map_start);
#ifdef _LIBC_REENTRANT if (!ftab)
/* Make sure we are alone. */ return;
while (testandset (&__ia64_fptr_lock));
#endif
/* Search the sorted linked list for the first entry for this object. */ /* String together the fdesc structures that are being freed. */
floc = &__fptr_root; for (i = 0; i < map->l_mach.fptr_table_len; ++i)
f = *floc;
while (f != NULL && f->func < map->l_map_start)
{ {
floc = &f->next; if (ftab[i])
f = *floc;
}
/* We found one. */
if (f != NULL && f->func < map->l_map_end)
{
/* Get the last entry. */
lloc = floc;
l = f;
while (l && l->func < map->l_map_end)
{ {
lloc = &l->next; *(struct ia64_fdesc **) ftab[i] = head;
l = *lloc; head = (struct ia64_fdesc *) ftab[i];
if (!tail)
tail = head;
} }
/* Updated FPTR. */
*floc = l;
/* Prepend them to the free list. */
*lloc = __fptr_free;
__fptr_free = f;
} }
#ifdef _LIBC_REENTRANT /* Prepend the new list to the free_list: */
/* Release the lock. */ if (tail)
__ia64_fptr_lock = 0; {
#endif lock (&local);
{
*(struct ia64_fdesc **) tail = local.free_list;
local.free_list = head;
}
unlock (&local);
}
__munmap (ftab,
map->l_mach.fptr_table_len * sizeof (map->l_mach.fptr_table[0]));
map->l_mach.fptr_table = NULL;
} }
Elf64_Addr Elf64_Addr
_dl_lookup_address (const void *address) _dl_lookup_address (const void *address)
{ {
Elf64_Addr addr = (Elf64_Addr) address; Elf64_Addr addr = (Elf64_Addr) address;
struct ia64_fptr *f; struct ia64_fdesc_table *t;
unsigned long int i;
#ifdef _LIBC_REENTRANT
/* Make sure we are alone. */
while (testandset (&__ia64_fptr_lock));
#endif
for (f = __fptr_root; f != NULL; f = f->next)
if (f == address)
{
addr = f->func;
break;
}
#ifdef _LIBC_REENTRANT
/* Release the lock. */
__ia64_fptr_lock = 0;
#endif
for (t = local.root; t != NULL; t = t->next)
{
i = (struct ia64_fdesc *) addr - &t->fdesc[0];
if (i < t->first_unused && addr == (Elf64_Addr) &t->fdesc[i])
{
addr = t->fdesc[i].ip;
break;
}
}
return addr; return addr;
} }

View File

@ -36,9 +36,21 @@ extern void _dl_unmap (struct link_map *map);
#define DL_UNMAP(map) _dl_unmap (map) #define DL_UNMAP(map) _dl_unmap (map)
extern Elf64_Addr _dl_function_address (const struct link_map *map, #define DL_AUTO_FUNCTION_ADDRESS(map, addr) \
Elf64_Addr start); ({ \
unsigned long fptr[2]; \
fptr[0] = (addr); \
fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
(Elf64_Addr) fptr; \
})
#define DL_FUNCTION_ADDRESS(map, addr) _dl_function_address (map, addr) #define DL_STATIC_FUNCTION_ADDRESS(map, addr) \
#define DL_DT_INIT_ADDRESS(map, addr) DL_FUNCTION_ADDRESS (map, addr) ({ \
#define DL_DT_FINI_ADDRESS(map, addr) DL_FUNCTION_ADDRESS (map, addr) static unsigned long fptr[2]; \
fptr[0] = (addr); \
fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr; \
(Elf64_Addr) fptr; \
})
#define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
#define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. IA-64 version. /* Machine-dependent ELF dynamic relocation inline functions. IA-64 version.
Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -32,26 +32,43 @@
in l_info array. */ in l_info array. */
#define DT_IA_64(x) (DT_IA_64_##x - DT_LOPROC + DT_NUM) #define DT_IA_64(x) (DT_IA_64_##x - DT_LOPROC + DT_NUM)
/* There are currently 123 dynamic symbols in ld.so.
IA64_BOOT_FPTR_TABLE_LEN needs to be at least that big. */
#define IA64_BOOT_FPTR_TABLE_LEN 200
/* An FPTR is a function descriptor. Properly they consist of just /* An FDESC is a function descriptor. */
FUNC and GP. But we want to traverse a binary tree too. */
#define IA64_BOOT_FPTR_SIZE 256 struct ia64_fdesc
{
Elf64_Addr ip; /* code entry point */
Elf64_Addr gp; /* global pointer */
};
struct ia64_fptr struct ia64_fdesc_table
{
struct ia64_fdesc_table *next;
unsigned int len; /* # of entries in fdesc table */
volatile unsigned int first_unused; /* index of first available entry */
struct ia64_fdesc fdesc[0];
};
extern Elf64_Addr __ia64_make_fptr (struct link_map *, const Elf64_Sym *,
Elf64_Addr);
static inline void
__ia64_init_bootstrap_fdesc_table (struct link_map *map)
{ {
Elf64_Addr func; Elf64_Addr *boot_table;
Elf64_Addr gp;
struct ia64_fptr *next;
};
extern struct ia64_fptr __boot_ldso_fptr[]; /* careful: this will be called before got has been relocated... */
extern struct ia64_fptr *__fptr_next; asm ("addl %0 = @gprel (__ia64_boot_fptr_table), gp" : "=r"(boot_table));
extern struct ia64_fptr *__fptr_root;
extern int __fptr_count;
extern Elf64_Addr __ia64_make_fptr (const struct link_map *, Elf64_Addr, map->l_mach.fptr_table_len = IA64_BOOT_FPTR_TABLE_LEN;
struct ia64_fptr **, struct ia64_fptr *); map->l_mach.fptr_table = boot_table;
}
#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
__ia64_init_bootstrap_fdesc_table (&bootstrap_map);
/* Return nonzero iff ELF header is compatible with the running host. */ /* Return nonzero iff ELF header is compatible with the running host. */
static inline int static inline int
@ -67,7 +84,7 @@ elf_machine_dynamic (void)
{ {
Elf64_Addr *p; Elf64_Addr *p;
__asm__( __asm__ (
".section .sdata\n" ".section .sdata\n"
" .type __dynamic_ltv#, @object\n" " .type __dynamic_ltv#, @object\n"
" .size __dynamic_ltv#, 8\n" " .size __dynamic_ltv#, 8\n"
@ -75,7 +92,7 @@ elf_machine_dynamic (void)
" data8 @ltv(_DYNAMIC#)\n" " data8 @ltv(_DYNAMIC#)\n"
".previous\n" ".previous\n"
" addl %0 = @gprel(__dynamic_ltv#), gp ;;" " addl %0 = @gprel(__dynamic_ltv#), gp ;;"
: "=r"(p)); : "=r" (p));
return *p; return *p;
} }
@ -88,19 +105,18 @@ elf_machine_load_address (void)
Elf64_Addr ip; Elf64_Addr ip;
int *p; int *p;
__asm__( __asm__ (
"1: mov %0 = ip\n" "1: mov %0 = ip\n"
".section .sdata\n" ".section .sdata\n"
"2: data4 @ltv(1b)\n" "2: data4 @ltv(1b)\n"
" .align 8\n" " .align 8\n"
".previous\n" ".previous\n"
" addl %1 = @gprel(2b), gp ;;" " addl %1 = @gprel(2b), gp ;;"
: "=r"(ip), "=r"(p)); : "=r" (ip), "=r" (p));
return ip - (Elf64_Addr)*p; return ip - (Elf64_Addr) *p;
} }
/* Set up the loaded object described by L so its unrelocated PLT /* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */ entries will jump to the on-demand fixup code in dl-runtime.c. */
@ -112,21 +128,21 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
if (lazy) if (lazy)
{ {
register Elf64_Addr gp __asm__("gp"); register Elf64_Addr gp __asm__ ("gp");
Elf64_Addr *reserve, doit; Elf64_Addr *reserve, doit;
/* /*
* Careful with the typecast here or it will try to add l-l_addr * Careful with the typecast here or it will try to add l-l_addr
* pointer elements * pointer elements
*/ */
reserve = (Elf64_Addr *) reserve = ((Elf64_Addr *)
(l->l_info[DT_IA_64(PLT_RESERVE)]->d_un.d_ptr + l->l_addr); (l->l_info[DT_IA_64 (PLT_RESERVE)]->d_un.d_ptr + l->l_addr));
/* Identify this shared object. */ /* Identify this shared object. */
reserve[0] = (Elf64_Addr) l; reserve[0] = (Elf64_Addr) l;
/* This function will be called to perform the relocation. */ /* This function will be called to perform the relocation. */
if (!profile) if (!profile)
doit = (Elf64_Addr) ((struct ia64_fptr *)&_dl_runtime_resolve)->func; doit = (Elf64_Addr) ((struct ia64_fdesc *) &_dl_runtime_resolve)->ip;
else else
{ {
if (_dl_name_match_p (_dl_profile, l)) if (_dl_name_match_p (_dl_profile, l))
@ -135,7 +151,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
want profiling and the timers are started. */ want profiling and the timers are started. */
_dl_profile_map = l; _dl_profile_map = l;
} }
doit = (Elf64_Addr) ((struct ia64_fptr *)&_dl_runtime_profile)->func; doit = (Elf64_Addr) ((struct ia64_fdesc *) &_dl_runtime_profile)->ip;
} }
reserve[1] = doit; reserve[1] = doit;
@ -149,111 +165,111 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
/* /*
This code is used in dl-runtime.c to call the `fixup' function This code is used in dl-runtime.c to call the `fixup' function
and then redirect to the address it returns. `fixup()' takes two and then redirect to the address it returns. `fixup()' takes two
arguments, however fixup_profile() takes three. arguments, however profile_fixup() takes three.
The ABI specifies that we will never see more than 8 input The ABI specifies that we will never see more than 8 input
registers to a function call, thus it is safe to simply allocate registers to a function call, thus it is safe to simply allocate
those, and simpler than playing stack games. those, and simpler than playing stack games.
- 12/09/99 Jes - 12/09/99 Jes
*/ */
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \ #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
extern void tramp_name (void); \ extern void tramp_name (void); \
asm ( "\ asm ( \
.global " #tramp_name "# " .global " #tramp_name "#\n" \
.proc " #tramp_name "# " .proc " #tramp_name "#\n" \
" #tramp_name ": #tramp_name ":\n" \
{ .mmi " { .mmi\n" \
alloc loc0 = ar.pfs, 8, 6, 3, 0 " alloc loc0 = ar.pfs, 8, 6, 3, 0\n" \
adds r2 = -144, r12 " adds r2 = -144, r12\n" \
adds r3 = -128, r12 " adds r3 = -128, r12\n" \
} " }\n" \
{ .mii " { .mii\n" \
adds r12 = -160, r12 " adds r12 = -160, r12\n" \
mov loc1 = b0 " mov loc1 = b0\n" \
mov out2 = b0 /* needed by fixup_profile */ " mov out2 = b0 /* needed by fixup_profile */\n" \
;; " ;;\n" \
} " }\n" \
{ .mfb " { .mfb\n" \
mov loc2 = r8 /* preserve struct value register */ " mov loc2 = r8 /* preserve struct value register */\n" \
nop.f 0 " nop.f 0\n" \
nop.b 0 " nop.b 0\n" \
} " }\n" \
{ .mii " { .mii\n" \
mov loc3 = r9 /* preserve language specific register */ " mov loc3 = r9 /* preserve language specific register */\n" \
mov loc4 = r10 /* preserve language specific register */ " mov loc4 = r10 /* preserve language specific register */\n" \
mov loc5 = r11 /* preserve language specific register */ " mov loc5 = r11 /* preserve language specific register */\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
stf.spill [r2] = f8, 32 " stf.spill [r2] = f8, 32\n" \
stf.spill [r3] = f9, 32 " stf.spill [r3] = f9, 32\n" \
mov out0 = r16 " mov out0 = r16\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
stf.spill [r2] = f10, 32 " stf.spill [r2] = f10, 32\n" \
stf.spill [r3] = f11, 32 " stf.spill [r3] = f11, 32\n" \
shl out1 = r15, 4 " shl out1 = r15, 4\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
stf.spill [r2] = f12, 32 " stf.spill [r2] = f12, 32\n" \
stf.spill [r3] = f13, 32 " stf.spill [r3] = f13, 32\n" \
shladd out1 = r15, 3, out1 " shladd out1 = r15, 3, out1\n" \
;; " ;;\n" \
} " }\n" \
{ .mmb " { .mmb\n" \
stf.spill [r2] = f14 " stf.spill [r2] = f14\n" \
stf.spill [r3] = f15 " stf.spill [r3] = f15\n" \
br.call.sptk.many b0 = " #fixup_name "# " br.call.sptk.many b0 = " #fixup_name "#\n" \
} " }\n" \
{ .mii " { .mii\n" \
ld8 r9 = [ret0], 8 " ld8 r9 = [ret0], 8\n" \
adds r2 = 16, r12 " adds r2 = 16, r12\n" \
adds r3 = 32, r12 " adds r3 = 32, r12\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ldf.fill f8 = [r2], 32 " ldf.fill f8 = [r2], 32\n" \
ldf.fill f9 = [r3], 32 " ldf.fill f9 = [r3], 32\n" \
mov b0 = loc1 " mov b0 = loc1\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ldf.fill f10 = [r2], 32 " ldf.fill f10 = [r2], 32\n" \
ldf.fill f11 = [r3], 32 " ldf.fill f11 = [r3], 32\n" \
mov b6 = r9 " mov b6 = r9\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ldf.fill f12 = [r2], 32 " ldf.fill f12 = [r2], 32\n" \
ldf.fill f13 = [r3], 32 " ldf.fill f13 = [r3], 32\n" \
mov ar.pfs = loc0 " mov ar.pfs = loc0\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ldf.fill f14 = [r2], 32 " ldf.fill f14 = [r2], 32\n" \
ldf.fill f15 = [r3], 32 " ldf.fill f15 = [r3], 32\n" \
adds r12 = 160, r12 " adds r12 = 160, r12\n" \
;; " ;;\n" \
} " }\n" \
{ .mii " { .mii\n" \
mov r9 = loc3 /* restore language specific register */ " mov r9 = loc3 /* restore language specific register */\n" \
mov r10 = loc4 /* restore language specific register */ " mov r10 = loc4 /* restore language specific register */\n" \
mov r11 = loc5 /* restore language specific register */ " mov r11 = loc5 /* restore language specific register */\n" \
} " }\n" \
{ .mii " { .mii\n" \
ld8 gp = [ret0] " ld8 gp = [ret0]\n" \
mov r8 = loc2 /* restore struct value register */ " mov r8 = loc2 /* restore struct value register */\n" \
;; " ;;\n" \
} " }\n" \
/* An alloc is needed for the break system call to work. " /* An alloc is needed for the break system call to work.\n" \
We don't care about the old value of the pfs register. */ " We don't care about the old value of the pfs register. */\n" \
{ .mmb " { .mmb\n" \
alloc r2 = ar.pfs, 0, 0, 8, 0 " alloc r2 = ar.pfs, 0, 0, 8, 0\n" \
br.sptk.many b6 " br.sptk.many b6\n" \
;; " ;;\n" \
} " }\n" \
.endp " #tramp_name "#") " .endp " #tramp_name "#\n");
#ifndef PROF #ifndef PROF
#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
@ -270,148 +286,148 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
The C function `_dl_start' is the real entry point; The C function `_dl_start' is the real entry point;
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START asm ("\ #define RTLD_START asm ( \
.text ".text\n" \
.global _start# " .global _start#\n" \
.proc _start# " .proc _start#\n" \
_start: "_start:\n" \
0: { .mii "0: { .mii\n" \
alloc loc0 = ar.pfs, 0, 3, 4, 0 " alloc loc0 = ar.pfs, 0, 3, 4, 0\n" \
mov r2 = ip " mov r2 = ip\n" \
addl r3 = @gprel(0b), r0 " addl r3 = @gprel(0b), r0\n" \
;; " ;;\n" \
} " }\n" \
{ .mlx " { .mlx\n" \
/* Calculate the GP, and save a copy in loc1. */ " /* Calculate the GP, and save a copy in loc1. */\n" \
sub gp = r2, r3 " sub gp = r2, r3\n" \
movl r8 = 0x9804c0270033f " movl r8 = 0x9804c0270033f\n" \
;; " ;;\n" \
} " }\n" \
{ .mii " { .mii\n" \
mov ar.fpsr = r8 " mov ar.fpsr = r8\n" \
sub loc1 = r2, r3 " sub loc1 = r2, r3\n" \
/* _dl_start wants a pointer to the pointer to the arg block " /* _dl_start wants a pointer to the pointer to the arg block and\n" \
and the arg block starts with an integer, thus the magic 16. */ " the arg block starts with an integer, thus the magic 16. */\n" \
adds out0 = 16, sp " adds out0 = 16, sp\n" \
} " }\n" \
{ .bbb " { .bbb\n" \
br.call.sptk.many b0 = _dl_start# " br.call.sptk.many b0 = _dl_start#\n" \
;; " ;;\n" \
} " }\n" \
.endp _start# " .endp _start#\n" \
/* FALLTHRU */ " /* FALLTHRU */\n" \
.global _dl_start_user# " .global _dl_start_user#\n" \
.proc _dl_start_user# " .proc _dl_start_user#\n" \
_dl_start_user: "_dl_start_user:\n" \
{ .mii " { .mii\n" \
/* Save the pointer to the user entry point fptr in loc2. */ " /* Save the pointer to the user entry point fptr in loc2. */\n" \
mov loc2 = ret0 " mov loc2 = ret0\n" \
/* Store the highest stack address. */ " /* Store the highest stack address. */\n" \
addl r2 = @ltoff(__libc_stack_end#), gp " addl r2 = @ltoff(__libc_stack_end#), gp\n" \
addl r3 = @gprel(_dl_skip_args), gp " addl r3 = @gprel(_dl_skip_args), gp\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ld8 r2 = [r2] " ld8 r2 = [r2]\n" \
ld4 r3 = [r3] " ld4 r3 = [r3]\n" \
adds r11 = 24, sp /* Load the address of argv. */ " adds r11 = 24, sp /* Load the address of argv. */\n" \
;; " ;;\n" \
} " }\n" \
{ .mii " { .mii\n" \
st8 [r2] = sp " st8 [r2] = sp\n" \
adds r10 = 16, sp /* Load the address of argc. */ " adds r10 = 16, sp /* Load the address of argc. */\n" \
mov out2 = r11 " mov out2 = r11\n" \
;; " ;;\n" \
/* See if we were run as a command with the executable file " /* See if we were run as a command with the executable file\n" \
name as an extra leading argument. If so, adjust the argv " name as an extra leading argument. If so, adjust the argv\n" \
pointer to skip _dl_skip_args words. " pointer to skip _dl_skip_args words.\n" \
Note that _dl_skip_args is an integer, not a long - Jes " Note that _dl_skip_args is an integer, not a long - Jes\n" \
"\n" \
The stack pointer has to be 16 byte aligned. We cannot simply " The stack pointer has to be 16 byte aligned. We cannot simply\n" \
addjust the stack pointer. We have to move the whole argv and " addjust the stack pointer. We have to move the whole argv and\n" \
envp and adjust _dl_argv by _dl_skip_args. H.J. */ " envp and adjust _dl_argv by _dl_skip_args. H.J. */\n" \
} " }\n" \
{ .mib " { .mib\n" \
ld8 out1 = [r10] /* is argc actually stored as a long " ld8 out1 = [r10] /* is argc actually stored as a long\n" \
or as an int? */ " or as an int? */\n" \
addl r2 = @ltoff(_dl_argv), gp " addl r2 = @ltoff(_dl_argv), gp\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ld8 r2 = [r2] /* Get the address of _dl_argv. */ " ld8 r2 = [r2] /* Get the address of _dl_argv. */\n" \
sub out1 = out1, r3 /* Get the new argc. */ " sub out1 = out1, r3 /* Get the new argc. */\n" \
shladd r3 = r3, 3, r0 " shladd r3 = r3, 3, r0\n" \
;; " ;;\n" \
} " }\n" \
{ " {\n" \
.mib " .mib\n" \
ld8 r17 = [r2] /* Get _dl_argv. */ " ld8 r17 = [r2] /* Get _dl_argv. */\n" \
add r15 = r11, r3 /* The address of the argv we move */ " add r15 = r11, r3 /* The address of the argv we move */\n" \
;; " ;;\n" \
} " }\n" \
/* ??? Could probably merge these two loops into 3 bundles. " /* ??? Could probably merge these two loops into 3 bundles.\n" \
using predication to control which set of copies we're on. */ " using predication to control which set of copies we're on. */\n" \
1: /* Copy argv. */ "1: /* Copy argv. */\n" \
{ .mfi " { .mfi\n" \
ld8 r16 = [r15], 8 /* Load the value in the old argv. */ " ld8 r16 = [r15], 8 /* Load the value in the old argv. */\n" \
;; " ;;\n" \
} " }\n" \
{ .mib " { .mib\n" \
st8 [r11] = r16, 8 /* Store it in the new argv. */ " st8 [r11] = r16, 8 /* Store it in the new argv. */\n" \
cmp.ne p6, p7 = 0, r16 " cmp.ne p6, p7 = 0, r16\n" \
(p6) br.cond.dptk.few 1b "(p6) br.cond.dptk.few 1b\n" \
;; " ;;\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
mov out3 = r11 " mov out3 = r11\n" \
sub r17 = r17, r3 /* Substract _dl_skip_args. */ " sub r17 = r17, r3 /* Substract _dl_skip_args. */\n" \
addl out0 = @ltoff(_dl_loaded), gp " addl out0 = @ltoff(_dl_loaded), gp\n" \
} " }\n" \
1: /* Copy env. */ "1: /* Copy env. */\n" \
{ .mfi " { .mfi\n" \
ld8 r16 = [r15], 8 /* Load the value in the old env. */ " ld8 r16 = [r15], 8 /* Load the value in the old env. */\n" \
;; " ;;\n" \
} " }\n" \
{ .mib " { .mib\n" \
st8 [r11] = r16, 8 /* Store it in the new env. */ " st8 [r11] = r16, 8 /* Store it in the new env. */\n" \
cmp.ne p6, p7 = 0, r16 " cmp.ne p6, p7 = 0, r16\n" \
(p6) br.cond.dptk.few 1b "(p6) br.cond.dptk.few 1b\n" \
;; " ;;\n" \
} " }\n" \
{ .mmb " { .mmb\n" \
st8 [r10] = out1 /* Record the new argc. */ " st8 [r10] = out1 /* Record the new argc. */\n" \
ld8 out0 = [out0] " ld8 out0 = [out0]\n" \
;; " ;;\n" \
} " }\n" \
{ .mmb " { .mmb\n" \
ld8 out0 = [out0] /* get the linkmap */ " ld8 out0 = [out0] /* get the linkmap */\n" \
st8 [r2] = r17 /* Load the new _dl_argv. */ " st8 [r2] = r17 /* Load the new _dl_argv. */\n" \
br.call.sptk.many b0 = _dl_init# " br.call.sptk.many b0 = _dl_init#\n" \
;; " ;;\n" \
} " }\n" \
/* Pass our finializer function to the user, " /* Pass our finializer function to the user,\n" \
and jump to the user's entry point. */ " and jump to the user's entry point. */\n" \
{ .mmi " { .mmi\n" \
ld8 r3 = [loc2], 8 " ld8 r3 = [loc2], 8\n" \
mov b0 = r0 " mov b0 = r0\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
addl ret0 = @ltoff(@fptr(_dl_fini#)), gp " addl ret0 = @ltoff(@fptr(_dl_fini#)), gp\n" \
;; " ;;\n" \
mov b6 = r3 " mov b6 = r3\n" \
} " }\n" \
{ .mmi " { .mmi\n" \
ld8 ret0 = [ret0] " ld8 ret0 = [ret0]\n" \
ld8 gp = [loc2] " ld8 gp = [loc2]\n" \
mov ar.pfs = loc0 " mov ar.pfs = loc0\n" \
;; " ;;\n" \
} " }\n" \
{ .mfb " { .mfb\n" \
br.sptk.many b6 " br.sptk.many b6\n" \
;; " ;;\n" \
} " }\n" \
.endp _dl_start_user# " .endp _dl_start_user#\n" \
.previous"); ".previous\n");
#ifndef RTLD_START_SPECIAL_INIT #ifndef RTLD_START_SPECIAL_INIT
@ -434,8 +450,8 @@ _dl_start_user:
#define ELF_MACHINE_NO_REL 1 #define ELF_MACHINE_NO_REL 1
/* Return the address of the entry point. */ /* Return the address of the entry point. */
#define ELF_MACHINE_START_ADDRESS(map, start) \ #define ELF_MACHINE_START_ADDRESS(map, start) \
DL_FUNCTION_ADDRESS (map, start) DL_STATIC_FUNCTION_ADDRESS (map, start)
#define elf_machine_profile_fixup_plt(l, reloc, rel_addr, value) \ #define elf_machine_profile_fixup_plt(l, reloc, rel_addr, value) \
elf_machine_fixup_plt (l, reloc, rel_addr, value) elf_machine_fixup_plt (l, reloc, rel_addr, value)
@ -452,7 +468,9 @@ elf_machine_fixup_plt (struct link_map *l, lookup_t t,
* being called */ * being called */
/* got has already been relocated in elf_get_dynamic_info() */ /* got has already been relocated in elf_get_dynamic_info() */
reloc_addr[1] = t->l_info[DT_PLTGOT]->d_un.d_ptr; reloc_addr[1] = t->l_info[DT_PLTGOT]->d_un.d_ptr;
reloc_addr[0] = value; /* we need a "release" here to ensure that the gp is visible before
the code entry point is updated: */
((volatile Elf64_Addr *) reloc_addr)[0] = value;
return (Elf64_Addr) reloc_addr; return (Elf64_Addr) reloc_addr;
} }
@ -487,7 +505,7 @@ elf_machine_rela (struct link_map *map,
const struct r_found_version *version, const struct r_found_version *version,
Elf64_Addr *const reloc_addr) Elf64_Addr *const reloc_addr)
{ {
unsigned long const r_type = ELF64_R_TYPE (reloc->r_info); const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
Elf64_Addr value; Elf64_Addr value;
#ifndef RTLD_BOOTSTRAP #ifndef RTLD_BOOTSTRAP
@ -533,35 +551,9 @@ elf_machine_rela (struct link_map *map,
return; return;
} }
else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_FPTR64LSB)) else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_FPTR64LSB))
#ifndef RTLD_BOOTSTRAP value = __ia64_make_fptr (sym_map, sym, value);
value = __ia64_make_fptr (sym_map, value, &__fptr_root, NULL);
#else
{
struct ia64_fptr *p_boot_ldso_fptr;
struct ia64_fptr **p_fptr_root;
int *p_fptr_count;
/* Special care must be taken to address these variables
during bootstrap. Further, since we don't know exactly
when __fptr_next will be relocated, we index directly
off __boot_ldso_fptr. */
asm ("addl %0 = @gprel(__boot_ldso_fptr#), gp\n\t"
"addl %1 = @gprel(__fptr_root#), gp\n\t"
"addl %2 = @gprel(__fptr_count#), gp"
: "=r"(p_boot_ldso_fptr),
"=r"(p_fptr_root),
"=r"(p_fptr_count));
/*
* Go from the top - __ia64_make_fptr goes from the bottom,
* this way we will never clash.
*/
value = __ia64_make_fptr (sym_map, value, p_fptr_root,
&p_boot_ldso_fptr[--*p_fptr_count]);
}
#endif
else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB)) else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB))
value -= (Elf64_Addr)reloc_addr & -16; value -= (Elf64_Addr) reloc_addr & -16;
else else
assert (! "unexpected dynamic reloc type"); assert (! "unexpected dynamic reloc type");
} }
@ -573,7 +565,7 @@ elf_machine_rela (struct link_map *map,
if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_64LSB) if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_64LSB)
*reloc_addr = value; *reloc_addr = value;
else if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_32LSB) else if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_32LSB)
*(int *)reloc_addr = value; *(int *) reloc_addr = value;
else if (r_type == R_IA64_IPLTLSB) else if (r_type == R_IA64_IPLTLSB)
{ {
reloc_addr[0] = 0; reloc_addr[0] = 0;
@ -589,8 +581,8 @@ static inline void
elf_machine_lazy_rel (struct link_map *map, elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr l_addr, const Elf64_Rela *reloc) Elf64_Addr l_addr, const Elf64_Rela *reloc)
{ {
Elf64_Addr * const reloc_addr = (void *)(l_addr + reloc->r_offset); Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
unsigned long const r_type = ELF64_R_TYPE (reloc->r_info); const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
if (r_type == R_IA64_IPLTLSB) if (r_type == R_IA64_IPLTLSB)
{ {

View File

@ -1,5 +1,5 @@
/* Get the symbol address. IA-64 version. /* Get the symbol address. IA-64 version.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -27,13 +27,7 @@ _dl_symbol_address (const struct link_map *map, const Elf64_Sym *ref)
/* On ia64, we have to return the pointer to function descriptor. */ /* On ia64, we have to return the pointer to function descriptor. */
if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC) if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC)
return (void *) __ia64_make_fptr (map, value, &__fptr_root, NULL); return (void *) __ia64_make_fptr (map, ref, value);
else else
return (void *) value; return (void *) value;
} }
Elf64_Addr
_dl_function_address (const struct link_map *map, Elf64_Addr start)
{
return __ia64_make_fptr (map, start, &__fptr_root, NULL);
}