Taking an undefined function's address in an executable
[binutils-gdb.git] / bfd / elf-eh-frame.c
index 4b6e8ea4162ed847b9995639dd5b1cebdf98cf8c..0f0a5635253e41aafe0b6930b7ec73dc6dc94c92 100644 (file)
@@ -1,6 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-   2012 Free Software Foundation, Inc.
+   Copyright (C) 2001-2014 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -41,7 +40,10 @@ struct cie
   bfd_vma augmentation_size;
   union {
     struct elf_link_hash_entry *h;
-    bfd_vma val;
+    struct {
+      unsigned int bfd_id;
+      unsigned int index;
+    } sym;
     unsigned int reloc_index;
   } personality;
   asection *output_sec;
@@ -1031,8 +1033,12 @@ find_merged_cie (bfd *abfd, struct bfd_link_info *info, asection *sec,
     {
       bfd_boolean per_binds_local;
 
-      /* Work out the address of personality routine, either as an absolute
-        value or as a symbol.  */
+      /* Work out the address of personality routine, or at least
+        enough info that we could calculate the address had we made a
+        final section layout.  The symbol on the reloc is enough,
+        either the hash for a global, or (bfd id, index) pair for a
+        local.  The assumption here is that no one uses addends on
+        the reloc.  */
       rel = cookie->rels + cie->personality.reloc_index;
       memset (&cie->personality, 0, sizeof (cie->personality));
 #ifdef BFD64
@@ -1072,9 +1078,8 @@ find_merged_cie (bfd *abfd, struct bfd_link_info *info, asection *sec,
            return cie_inf;
 
          cie->local_personality = 1;
-         cie->personality.val = (sym->st_value
-                                 + sym_sec->output_offset
-                                 + sym_sec->output_section->vma);
+         cie->personality.sym.bfd_id = abfd->id;
+         cie->personality.sym.index = r_symndx;
          per_binds_local = TRUE;
        }