mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-22 16:20:29 +01:00
If we have it, include <ia64intrin.h>.
(current_gp): New function. (callback): Use current_gp() instead of open-coding it. (Logical change 1.68)
This commit is contained in:
parent
43d0e03dc6
commit
bf2a805be2
1 changed files with 19 additions and 6 deletions
|
@ -10,6 +10,9 @@ This file is part of libunwind. */
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_IA64INTRIN_H
|
||||||
|
# include <ia64intrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "unwind_i.h"
|
#include "unwind_i.h"
|
||||||
|
|
||||||
|
@ -286,6 +289,19 @@ _Uia64_get_kernel_table (unw_dyn_info_t *di)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned long
|
||||||
|
current_gp (void)
|
||||||
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
register unsigned long gp __asm__("gp");
|
||||||
|
return gp;
|
||||||
|
#elif HAVE_IA64INTRIN_H
|
||||||
|
return __getReg(_IA64_REG_GP);
|
||||||
|
#else
|
||||||
|
# error Implement me.
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
callback (struct dl_phdr_info *info, size_t size, void *ptr)
|
callback (struct dl_phdr_info *info, size_t size, void *ptr)
|
||||||
{
|
{
|
||||||
|
@ -340,12 +356,9 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
/* Otherwise this is a static executable with no _DYNAMIC.
|
/* Otherwise this is a static executable with no _DYNAMIC.
|
||||||
The gp is constant program-wide. */
|
The gp is constant program-wide. */
|
||||||
register unsigned long gp __asm__("gp");
|
di->gp = current_gp();
|
||||||
di->gp = gp;
|
|
||||||
}
|
|
||||||
di->format = UNW_INFO_FORMAT_TABLE;
|
di->format = UNW_INFO_FORMAT_TABLE;
|
||||||
di->start_ip = p_text->p_vaddr + load_base;
|
di->start_ip = p_text->p_vaddr + load_base;
|
||||||
di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;
|
di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;
|
||||||
|
|
Loading…
Reference in a new issue