Imported Upstream version 0.165
[platform/upstream/elfutils.git] / backends / x86_64_init.c
index b885558..cfd0158 100644 (file)
@@ -1,5 +1,6 @@
 /* Initialization of x86-64 specific backend library.
    Copyright (C) 2002-2009, 2013 Red Hat, Inc.
+   Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
 /* This defines the common reloc hooks based on x86_64_reloc.def.  */
 #include "common-reloc.c"
 
+extern __typeof (EBLHOOK (core_note)) x32_core_note attribute_hidden;
+
 const char *
-x86_64_init (elf, machine, eh, ehlen)
-     Elf *elf __attribute__ ((unused));
-     GElf_Half machine __attribute__ ((unused));
-     Ebl *eh;
-     size_t ehlen;
+x86_64_init (Elf *elf __attribute__ ((unused)),
+            GElf_Half machine __attribute__ ((unused)),
+            Ebl *eh,
+            size_t ehlen)
 {
   /* Check whether the Elf_BH object has a sufficent size.  */
   if (ehlen < sizeof (Ebl))
@@ -53,7 +55,10 @@ x86_64_init (elf, machine, eh, ehlen)
   eh->name = "AMD x86-64";
   x86_64_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
-  HOOK (eh, core_note);
+  if (eh->class == ELFCLASS32)
+    eh->core_note = x32_core_note;
+  else
+    HOOK (eh, core_note);
   HOOK (eh, return_value_location);
   HOOK (eh, register_info);
   HOOK (eh, syscall_abi);