From bf2a805be23771ea5a612b16516f3d4acafa3980 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Thu, 27 Mar 2003 04:29:07 +0000 Subject: [PATCH] If we have it, include . (current_gp): New function. (callback): Use current_gp() instead of open-coding it. (Logical change 1.68) --- src/ia64/tables-ia64.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/ia64/tables-ia64.c b/src/ia64/tables-ia64.c index 05b8b49e..4b755a37 100644 --- a/src/ia64/tables-ia64.c +++ b/src/ia64/tables-ia64.c @@ -10,6 +10,9 @@ This file is part of libunwind. */ #include #include +#ifdef HAVE_IA64INTRIN_H +# include +#endif #include "unwind_i.h" @@ -286,6 +289,19 @@ _Uia64_get_kernel_table (unw_dyn_info_t *di) 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 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 - { - /* Otherwise this is a static executable with no _DYNAMIC. - The gp is constant program-wide. */ - register unsigned long gp __asm__("gp"); - di->gp = gp; - } + /* Otherwise this is a static executable with no _DYNAMIC. + The gp is constant program-wide. */ + di->gp = current_gp(); di->format = UNW_INFO_FORMAT_TABLE; di->start_ip = p_text->p_vaddr + load_base; di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;