f8560c
diff --git a/ltrace-elf.c b/ltrace-elf.c
f8560c
index 92b642b..6f86d56 100644
f8560c
--- a/ltrace-elf.c
f8560c
+++ b/ltrace-elf.c
f8560c
@@ -531,6 +531,38 @@ elf_read_relocs(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr,
f8560c
 	return 0;
f8560c
 }
f8560c
 
f8560c
+int
f8560c
+elf_load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep)
f8560c
+{
f8560c
+	Elf_Scn *scn;
f8560c
+	GElf_Shdr shdr;
f8560c
+	if (elf_get_section_type(lte, SHT_DYNAMIC, &scn, &shdr) < 0
f8560c
+	    || scn == NULL) {
f8560c
+	fail:
f8560c
+		fprintf(stderr, "Couldn't get SHT_DYNAMIC: %s\n",
f8560c
+			elf_errmsg(-1));
f8560c
+		return -1;
f8560c
+	}
f8560c
+
f8560c
+	Elf_Data *data = elf_loaddata(scn, &shdr);
f8560c
+	if (data == NULL)
f8560c
+		goto fail;
f8560c
+
f8560c
+	size_t j;
f8560c
+	for (j = 0; j < shdr.sh_size / shdr.sh_entsize; ++j) {
f8560c
+		GElf_Dyn dyn;
f8560c
+		if (gelf_getdyn(data, j, &dyn) == NULL)
f8560c
+			goto fail;
f8560c
+
f8560c
+		if(dyn.d_tag == tag) {
f8560c
+			*valuep = dyn.d_un.d_ptr;
f8560c
+			return 0;
f8560c
+		}
f8560c
+	}
f8560c
+
f8560c
+	return -1;
f8560c
+}
f8560c
+
f8560c
 static int
f8560c
 ltelf_read_elf(struct ltelf *lte, const char *filename)
