Fix compilation on ARM
authorPetr Machata <pmachata@redhat.com>
Tue, 5 Nov 2013 03:50:11 +0000 (22:50 -0500)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:23 +0000 (20:38 +0900)
- This was broken several commits back by removing pltrel from
  struct ltelf.

sysdeps/linux-gnu/arm/arch.h
sysdeps/linux-gnu/arm/plt.c

index 58a7fdf..6d0d902 100644 (file)
@@ -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
index 649f73a..9e9e37f 100644 (file)
@@ -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.  */