]> git.pld-linux.org Git - packages/binutils.git/blob - binutils-pr4497.patch
f0fe6c3bfb6172e3290817ce828e4ff580a63c1b
[packages/binutils.git] / binutils-pr4497.patch
1 ===================================================================
2 RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
3 retrieving revision 1.57
4 retrieving revision 1.58
5 diff -u -r1.57 -r1.58
6 --- src/bfd/elf-eh-frame.c      2007/05/10 15:08:02     1.57
7 +++ src/bfd/elf-eh-frame.c      2007/05/12 14:27:34     1.58
8 @@ -32,12 +32,16 @@
9    unsigned int length;
10    unsigned int hash;
11    unsigned char version;
12 +  unsigned char local_personality;
13    char augmentation[20];
14    bfd_vma code_align;
15    bfd_signed_vma data_align;
16    bfd_vma ra_column;
17    bfd_vma augmentation_size;
18 -  bfd_vma personality;
19 +  union {
20 +    struct elf_link_hash_entry *h;
21 +    bfd_vma val;
22 +  } personality;
23    asection *output_sec;
24    struct eh_cie_fde *cie_inf;
25    unsigned char per_encoding;
26 @@ -216,13 +220,15 @@
27    if (c1->hash == c2->hash
28        && c1->length == c2->length
29        && c1->version == c2->version
30 +      && c1->local_personality == c2->local_personality
31        && strcmp (c1->augmentation, c2->augmentation) == 0
32        && strcmp (c1->augmentation, "eh") != 0
33        && c1->code_align == c2->code_align
34        && c1->data_align == c2->data_align
35        && c1->ra_column == c2->ra_column
36        && c1->augmentation_size == c2->augmentation_size
37 -      && c1->personality == c2->personality
38 +      && memcmp (&c1->personality, &c2->personality,
39 +                sizeof (c1->personality)) == 0
40        && c1->output_sec == c2->output_sec
41        && c1->per_encoding == c2->per_encoding
42        && c1->lsda_encoding == c2->lsda_encoding
43 @@ -670,12 +676,10 @@
44                           REQUIRE (skip_bytes (&buf, end, length));
45                         }
46                       ENSURE_NO_RELOCS (buf);
47 -                     /* Ensure we have a reloc here, against
48 -                        a global symbol.  */
49 +                     /* Ensure we have a reloc here.  */
50                       if (GET_RELOC (buf) != NULL)
51                         {
52                           unsigned long r_symndx;
53 -                         asection *sym_sec = NULL;
54  
55  #ifdef BFD64
56                           if (ptr_size == 8)
57 @@ -683,7 +687,9 @@
58                           else
59  #endif
60                             r_symndx = ELF32_R_SYM (cookie->rel->r_info);
61 -                         if (r_symndx >= cookie->locsymcount)
62 +                         if (r_symndx >= cookie->locsymcount
63 +                             || ELF_ST_BIND (cookie->locsyms[r_symndx]
64 +                                             .st_info) != STB_LOCAL)
65                             {
66                               struct elf_link_hash_entry *h;
67  
68 @@ -695,33 +701,29 @@
69                                 h = (struct elf_link_hash_entry *)
70                                     h->root.u.i.link;
71  
72 -                             if (h->root.type == bfd_link_hash_defined
73 -                                 || h->root.type == bfd_link_hash_defweak)
74 -                               {
75 -                                 cie->personality = h->root.u.def.value;
76 -                                 sym_sec = h->root.u.def.section;
77 -                               }
78 +                             cie->personality.h = h;
79                             }
80                           else
81                             {
82 -                             Elf_Internal_Shdr *symtab_hdr;
83                               Elf_Internal_Sym *sym;
84 +                             asection *sym_sec;
85 +                             bfd_vma val;
86  
87 -                             symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
88 -                             sym = bfd_elf_get_elf_syms (abfd, symtab_hdr,
89 -                                                         1, r_symndx,
90 -                                                         NULL, NULL, NULL);
91 -                             if (sym != NULL)
92 +                             sym = &cookie->locsyms[r_symndx];
93 +                             sym_sec = (bfd_section_from_elf_index
94 +                                        (abfd, sym->st_shndx));
95 +                             if (sym_sec->kept_section != NULL)
96 +                               sym_sec = sym_sec->kept_section;
97 +                             if (sym_sec != NULL
98 +                                 && sym_sec->output_section != NULL)
99                                 {
100 -                                 cie->personality = sym->st_value;
101 -                                 sym_sec = (bfd_section_from_elf_index
102 -                                            (abfd, sym->st_shndx));
103 -                                 free (sym);
104 +                                 val = (sym->st_value
105 +                                        + sym_sec->output_offset
106 +                                        + sym_sec->output_section->vma);
107 +                                 cie->personality.val = val;
108 +                                 cie->local_personality = 1;
109                                 }
110                             }
111 -                         if (sym_sec != NULL)
112 -                           cie->personality += (sym_sec->output_section->vma
113 -                                                + sym_sec->output_offset);
114  
115                           /* Cope with MIPS-style composite relocations.  */
116                           do
117 @@ -729,7 +731,7 @@
118                           while (GET_RELOC (buf) != NULL);
119                         }
120                       REQUIRE (skip_bytes (&buf, end, per_width));
121 -                     REQUIRE (cie->personality);
122 +                     REQUIRE (cie->local_personality || cie->personality.h);
123                     }
124                     break;
125                   default:
This page took 0.025473 seconds and 2 git commands to generate.