diff options
-rw-r--r-- | sysdeps/linux-gnu/arm/arch.h | 4 | ||||
-rw-r--r-- | sysdeps/linux-gnu/arm/plt.c | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/linux-gnu/arm/arch.h b/sysdeps/linux-gnu/arm/arch.h index 58a7fdf..6d0d902 100644 --- a/sysdeps/linux-gnu/arm/arch.h +++ b/sysdeps/linux-gnu/arm/arch.h @@ -22,6 +22,8 @@ #ifndef LTRACE_ARM_ARCH_H #define LTRACE_ARM_ARCH_H +#include <libelf.h> + #define ARCH_HAVE_ENABLE_BREAKPOINT 1 #define ARCH_HAVE_DISABLE_BREAKPOINT 1 @@ -47,7 +49,7 @@ struct arch_breakpoint_data { #define ARCH_HAVE_LTELF_DATA struct arch_ltelf_data { - /* We have this only for the hooks. */ + Elf_Data *jmprel_data; }; #define ARCH_HAVE_LIBRARY_DATA diff --git a/sysdeps/linux-gnu/arm/plt.c b/sysdeps/linux-gnu/arm/plt.c index 649f73a..9e9e37f 100644 --- a/sysdeps/linux-gnu/arm/plt.c +++ b/sysdeps/linux-gnu/arm/plt.c @@ -1,5 +1,6 @@ /* * This file is part of ltrace. + * Copyright (C) 2013 Petr Machata, Red Hat Inc. * Copyright (C) 2010 Zach Welch, CodeSourcery * Copyright (C) 2004,2008,2009 Juan Cespedes * @@ -40,6 +41,19 @@ get_hardfp(uint64_t abi_vfp_args) int arch_elf_init(struct ltelf *lte, struct library *lib) { + GElf_Addr jmprel_addr; + Elf_Scn *jmprel_sec; + GElf_Shdr jmprel_shdr; + if (elf_load_dynamic_entry(lte, DT_JMPREL, &jmprel_addr) < 0 + || elf_get_section_covering(lte, jmprel_addr, + &jmprel_sec, &jmprel_shdr) < 0 + || jmprel_sec == NULL) + return -1; + + lte->arch.jmprel_data = elf_loaddata(jmprel_sec, &jmprel_shdr); + if (lte->arch.jmprel_data == NULL) + return -1; + /* Nothing in this section is strictly critical. It's not * that much of a deal if we fail to guess right whether the * ABI is softfp or hardfp. */ |