This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Replace Elf64_XXX with ElfW(XXX) in dl-irel.h
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 19 Mar 2012 17:33:56 -0700
- Subject: PATCH: Replace Elf64_XXX with ElfW(XXX) in dl-irel.h
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch replaces Elf64_XXX with ElfW(XXX) in dl-irel.h. It also
uses ELF32_R_TYPE:
#define ELF32_R_TYPE(val) ((val) & 0xff)
instead ELF64_R_TYPE:
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
gets the currect relocation type for both ELF32 and ELF64 for x86-64 since
x86-64 relocation type is less than 256. OK to install?
Thanks.
H.J.
---
2012-03-19 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/dl-irel.h: Replace Elf64_XXX with ElfW(XXX).
Replace ELF64_R_TYPE with ELF32_R_TYPE.
diff --git a/sysdeps/x86_64/dl-irel.h b/sysdeps/x86_64/dl-irel.h
index bc7e54e..24bfa18 100644
--- a/sysdeps/x86_64/dl-irel.h
+++ b/sysdeps/x86_64/dl-irel.h
@@ -25,23 +25,23 @@
#define ELF_MACHINE_IRELA 1
-static inline Elf64_Addr
+static inline ElfW(Addr)
__attribute ((always_inline))
-elf_ifunc_invoke (Elf64_Addr addr)
+elf_ifunc_invoke (ElfW(Addr) addr)
{
- return ((Elf64_Addr (*) (void)) (addr)) ();
+ return ((ElfW(Addr) (*) (void)) (addr)) ();
}
static inline void
__attribute ((always_inline))
-elf_irela (const Elf64_Rela *reloc)
+elf_irela (const ElfW(Rela) *reloc)
{
- Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
- const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
+ ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
+ const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1))
{
- Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
+ ElfW(Addr) value = elf_ifunc_invoke(reloc->r_addend);
*reloc_addr = value;
}
else
--
1.7.6.5