f8560c
 {
f8560c
diff --git a/ltrace-elf.h b/ltrace-elf.h
f8560c
index ea14512..db4ffe9 100644
f8560c
--- a/ltrace-elf.h
f8560c
+++ b/ltrace-elf.h
f8560c
@@ -139,6 +139,10 @@ struct elf_each_symbol_t {
f8560c
 int elf_read_relocs(struct ltelf *lte, Elf_Scn *scn, GElf_Shdr *shdr,
f8560c
 		    struct vect *rela_vec);
f8560c
 
f8560c
+/* Read a given DT_ TAG from LTE.  Value is returned in *VALUEP.
f8560c
+ * Returns 0 on success or a negative value on failure.  */
f8560c
+int elf_load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep);
f8560c
+
f8560c
 /* Read, respectively, 1, 2, 4, or 8 bytes from Elf data at given
f8560c
  * OFFSET, and store it in *RETP.  Returns 0 on success or a negative
f8560c
  * value if there's not enough data.  */
f8560c
diff --git a/sysdeps/linux-gnu/arm/arch.h b/sysdeps/linux-gnu/arm/arch.h
f8560c
index 58a7fdf..6d0d902 100644
f8560c
--- a/sysdeps/linux-gnu/arm/arch.h
f8560c
+++ b/sysdeps/linux-gnu/arm/arch.h
f8560c
@@ -22,6 +22,8 @@
f8560c
 #ifndef LTRACE_ARM_ARCH_H
f8560c
 #define LTRACE_ARM_ARCH_H
f8560c
 
f8560c
+#include <libelf.h>
f8560c
+
f8560c
 #define ARCH_HAVE_ENABLE_BREAKPOINT 1
f8560c
 #define ARCH_HAVE_DISABLE_BREAKPOINT 1
f8560c
 
f8560c
@@ -47,7 +49,7 @@ struct arch_breakpoint_data {
f8560c
 
f8560c
 #define ARCH_HAVE_LTELF_DATA
f8560c
 struct arch_ltelf_data {
f8560c
-	/* We have this only for the hooks.  */
f8560c
+	Elf_Data *jmprel_data;
f8560c
 };
f8560c
 
f8560c
 #define ARCH_HAVE_LIBRARY_DATA
f8560c
diff --git a/sysdeps/linux-gnu/arm/fetch.c b/sysdeps/linux-gnu/arm/fetch.c
f8560c
index 5081d78..b500448 100644
f8560c
--- a/sysdeps/linux-gnu/arm/fetch.c
f8560c
+++ b/sysdeps/linux-gnu/arm/fetch.c
f8560c
@@ -32,200 +32,12 @@
f8560c
 #include "backend.h"
f8560c
 #include "fetch.h"
f8560c
 #include "library.h"
f8560c
-#include "ltrace-elf.h"
f8560c
 #include "proc.h"
f8560c
 #include "ptrace.h"
f8560c
 #include "regs.h"
f8560c
 #include "type.h"
f8560c
 #include "value.h"
f8560c
 
f8560c
-static int
f8560c
-get_hardfp(uint64_t abi_vfp_args)
f8560c
-{
f8560c
-	if (abi_vfp_args == 2)
f8560c
-		fprintf(stderr,
f8560c
-			"Tag_ABI_VFP_args value 2 (tool chain-specific "
f8560c
-			"conventions) not supported.\n");
f8560c
-	return abi_vfp_args == 1;
f8560c
-}
f8560c
-
f8560c
-int
f8560c
-arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
-{
f8560c
-	/* Nothing in this section is strictly critical.  It's not
f8560c
-	 * that much of a deal if we fail to guess right whether the
f8560c
-	 * ABI is softfp or hardfp.  */
f8560c
-	unsigned hardfp = 0;
f8560c
-
f8560c
-	Elf_Scn *scn;
f8560c
-	Elf_Data *data;
f8560c
-	GElf_Shdr shdr;
f8560c
-	if (elf_get_section_type(lte, SHT_ARM_ATTRIBUTES, &scn, &shdr) < 0
f8560c
-	    || (scn != NULL && (data = elf_loaddata(scn, &shdr)) == NULL)) {
f8560c
-		fprintf(stderr,
f8560c
-			"Error when obtaining ARM attribute section: %s\n",
f8560c
-			elf_errmsg(-1));
f8560c
-		goto done;
f8560c
-
f8560c
-	} else if (scn != NULL && data != NULL) {
f8560c
-		GElf_Xword offset = 0;
f8560c
-		uint8_t version;
f8560c
-		if (elf_read_next_u8(data, &offset, &version) < 0) {
f8560c
-			goto done;
f8560c
-		} else if (version != 'A') {
f8560c
-			fprintf(stderr, "Unsupported ARM attribute section "
f8560c
-				"version %d ('%c').\n", version, version);
f8560c
-			goto done;
f8560c
-		}
f8560c
-
f8560c
-		do {
f8560c
-			const char signature[] = "aeabi";
f8560c
-			/* N.B. LEN is including the length field
f8560c
-			 * itself.  */
f8560c
-			uint32_t sec_len;
f8560c
-			if (elf_read_u32(data, offset, &sec_len) < 0
f8560c
-			    || !elf_can_read_next(data, offset, sec_len)) {
f8560c
-				goto done;
f8560c
-			}
f8560c
-			const GElf_Xword next_offset = offset + sec_len;
f8560c
-			offset += 4;
f8560c
-
f8560c
-			if (sec_len < 4 + sizeof signature
f8560c
-			    || strcmp(signature, data->d_buf + offset) != 0)
f8560c
-				goto skip;
f8560c
-			offset += sizeof signature;
f8560c
-
f8560c
-			const GElf_Xword offset0 = offset;
f8560c
-			uint64_t tag;
f8560c
-			uint32_t sub_len;
f8560c
-			if (elf_read_next_uleb128(data, &offset, &tag) < 0
f8560c
-			    || elf_read_next_u32(data, &offset, &sub_len) < 0
f8560c
-			    || !elf_can_read_next(data, offset0, sub_len))
f8560c
-				goto done;
f8560c
-
f8560c
-			if (tag != 1)
f8560c
-				/* IHI0045D_ABI_addenda: "section and
f8560c
-				 * symbol attributes are deprecated
f8560c
-				 * [...] consumers are permitted to
f8560c
-				 * ignore them."  */
f8560c
-				goto skip;
f8560c
-
f8560c
-			while (offset < offset0 + sub_len) {
f8560c
-				if (elf_read_next_uleb128(data,
f8560c
-							  &offset, &tag) < 0)
f8560c
-					goto done;
f8560c
-
f8560c
-				switch (tag) {
f8560c
-					uint64_t v;
f8560c
-				case 6: /* Tag_CPU_arch */
f8560c
-				case 7: /* Tag_CPU_arch_profile */
f8560c
-				case 8: /* Tag_ARM_ISA_use */
f8560c
-				case 9: /* Tag_THUMB_ISA_use */
f8560c
-				case 10: /* Tag_FP_arch */
f8560c
-				case 11: /* Tag_WMMX_arch */
f8560c
-				case 12: /* Tag_Advanced_SIMD_arch */
f8560c
-				case 13: /* Tag_PCS_config */
f8560c
-				case 14: /* Tag_ABI_PCS_R9_use */
f8560c
-				case 15: /* Tag_ABI_PCS_RW_data */
f8560c
-				case 16: /* Tag_ABI_PCS_RO_data */
f8560c
-				case 17: /* Tag_ABI_PCS_GOT_use */
f8560c
-				case 18: /* Tag_ABI_PCS_wchar_t */
f8560c
-				case 19: /* Tag_ABI_FP_rounding */
f8560c
-				case 20: /* Tag_ABI_FP_denormal */
f8560c
-				case 21: /* Tag_ABI_FP_exceptions */
f8560c
-				case 22: /* Tag_ABI_FP_user_exceptions */
f8560c
-				case 23: /* Tag_ABI_FP_number_model */
f8560c
-				case 24: /* Tag_ABI_align_needed */
f8560c
-				case 25: /* Tag_ABI_align_preserved */
f8560c
-				case 26: /* Tag_ABI_enum_size */
f8560c
-				case 27: /* Tag_ABI_HardFP_use */
f8560c
-				case 28: /* Tag_ABI_VFP_args */
f8560c
-				case 29: /* Tag_ABI_WMMX_args */
f8560c
-				case 30: /* Tag_ABI_optimization_goals */
f8560c
-				case 31: /* Tag_ABI_FP_optimization_goals */
f8560c
-				case 32: /* Tag_compatibility */
f8560c
-				case 34: /* Tag_CPU_unaligned_access */
f8560c
-				case 36: /* Tag_FP_HP_extension */
f8560c
-				case 38: /* Tag_ABI_FP_16bit_format */
f8560c
-				case 42: /* Tag_MPextension_use */
f8560c
-				case 70: /* Tag_MPextension_use as well */
f8560c
-				case 44: /* Tag_DIV_use */
f8560c
-				case 64: /* Tag_nodefaults */
f8560c
-				case 66: /* Tag_T2EE_use */
f8560c
-				case 68: /* Tag_Virtualization_use */
f8560c
-				uleb128:
f8560c
-					if (elf_read_next_uleb128
f8560c
-						(data, &offset, &v) < 0)
f8560c
-						goto done;
f8560c
-					if (tag == 28)
f8560c
-						hardfp = get_hardfp(v);
f8560c
-					if (tag != 32)
f8560c
-						continue;
f8560c
-
f8560c
-					/* Tag 32 has two arguments,
f8560c
-					 * fall through.  */
f8560c
-
f8560c
-				case 4:	/* Tag_CPU_raw_name */
f8560c
-				case 5:	/* Tag_CPU_name */
f8560c
-				case 65: /* Tag_also_compatible_with */
f8560c
-				case 67: /* Tag_conformance */
f8560c
-				ntbs:
f8560c
-					offset += strlen(data->d_buf
f8560c
-							 + offset) + 1;
f8560c
-					continue;
f8560c
-				}
f8560c
-
f8560c
-				/* Handle unknown tags in a generic
f8560c
-				 * manner, if possible.  */
f8560c
-				if (tag <= 32) {
f8560c
-					fprintf(stderr,
f8560c
-						"Unknown tag %lld "
f8560c
-						"at offset %#llx "
f8560c
-						"of ARM attribute section.",
f8560c
-						tag, offset);
f8560c
-					goto skip;
f8560c
-				} else if (tag % 2 == 0) {
f8560c
-					goto uleb128;
f8560c
-				} else {
f8560c
-					goto ntbs;
f8560c
-				}
f8560c
-			}
f8560c
-
f8560c
-		skip:
f8560c
-			offset = next_offset;
f8560c
-
f8560c
-		} while (elf_can_read_next(data, offset, 1));
f8560c
-
f8560c
-	}
f8560c
-
f8560c
-done:
f8560c
-	lib->arch.hardfp = hardfp;
f8560c
-	return 0;
f8560c
-}
f8560c
-
f8560c
-void
f8560c
-arch_elf_destroy(struct ltelf *lte)
f8560c
-{
f8560c
-}
f8560c
-
f8560c
-int
f8560c
-arch_library_init(struct library *lib)
f8560c
-{
f8560c
-	return 0;
f8560c
-}
f8560c
-
f8560c
-void
f8560c
-arch_library_destroy(struct library *lib)
f8560c
-{
f8560c
-}
f8560c
-
f8560c
-int
f8560c
-arch_library_clone(struct library *retp, struct library *lib)
f8560c
-{
f8560c
-	retp->arch = lib->arch;
f8560c
-	return 0;
f8560c
-}
f8560c
-
f8560c
 enum {
f8560c
 	/* How many (double) VFP registers the AAPCS uses for
f8560c
 	 * parameter passing.  */
f8560c
diff --git a/sysdeps/linux-gnu/arm/plt.c b/sysdeps/linux-gnu/arm/plt.c
f8560c
index d1bf7ca..9e9e37f 100644
f8560c
--- a/sysdeps/linux-gnu/arm/plt.c
f8560c
+++ b/sysdeps/linux-gnu/arm/plt.c
f8560c
@@ -1,5 +1,6 @@
f8560c
 /*
f8560c
  * This file is part of ltrace.
f8560c
+ * Copyright (C) 2013 Petr Machata, Red Hat Inc.
f8560c
  * Copyright (C) 2010 Zach Welch, CodeSourcery
f8560c
  * Copyright (C) 2004,2008,2009 Juan Cespedes
f8560c
  *
f8560c
@@ -20,20 +21,205 @@
f8560c
  */
f8560c
 
f8560c
 #include <gelf.h>
f8560c
+#include <stdio.h>
f8560c
+#include <string.h>
f8560c
 
f8560c
 #include "proc.h"
f8560c
 #include "library.h"
f8560c
 #include "ltrace-elf.h"
f8560c
 
f8560c
 static int
f8560c
+get_hardfp(uint64_t abi_vfp_args)
f8560c
+{
f8560c
+	if (abi_vfp_args == 2)
f8560c
+		fprintf(stderr,
f8560c
+			"Tag_ABI_VFP_args value 2 (tool chain-specific "
f8560c
+			"conventions) not supported.\n");
f8560c
+	return abi_vfp_args == 1;
f8560c
+}
f8560c
+
f8560c
+int
f8560c
+arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
+{
f8560c
+	GElf_Addr jmprel_addr;
f8560c
+	Elf_Scn *jmprel_sec;
f8560c
+	GElf_Shdr jmprel_shdr;
f8560c
+	if (elf_load_dynamic_entry(lte, DT_JMPREL, &jmprel_addr) < 0
f8560c
+	    || elf_get_section_covering(lte, jmprel_addr,
f8560c
+					&jmprel_sec, &jmprel_shdr) < 0
f8560c
+	    || jmprel_sec == NULL)
f8560c
+		return -1;
f8560c
+
f8560c
+	lte->arch.jmprel_data = elf_loaddata(jmprel_sec, &jmprel_shdr);
f8560c
+	if (lte->arch.jmprel_data == NULL)
f8560c
+		return -1;
f8560c
+
f8560c
+	/* Nothing in this section is strictly critical.  It's not
f8560c
+	 * that much of a deal if we fail to guess right whether the
f8560c
+	 * ABI is softfp or hardfp.  */
f8560c
+	unsigned hardfp = 0;
f8560c
+
f8560c
+	Elf_Scn *scn;
f8560c
+	Elf_Data *data;
f8560c
+	GElf_Shdr shdr;
f8560c
+	if (elf_get_section_type(lte, SHT_ARM_ATTRIBUTES, &scn, &shdr) < 0
f8560c
+	    || (scn != NULL && (data = elf_loaddata(scn, &shdr)) == NULL)) {
f8560c
+		fprintf(stderr,
f8560c
+			"Error when obtaining ARM attribute section: %s\n",
f8560c
+			elf_errmsg(-1));
f8560c
+		goto done;
f8560c
+
f8560c
+	} else if (scn != NULL && data != NULL) {
f8560c
+		GElf_Xword offset = 0;
f8560c
+		uint8_t version;
f8560c
+		if (elf_read_next_u8(data, &offset, &version) < 0) {
f8560c
+			goto done;
f8560c
+		} else if (version != 'A') {
f8560c
+			fprintf(stderr, "Unsupported ARM attribute section "
f8560c
+				"version %d ('%c').\n", version, version);
f8560c
+			goto done;
f8560c
+		}
f8560c
+
f8560c
+		do {
f8560c
+			const char signature[] = "aeabi";
f8560c
+			/* N.B. LEN is including the length field
f8560c
+			 * itself.  */
f8560c
+			uint32_t sec_len;
f8560c
+			if (elf_read_u32(data, offset, &sec_len) < 0
f8560c
+			    || !elf_can_read_next(data, offset, sec_len)) {
f8560c
+				goto done;
f8560c
+			}
f8560c
+			const GElf_Xword next_offset = offset + sec_len;
f8560c
+			offset += 4;
f8560c
+
f8560c
+			if (sec_len < 4 + sizeof signature
f8560c
+			    || strcmp(signature, data->d_buf + offset) != 0)
f8560c
+				goto skip;
f8560c
+			offset += sizeof signature;
f8560c
+
f8560c
+			const GElf_Xword offset0 = offset;
f8560c
+			uint64_t tag;
f8560c
+			uint32_t sub_len;
f8560c
+			if (elf_read_next_uleb128(data, &offset, &tag) < 0
f8560c
+			    || elf_read_next_u32(data, &offset, &sub_len) < 0
f8560c
+			    || !elf_can_read_next(data, offset0, sub_len))
f8560c
+				goto done;
f8560c
+
f8560c
+			if (tag != 1)
f8560c
+				/* IHI0045D_ABI_addenda: "section and
f8560c
+				 * symbol attributes are deprecated
f8560c
+				 * [...] consumers are permitted to
f8560c
+				 * ignore them."  */
f8560c
+				goto skip;
f8560c
+
f8560c
+			while (offset < offset0 + sub_len) {
f8560c
+				if (elf_read_next_uleb128(data,
f8560c
+							  &offset, &tag) < 0)
f8560c
+					goto done;
f8560c
+
f8560c
+				switch (tag) {
f8560c
+					uint64_t v;
f8560c
+				case 6: /* Tag_CPU_arch */
f8560c
+				case 7: /* Tag_CPU_arch_profile */
f8560c
+				case 8: /* Tag_ARM_ISA_use */
f8560c
+				case 9: /* Tag_THUMB_ISA_use */
f8560c
+				case 10: /* Tag_FP_arch */
f8560c
+				case 11: /* Tag_WMMX_arch */
f8560c
+				case 12: /* Tag_Advanced_SIMD_arch */
f8560c
+				case 13: /* Tag_PCS_config */
f8560c
+				case 14: /* Tag_ABI_PCS_R9_use */
f8560c
+				case 15: /* Tag_ABI_PCS_RW_data */
f8560c
+				case 16: /* Tag_ABI_PCS_RO_data */
f8560c
+				case 17: /* Tag_ABI_PCS_GOT_use */
f8560c
+				case 18: /* Tag_ABI_PCS_wchar_t */
f8560c
+				case 19: /* Tag_ABI_FP_rounding */
f8560c
+				case 20: /* Tag_ABI_FP_denormal */
f8560c
+				case 21: /* Tag_ABI_FP_exceptions */
f8560c
+				case 22: /* Tag_ABI_FP_user_exceptions */
f8560c
+				case 23: /* Tag_ABI_FP_number_model */
f8560c
+				case 24: /* Tag_ABI_align_needed */
f8560c
+				case 25: /* Tag_ABI_align_preserved */
f8560c
+				case 26: /* Tag_ABI_enum_size */
f8560c
+				case 27: /* Tag_ABI_HardFP_use */
f8560c
+				case 28: /* Tag_ABI_VFP_args */
f8560c
+				case 29: /* Tag_ABI_WMMX_args */
f8560c
+				case 30: /* Tag_ABI_optimization_goals */
f8560c
+				case 31: /* Tag_ABI_FP_optimization_goals */
f8560c
+				case 32: /* Tag_compatibility */
f8560c
+				case 34: /* Tag_CPU_unaligned_access */
f8560c
+				case 36: /* Tag_FP_HP_extension */
f8560c
+				case 38: /* Tag_ABI_FP_16bit_format */
f8560c
+				case 42: /* Tag_MPextension_use */
f8560c
+				case 70: /* Tag_MPextension_use as well */
f8560c
+				case 44: /* Tag_DIV_use */
f8560c
+				case 64: /* Tag_nodefaults */
f8560c
+				case 66: /* Tag_T2EE_use */
f8560c
+				case 68: /* Tag_Virtualization_use */
f8560c
+				uleb128:
f8560c
+					if (elf_read_next_uleb128
f8560c
+						(data, &offset, &v) < 0)
f8560c
+						goto done;
f8560c
+					if (tag == 28)
f8560c
+						hardfp = get_hardfp(v);
f8560c
+					if (tag != 32)
f8560c
+						continue;
f8560c
+
f8560c
+					/* Tag 32 has two arguments,
f8560c
+					 * fall through.  */
f8560c
+
f8560c
+				case 4:	/* Tag_CPU_raw_name */
f8560c
+				case 5:	/* Tag_CPU_name */
f8560c
+				case 65: /* Tag_also_compatible_with */
f8560c
+				case 67: /* Tag_conformance */
f8560c
+				ntbs:
f8560c
+					offset += strlen(data->d_buf
f8560c
+							 + offset) + 1;
f8560c
+					continue;
f8560c
+				}
f8560c
+
f8560c
+				/* Handle unknown tags in a generic
f8560c
+				 * manner, if possible.  */
f8560c
+				if (tag <= 32) {
f8560c
+					fprintf(stderr,
f8560c
+						"Unknown tag %lld "
f8560c
+						"at offset %#llx "
f8560c
+						"of ARM attribute section.",
f8560c
+						tag, offset);
f8560c
+					goto skip;
f8560c
+				} else if (tag % 2 == 0) {
f8560c
+					goto uleb128;
f8560c
+				} else {
f8560c
+					goto ntbs;
f8560c
+				}
f8560c
+			}
f8560c
+
f8560c
+		skip:
f8560c
+			offset = next_offset;
f8560c
+
f8560c
+		} while (elf_can_read_next(data, offset, 1));
f8560c
+
f8560c
+	}
f8560c
+
f8560c
+done:
f8560c
+	lib->arch.hardfp = hardfp;
f8560c
+	return 0;
f8560c
+}
f8560c
+
f8560c
+void
f8560c
+arch_elf_destroy(struct ltelf *lte)
f8560c
+{
f8560c
+}
f8560c
+
f8560c
+static int
f8560c
 arch_plt_entry_has_stub(struct ltelf *lte, size_t off) {
f8560c
-	uint16_t op = *(uint16_t *)((char *)lte->relplt->d_buf + off);
f8560c
+	char *buf = (char *) lte->arch.jmprel_data->d_buf;
f8560c
+	uint16_t op = *(uint16_t *) (buf + off);
f8560c
 	return op == 0x4778;
f8560c
 }
f8560c
 
f8560c
 GElf_Addr
f8560c
 arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) {
f8560c
-	size_t start = lte->relplt->d_size + 12;
f8560c
+	size_t start = lte->arch.jmprel_data->d_size + 12;
f8560c
 	size_t off = start + 20, i;
f8560c
 	for (i = 0; i < ndx; i++)
f8560c
 		off += arch_plt_entry_has_stub(lte, off) ? 16 : 12;
f8560c
@@ -47,3 +233,21 @@ sym2addr(struct process *proc, struct library_symbol *sym)
f8560c
 {
f8560c
 	return sym->enter_addr;
f8560c
 }
f8560c
+
f8560c
+int
f8560c
+arch_library_init(struct library *lib)
f8560c
+{
f8560c
+	return 0;
f8560c
+}
f8560c
+
f8560c
+void
f8560c
+arch_library_destroy(struct library *lib)
f8560c
+{
f8560c
+}
f8560c
+
f8560c
+int
f8560c
+arch_library_clone(struct library *retp, struct library *lib)
f8560c
+{
f8560c
+	retp->arch = lib->arch;
f8560c
+	return 0;
f8560c
+}
f8560c
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
f8560c
index 5e3ffe1..3ec1397 100644
f8560c
--- a/sysdeps/linux-gnu/ppc/plt.c
f8560c
+++ b/sysdeps/linux-gnu/ppc/plt.c
f8560c
@@ -402,38 +402,6 @@ get_glink_vma(struct ltelf *lte, GElf_Addr ppcgot, Elf_Data *plt_data)
f8560c
 }
f8560c
 
f8560c
 static int
f8560c
-load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep)
f8560c
-{
f8560c
-	Elf_Scn *scn;
f8560c
-	GElf_Shdr shdr;
f8560c
-	if (elf_get_section_type(lte, SHT_DYNAMIC, &scn, &shdr) < 0
f8560c
-	    || scn == NULL) {
f8560c
-	fail:
f8560c
-		fprintf(stderr, "Couldn't get SHT_DYNAMIC: %s\n",
f8560c
-			elf_errmsg(-1));
f8560c
-		return -1;
f8560c
-	}
f8560c
-
f8560c
-	Elf_Data *data = elf_loaddata(scn, &shdr);
f8560c
-	if (data == NULL)
f8560c
-		goto fail;
f8560c
-
f8560c
-	size_t j;
f8560c
-	for (j = 0; j < shdr.sh_size / shdr.sh_entsize; ++j) {
f8560c
-		GElf_Dyn dyn;
f8560c
-		if (gelf_getdyn(data, j, &dyn) == NULL)
f8560c
-			goto fail;
f8560c
-
f8560c
-		if(dyn.d_tag == tag) {
f8560c
-			*valuep = dyn.d_un.d_ptr;
f8560c
-			return 0;
f8560c
-		}
f8560c
-	}
f8560c
-
f8560c
-	return -1;
f8560c
-}
f8560c
-
f8560c
-static int
f8560c
 nonzero_data(Elf_Data *data)
f8560c
 {
f8560c
 	/* We are not supposed to get here if there's no PLT.  */
f8560c
@@ -488,8 +456,8 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
 	Elf_Scn *rela_sec;
f8560c
 	GElf_Shdr rela_shdr;
f8560c
 	if ((lte->ehdr.e_machine == EM_PPC64 || lte->arch.secure_plt)
f8560c
-	    && load_dynamic_entry(lte, DT_RELA, &rela) == 0
f8560c
-	    && load_dynamic_entry(lte, DT_RELASZ, &relasz) == 0
f8560c
+	    && elf_load_dynamic_entry(lte, DT_RELA, &rela) == 0
f8560c
+	    && elf_load_dynamic_entry(lte, DT_RELASZ, &relasz) == 0
f8560c
 	    && elf_get_section_covering(lte, rela, &rela_sec, &rela_shdr) == 0
f8560c
 	    && rela_sec != NULL) {
f8560c
 
f8560c
@@ -509,7 +477,7 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
 
f8560c
 	if (lte->ehdr.e_machine == EM_PPC && lte->arch.secure_plt) {
f8560c
 		GElf_Addr ppcgot;
f8560c
-		if (load_dynamic_entry(lte, DT_PPC_GOT, &ppcgot) < 0) {
f8560c
+		if (elf_load_dynamic_entry(lte, DT_PPC_GOT, &ppcgot) < 0) {
f8560c
 			fprintf(stderr, "couldn't find DT_PPC_GOT\n");
f8560c
 			return -1;
f8560c
 		}
f8560c
@@ -522,7 +490,8 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
 
f8560c
 	} else if (lte->ehdr.e_machine == EM_PPC64) {
f8560c
 		GElf_Addr glink_vma;
f8560c
-		if (load_dynamic_entry(lte, DT_PPC64_GLINK, &glink_vma) < 0) {
f8560c
+		if (elf_load_dynamic_entry(lte, DT_PPC64_GLINK,
f8560c
+					   &glink_vma) < 0) {
f8560c
 			fprintf(stderr, "couldn't find DT_PPC64_GLINK\n");
f8560c
 			return -1;
f8560c
 		}
f8560c
@@ -532,8 +501,8 @@ arch_elf_init(struct ltelf *lte, struct library *lib)
f8560c
 
f8560c
 	} else {
f8560c
 		/* By exhaustion--PPC32 BSS.  */
f8560c
-		if (load_dynamic_entry(lte, DT_PLTGOT,
f8560c
-				       &lib->arch.pltgot_addr) < 0) {
f8560c
+		if (elf_load_dynamic_entry(lte, DT_PLTGOT,
f8560c
+					   &lib->arch.pltgot_addr) < 0) {
f8560c
 			fprintf(stderr, "couldn't find DT_PLTGOT\n");
f8560c
 			return -1;
f8560c
 		}