+2013-03-12 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/ia64/dl-fptr.h (ELF_PTR_TO_FDESC): New definition.
+ * sysdeps/ia64/dl-machine.h (elf_machine_runtime_setup): Change
+ struct fdesc * casts to use new ELF_PTR_TO_FDESC helper.
+ * sysdeps/ia64/entry.h: Include link.h and dl-fptr.h.
+ (ENTRY_POINT): Change cast to use new ELF_PTR_TO_FDESC helper.
+ * sysdeps/unix/sysv/linux/ia64/makecontext.c: Include link.h and
+ dl-fptr.h.
+ (struct fdesc): Remove structure, now redundant.
+ (makecontext): Change casts to use new ELF_PTR_TO_FDESC helper.
+
2013-03-11 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/ia64/bits/mman.h: Remove all defines
#define ELF_MACHINE_LOAD_ADDRESS(var, symbol) \
asm ("movl %0 = @gprel (" #symbol ");; add %0 = %0, gp" : "=&r" (var));
+/* We don't have a gcc helper to extract the plabel info. */
+#define ELF_PTR_TO_FDESC(ptr) \
+ ({ union { \
+ void *_ptr; \
+ struct fdesc *_fdesc; \
+ } _u; \
+ _u._ptr = ptr; \
+ _u._fdesc; \
+ })
+
#endif /* !dl_ia64_fptr_h */
/* This function will be called to perform the relocation. */
if (!profile)
- doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_resolve)->ip;
+ doit = (Elf64_Addr) ELF_PTR_TO_FDESC (&_dl_runtime_resolve)->ip;
else
{
if (GLRO(dl_profile) != NULL
want profiling and the timers are started. */
GL(dl_profile_map) = l;
}
- doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_profile)->ip;
+ doit = (Elf64_Addr) ELF_PTR_TO_FDESC (&_dl_runtime_profile)->ip;
}
reserve[1] = doit;
+#include <link.h>
+#include <dl-fptr.h>
+
#ifndef __ASSEMBLY__
extern void _start (void);
#endif
/* The function's entry point is stored in the first word of the
function descriptor (plabel) of _start(). */
-#define ENTRY_POINT (((long int *) _start)[0])
+#define ENTRY_POINT ELF_PTR_TO_FDESC (_start)->ip
/* We have to provide a special declaration. */
#define ENTRY_POINT_DECL(class) class void _start (void);
#include <stdlib.h>
#include <ucontext.h>
#include <sys/rse.h>
+#include <link.h>
+#include <dl-fptr.h>
-struct fdesc
- {
- unsigned long ip;
- unsigned long gp;
- };
-
#define PUSH(val) \
do { \
if (ia64_rse_is_rnat_slot (rbs)) \
}
/* set the entry point and global pointer: */
- sc->sc_br[0] = ((struct fdesc *) &__start_context)->ip;
- sc->sc_br[1] = ((struct fdesc *) func)->ip;
- sc->sc_gr[1] = ((struct fdesc *) func)->gp;
+ sc->sc_br[0] = ELF_PTR_TO_FDESC (&__start_context)->ip;
+ sc->sc_br[1] = ELF_PTR_TO_FDESC (func)->ip;
+ sc->sc_gr[1] = ELF_PTR_TO_FDESC (func)->gp;
/* set up the call frame: */
sc->sc_ar_pfs = ((sc->sc_ar_pfs & ~0x3fffffffffUL)
| (argc + 2) | ((argc + 2) << 7));
rbs = (unsigned long *) stack_start;
PUSH((long) ucp->uc_link);
- PUSH(((struct fdesc *) &__start_context)->gp);
+ PUSH(ELF_PTR_TO_FDESC (&__start_context)->gp);
va_start (ap, argc);
for (i = 0; i < argc; ++i)
PUSH(va_arg (ap, long));