From 22fb102e6bc2734a077d722461fde3e9a733a150 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 1 Jul 2000 05:08:03 +0000 Subject: [PATCH] (elf_machine_rela) [r_type == R_ALPHA_REFQUAD]: Use memcpy to load and store value from relocation address to prevent unaligned trap. --- sysdeps/alpha/dl-machine.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index e20493b33f..a7f13e0192 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -500,7 +500,12 @@ elf_machine_rela (struct link_map *map, elf_machine_fixup_plt (map, NULL, reloc, reloc_addr, sym_value); else if (r_type == R_ALPHA_REFQUAD) { - sym_value += *reloc_addr; + void *reloc_addr_1 = reloc_addr; + Elf64_Addr reloc_addr_val; + + /* Load value without causing unaligned trap. */ + memcpy (&reloc_addr_val, reloc_addr_1, 8); + sym_value += reloc_addr_val; #ifndef RTLD_BOOTSTRAP if (map == &_dl_rtld_map) { @@ -516,7 +521,8 @@ elf_machine_rela (struct link_map *map, sym_value -= reloc->r_addend; } #endif - *reloc_addr = sym_value; + /* Store value without causing unaligned trap. */ + memcpy (reloc_addr_1, &sym_value, 8); } else _dl_reloc_bad_type (map, r_type, 0);