1dd39a933d2fd0970a3fb649d39af83b7fa4a243
[openwrt.git] / obsolete-buildroot / sources / binutils-uclibc-001-debian.patch
1 diff -urN binutils-2.14.90.0.7.orig/bfd/ChangeLog binutils-2.14.90.0.7/bfd/ChangeLog
2 --- binutils-2.14.90.0.7.orig/bfd/ChangeLog     2003-10-29 10:37:47.000000000 -0700
3 +++ binutils-2.14.90.0.7/bfd/ChangeLog  2004-04-20 01:26:12.000000000 -0600
4 @@ -1,3 +1,34 @@
5 +2003-10-29  Daniel Jacobowitz  <drow@mvista.com>
6 +
7 +        * elf32-arm.h (elf32_arm_final_link_relocate): Move check for
8 +        SEC_ALLOC.
9 +
10 +2003-10-29  Philip Blundell  <philb@gnu.org>
11 +
12 +       * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New
13 +       code sequence.
14 +       (PLT_HEADER_SIZE): New.
15 +       (struct elf32_arm_pcrel_relocs_copied): Rename to ...
16 +       (struct elf32_arm_relocs_copied): ... this.  Count both
17 +       pcrel and non-pcrel relocs.  All uses updated.
18 +       (struct elf32_arm_link_hash_table): Add pointers to dynamic linker
19 +       sections and symbol/section mapping cache.
20 +       (create_got_section): New.
21 +       (elf32_arm_create_dynamic_sections): New.
22 +       (elf_backend_create_dynamic_sections): Use it.
23 +       (elf32_arm_final_link_relocate): Support garbage collection of relocs.
24 +       (elf32_arm_check_relocs): Likewise.
25 +       (elf32_arm_adjust_dynamic_symbol): Likewise.
26 +       (elf32_arm_copy_indirect_symbol): New.
27 +       (elf32_arm_link_hash_table_create): Initialise new fields. 
28 +       (elf32_arm_gc_sweep_hook): Implement.
29 +       (elf32_arm_discard_copies): Delete.
30 +       (elf32_arm_finish_dynamic_symbol): Use new PLT code.
31 +       (elf32_arm_finish_dynamic_sections): Likewise.
32 +       (elf_backend_can_refcount): Define.
33 +       (elf_backend_copy_indirect_symbol): Likewise.
34 +       (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE.
35 +
36  2003-10-29  Alan Modra  <amodra@bigpond.net.au>
37  
38         * elf64-ppc.c (elf_backend_grok_prstatus): Define.
39 diff -urN binutils-2.14.90.0.7.orig/bfd/elf-bfd.h binutils-2.14.90.0.7/bfd/elf-bfd.h
40 --- binutils-2.14.90.0.7.orig/bfd/elf-bfd.h     2003-10-29 10:37:47.000000000 -0700
41 +++ binutils-2.14.90.0.7/bfd/elf-bfd.h  2004-04-20 01:26:12.000000000 -0600
42 @@ -1303,7 +1303,7 @@
43  extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
44    (const Elf_Internal_Rela *);
45  extern bfd_vma _bfd_elf_rela_local_sym
46 -  (bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *);
47 +  (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
48  extern bfd_vma _bfd_elf_rel_local_sym
49    (bfd *, Elf_Internal_Sym *, asection **, bfd_vma);
50  extern bfd_vma _bfd_elf_section_offset
51 diff -urN binutils-2.14.90.0.7.orig/bfd/elf-hppa.h binutils-2.14.90.0.7/bfd/elf-hppa.h
52 --- binutils-2.14.90.0.7.orig/bfd/elf-hppa.h    2003-08-21 09:28:47.000000000 -0600
53 +++ binutils-2.14.90.0.7/bfd/elf-hppa.h 2004-04-20 01:26:12.000000000 -0600
54 @@ -1346,11 +1346,11 @@
55           /* This is a local symbol.  */
56           sym = local_syms + r_symndx;
57           sym_sec = local_sections[r_symndx];
58 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
59 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
60  
61           /* If this symbol has an entry in the PA64 dynamic hash
62              table, then get it.  */
63 -         dyn_name = get_dyn_name (input_section, h, rel,
64 +         dyn_name = get_dyn_name (input_bfd, h, rel,
65                                    &dynh_buf, &dynh_buflen);
66           dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
67                                               dyn_name, FALSE, FALSE);
68 @@ -1373,7 +1373,7 @@
69  
70               /* If this symbol has an entry in the PA64 dynamic hash
71                  table, then get it.  */
72 -             dyn_name = get_dyn_name (input_section, h, rel,
73 +             dyn_name = get_dyn_name (input_bfd, h, rel,
74                                        &dynh_buf, &dynh_buflen);
75               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
76                                                   dyn_name, FALSE, FALSE);
77 @@ -1410,7 +1410,7 @@
78  
79               /* If this symbol has an entry in the PA64 dynamic hash
80                  table, then get it.  */
81 -             dyn_name = get_dyn_name (input_section, h, rel,
82 +             dyn_name = get_dyn_name (input_bfd, h, rel,
83                                        &dynh_buf, &dynh_buflen);
84               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
85                                                   dyn_name, FALSE, FALSE);
86 @@ -1426,7 +1426,7 @@
87             }
88           else if (h->root.type == bfd_link_hash_undefweak)
89              {
90 -             dyn_name = get_dyn_name (input_section, h, rel,
91 +             dyn_name = get_dyn_name (input_bfd, h, rel,
92                                        &dynh_buf, &dynh_buflen);
93               dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
94                                                   dyn_name, FALSE, FALSE);
95 diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10200.c binutils-2.14.90.0.7/bfd/elf-m10200.c
96 --- binutils-2.14.90.0.7.orig/bfd/elf-m10200.c  2003-07-23 09:08:08.000000000 -0600
97 +++ binutils-2.14.90.0.7/bfd/elf-m10200.c       2004-04-20 01:26:12.000000000 -0600
98 @@ -373,7 +373,7 @@
99         {
100           sym = local_syms + r_symndx;
101           sec = local_sections[r_symndx];
102 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
103 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
104         }
105        else
106         {
107 diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10300.c binutils-2.14.90.0.7/bfd/elf-m10300.c
108 --- binutils-2.14.90.0.7.orig/bfd/elf-m10300.c  2003-08-21 09:28:47.000000000 -0600
109 +++ binutils-2.14.90.0.7/bfd/elf-m10300.c       2004-04-20 01:26:12.000000000 -0600
110 @@ -1574,7 +1574,7 @@
111         {
112           sym = local_syms + r_symndx;
113           sec = local_sections[r_symndx];
114 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
115 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
116         }
117        else
118         {
119 diff -urN binutils-2.14.90.0.7.orig/bfd/elf.c binutils-2.14.90.0.7/bfd/elf.c
120 --- binutils-2.14.90.0.7.orig/bfd/elf.c 2003-10-29 10:37:47.000000000 -0700
121 +++ binutils-2.14.90.0.7/bfd/elf.c      2004-04-20 01:26:12.000000000 -0600
122 @@ -7367,9 +7367,10 @@
123  bfd_vma
124  _bfd_elf_rela_local_sym (bfd *abfd,
125                          Elf_Internal_Sym *sym,
126 -                        asection *sec,
127 +                        asection **psec,
128                          Elf_Internal_Rela *rel)
129  {
130 +  asection *sec = *psec;
131    bfd_vma relocation;
132  
133    relocation = (sec->output_section->vma
134 @@ -7379,16 +7380,14 @@
135        && ELF_ST_TYPE (sym->st_info) == STT_SECTION
136        && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
137      {
138 -      asection *msec;
139 -
140 -      msec = sec;
141        rel->r_addend =
142 -       _bfd_merged_section_offset (abfd, &msec,
143 +       _bfd_merged_section_offset (abfd, psec,
144                                     elf_section_data (sec)->sec_info,
145                                     sym->st_value + rel->r_addend,
146 -                                   0)
147 -       - relocation;
148 -      rel->r_addend += msec->output_section->vma + msec->output_offset;
149 +                                   0);
150 +      sec = *psec;
151 +      rel->r_addend -= relocation;
152 +      rel->r_addend += sec->output_section->vma + sec->output_offset;
153      }
154    return relocation;
155  }
156 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-arm.h binutils-2.14.90.0.7/bfd/elf32-arm.h
157 --- binutils-2.14.90.0.7.orig/bfd/elf32-arm.h   2003-10-29 10:37:47.000000000 -0700
158 +++ binutils-2.14.90.0.7/bfd/elf32-arm.h        2004-04-20 01:26:12.000000000 -0600
159 @@ -84,6 +84,12 @@
160  static void arm_add_to_rel
161    PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
162  #endif
163 +static bfd_boolean allocate_dynrelocs 
164 +  PARAMS ((struct elf_link_hash_entry *h, PTR inf));
165 +static bfd_boolean create_got_section 
166 +  PARAMS ((bfd * dynobj, struct bfd_link_info * info));
167 +static bfd_boolean elf32_arm_create_dynamic_sections 
168 +  PARAMS ((bfd * dynobj, struct bfd_link_info * info));
169  static enum elf_reloc_type_class elf32_arm_reloc_type_class
170    PARAMS ((const Elf_Internal_Rela *));
171  static bfd_boolean elf32_arm_object_p
172 @@ -119,6 +125,12 @@
173     section.  */
174  #define ELF_DYNAMIC_INTERPRETER     "/usr/lib/ld.so.1"
175  
176 +#ifdef FOUR_WORD_PLT
177 +
178 +/* The size in bytes of the special first entry in the procedure
179 +   linkage table.  */
180 +#define PLT_HEADER_SIZE 16
181 +
182  /* The size in bytes of an entry in the procedure linkage table.  */
183  #define PLT_ENTRY_SIZE 16
184  
185 @@ -126,23 +138,56 @@
186     this.  It is set up so that any shared library function that is
187     called before the relocation has been set up calls the dynamic
188     linker first.  */
189 -static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =
190 +static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] =
191    {
192 -    0xe52de004,        /* str   lr, [sp, #-4]!     */
193 -    0xe59fe010,        /* ldr   lr, [pc, #16]      */
194 -    0xe08fe00e,        /* add   lr, pc, lr         */
195 -    0xe5bef008 /* ldr   pc, [lr, #8]!      */
196 +    0xe52de004,                /* str   lr, [sp, #-4]! */
197 +    0xe59fe010,                /* ldr   lr, [pc, #16]  */
198 +    0xe08fe00e,                /* add   lr, pc, lr     */
199 +    0xe5bef008,                /* ldr   pc, [lr, #8]!  */
200    };
201  
202  /* Subsequent entries in a procedure linkage table look like
203     this.  */
204  static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
205 - {
206 -   0xe59fc004, /* ldr   ip, [pc, #4]       */
207 -   0xe08fc00c, /* add   ip, pc, ip         */
208 -   0xe59cf000, /* ldr   pc, [ip]           */
209 -   0x00000000  /* offset to symbol in got  */
210 - };
211 +  {
212 +    0xe28fc600,                /* add   ip, pc, #NN    */
213 +    0xe28cca00,                /* add   ip, ip, #NN    */
214 +    0xe5bcf000,                /* ldr   pc, [ip, #NN]! */
215 +    0x00000000,                /* unused               */
216 +  };
217 +
218 +#else
219 +
220 +/* The size in bytes of the special first entry in the procedure
221 +   linkage table.  */
222 +#define PLT_HEADER_SIZE 20
223 +
224 +/* The size in bytes of an entry in the procedure linkage table.  */
225 +#define PLT_ENTRY_SIZE 12
226 +
227 +/* The first entry in a procedure linkage table looks like
228 +   this.  It is set up so that any shared library function that is
229 +   called before the relocation has been set up calls the dynamic
230 +   linker first.  */
231 +static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] =
232 +  {
233 +    0xe52de004,                /* str   lr, [sp, #-4]! */
234 +    0xe59fe004,                /* ldr   lr, [pc, #4]   */
235 +    0xe08fe00e,                /* add   lr, pc, lr     */
236 +    0xe5bef008,                /* ldr   pc, [lr, #8]!  */
237 +    0x00000000,                /* &GOT[0] - .          */
238 +  };
239 +
240 +/* Subsequent entries in a procedure linkage table look like
241 +   this.  */
242 +static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
243 +  {
244 +    0xe28fc600,                /* add   ip, pc, #0xNN00000 */
245 +    0xe28cca00,                /* add   ip, ip, #0xNN000   */
246 +    0xe5bcf000,                /* ldr   pc, [ip, #0xNNN]!  */
247 +  };
248 +
249 +#endif
250  
251  /* The ARM linker needs to keep track of the number of relocs that it
252     decides to copy in check_relocs for each symbol.  This is so that
253 @@ -152,14 +197,16 @@
254  
255  /* This structure keeps track of the number of PC relative relocs we
256     have copied for a given symbol.  */
257 -struct elf32_arm_pcrel_relocs_copied
258 +struct elf32_arm_relocs_copied
259    {
260      /* Next section.  */
261 -    struct elf32_arm_pcrel_relocs_copied * next;
262 +    struct elf32_arm_relocs_copied * next;
263      /* A section in dynobj.  */
264      asection * section;
265      /* Number of relocs copied in this section.  */
266      bfd_size_type count;
267 +    /* Number of relocs copied in this section.  */
268 +    bfd_size_type pc_count;
269    };
270  
271  /* Arm ELF linker hash entry.  */
272 @@ -168,13 +215,9 @@
273      struct elf_link_hash_entry root;
274  
275      /* Number of PC relative relocs copied for this symbol.  */
276 -    struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;
277 +    struct elf32_arm_relocs_copied * relocs_copied;
278    };
279  
280 -/* Declare this now that the above structures are defined.  */
281 -static bfd_boolean elf32_arm_discard_copies
282 -  PARAMS ((struct elf32_arm_link_hash_entry *, PTR));
283 -
284  /* Traverse an arm ELF linker hash table.  */
285  #define elf32_arm_link_hash_traverse(table, func, info)                        \
286    (elf_link_hash_traverse                                              \
287 @@ -204,6 +247,18 @@
288      /* A boolean indicating whether knowledge of the ARM's pipeline
289         length should be applied by the linker.  */
290      int no_pipeline_knowledge;
291 +
292 +    /* Short-cuts to get to dynamic linker sections.  */
293 +    asection *sgot;
294 +    asection *sgotplt;
295 +    asection *srelgot;
296 +    asection *splt;
297 +    asection *srelplt;
298 +    asection *sdynbss;
299 +    asection *srelbss;
300 +
301 +    /* Small local sym to section mapping cache.  */
302 +    struct sym_sec_cache sym_sec;
303    };
304  
305  /* Create an entry in an ARM ELF linker hash table.  */
306 @@ -231,11 +286,121 @@
307          _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
308                                      table, string));
309    if (ret != (struct elf32_arm_link_hash_entry *) NULL)
310 -    ret->pcrel_relocs_copied = NULL;
311 +    ret->relocs_copied = NULL;
312  
313    return (struct bfd_hash_entry *) ret;
314  }
315  
316 +/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
317 +   shortcuts to them in our hash table.  */
318 +
319 +static bfd_boolean
320 +create_got_section (dynobj, info)
321 +     bfd *dynobj;
322 +     struct bfd_link_info *info;
323 +{
324 +  struct elf32_arm_link_hash_table *htab;
325 +
326 +  if (! _bfd_elf_create_got_section (dynobj, info))
327 +    return FALSE;
328 +
329 +  htab = elf32_arm_hash_table (info);
330 +  htab->sgot = bfd_get_section_by_name (dynobj, ".got");
331 +  htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
332 +  if (!htab->sgot || !htab->sgotplt)
333 +    abort ();
334 +
335 +  htab->srelgot = bfd_make_section (dynobj, ".rel.got");
336 +  if (htab->srelgot == NULL
337 +      || ! bfd_set_section_flags (dynobj, htab->srelgot,
338 +                                 (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
339 +                                  | SEC_IN_MEMORY | SEC_LINKER_CREATED
340 +                                  | SEC_READONLY))
341 +      || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
342 +    return FALSE;
343 +  return TRUE;
344 +}
345 +
346 +/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
347 +   .rel.bss sections in DYNOBJ, and set up shortcuts to them in our
348 +   hash table.  */
349 +
350 +static bfd_boolean
351 +elf32_arm_create_dynamic_sections (dynobj, info)
352 +     bfd *dynobj;
353 +     struct bfd_link_info *info;
354 +{
355 +  struct elf32_arm_link_hash_table *htab;
356 +
357 +  htab = elf32_arm_hash_table (info);
358 +  if (!htab->sgot && !create_got_section (dynobj, info))
359 +    return FALSE;
360 +
361 +  if (!_bfd_elf_create_dynamic_sections (dynobj, info))
362 +    return FALSE;
363 +
364 +  htab->splt = bfd_get_section_by_name (dynobj, ".plt");
365 +  htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
366 +  htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
367 +  if (!info->shared)
368 +    htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
369 +
370 +  if (!htab->splt || !htab->srelplt || !htab->sdynbss
371 +      || (!info->shared && !htab->srelbss))
372 +    abort ();
373 +
374 +  return TRUE;
375 +}
376 +
377 +/* Copy the extra info we tack onto an elf_link_hash_entry.  */
378 +
379 +static void
380 +elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed,
381 +                               struct elf_link_hash_entry *dir,
382 +                               struct elf_link_hash_entry *ind)
383 +{
384 +  struct elf32_arm_link_hash_entry *edir, *eind;
385 +
386 +  edir = (struct elf32_arm_link_hash_entry *) dir;
387 +  eind = (struct elf32_arm_link_hash_entry *) ind;
388 +
389 +  if (eind->relocs_copied != NULL)
390 +    {
391 +      if (edir->relocs_copied != NULL)
392 +       {
393 +         struct elf32_arm_relocs_copied **pp;
394 +         struct elf32_arm_relocs_copied *p;
395 +
396 +         if (ind->root.type == bfd_link_hash_indirect)
397 +           abort ();
398 +
399 +         /* Add reloc counts against the weak sym to the strong sym
400 +            list.  Merge any entries against the same section.  */
401 +         for (pp = &eind->relocs_copied; (p = *pp) != NULL; )
402 +           {
403 +             struct elf32_arm_relocs_copied *q;
404 +
405 +             for (q = edir->relocs_copied; q != NULL; q = q->next)
406 +               if (q->section == p->section)
407 +                 {
408 +                   q->pc_count += p->pc_count;
409 +                   q->count += p->count;
410 +                   *pp = p->next;
411 +                   break;
412 +                 }
413 +             if (q == NULL)
414 +               pp = &p->next;
415 +           }
416 +         *pp = edir->relocs_copied;
417 +       }
418 +
419 +      edir->relocs_copied = eind->relocs_copied;
420 +      eind->relocs_copied = NULL;
421 +    }
422 +
423 +  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
424 +}
425 +
426  /* Create an ARM elf linker hash table.  */
427  
428  static struct bfd_link_hash_table *
429 @@ -256,10 +421,18 @@
430        return NULL;
431      }
432  
433 +  ret->sgot = NULL;
434 +  ret->sgotplt = NULL;
435 +  ret->srelgot = NULL;
436 +  ret->splt = NULL;
437 +  ret->srelplt = NULL;
438 +  ret->sdynbss = NULL;
439 +  ret->srelbss = NULL;
440    ret->thumb_glue_size = 0;
441    ret->arm_glue_size = 0;
442    ret->bfd_of_glue_owner = NULL;
443    ret->no_pipeline_knowledge = 0;
444 +  ret->sym_sec.abfd = NULL;
445  
446    return &ret->root.root;
447  }
448 @@ -1134,16 +1307,21 @@
449  #ifndef OLD_ARM_ABI
450      case R_ARM_XPC25:
451  #endif
452 +      /* r_symndx will be zero only for relocs against symbols
453 +        from removed linkonce sections, or sections discarded by
454 +        a linker script.  */
455 +      if (r_symndx == 0)
456 +       return bfd_reloc_ok;
457 +
458        /* When generating a shared object, these relocations are copied
459          into the output file to be resolved at run time.  */
460 -      if (info->shared
461 -         && r_symndx != 0
462 -         && (r_type != R_ARM_PC24
463 -             || (h != NULL
464 -                 && h->dynindx != -1
465 -                 && (! info->symbolic
466 -                     || (h->elf_link_hash_flags
467 -                         & ELF_LINK_HASH_DEF_REGULAR) == 0))))
468 +      if ((info->shared
469 +          && (input_section->flags & SEC_ALLOC)
470 +          && (h == NULL
471 +              || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
472 +              || h->root.type != bfd_link_hash_undefweak)
473 +          && (r_type != R_ARM_PC24
474 +              || !SYMBOL_CALLS_LOCAL (info, h))))
475         {
476           Elf_Internal_Rela outrel;
477           bfd_byte *loc;
478 @@ -1184,30 +1362,19 @@
479  
480           if (skip)
481             memset (&outrel, 0, sizeof outrel);
482 -         else if (r_type == R_ARM_PC24)
483 -           {
484 -             BFD_ASSERT (h != NULL && h->dynindx != -1);
485 -             if ((input_section->flags & SEC_ALLOC) == 0)
486 -               relocate = TRUE;
487 -             outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24);
488 -           }
489 +         else if (h != NULL
490 +                  && h->dynindx != -1
491 +                  && (r_type == R_ARM_PC24
492 +                      || !info->shared
493 +                      || !info->symbolic
494 +                      || (h->elf_link_hash_flags
495 +                          & ELF_LINK_HASH_DEF_REGULAR) == 0))
496 +           outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
497           else
498             {
499 -             if (h == NULL
500 -                 || ((info->symbolic || h->dynindx == -1)
501 -                     && (h->elf_link_hash_flags
502 -                         & ELF_LINK_HASH_DEF_REGULAR) != 0))
503 -               {
504 -                 relocate = TRUE;
505 -                 outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
506 -               }
507 -             else
508 -               {
509 -                 BFD_ASSERT (h->dynindx != -1);
510 -                 if ((input_section->flags & SEC_ALLOC) == 0)
511 -                   relocate = TRUE;
512 -                 outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32);
513 -               }
514 +             /* This symbol is local, or marked to become local.  */
515 +             relocate = TRUE;
516 +             outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
517             }
518  
519           loc = sreloc->contents;
520 @@ -1617,16 +1784,17 @@
521        if (h != NULL)
522         {
523           bfd_vma off;
524 -         bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created;
525 +         bfd_boolean dyn;
526  
527           off = h->got.offset;
528           BFD_ASSERT (off != (bfd_vma) -1);
529 +         dyn = globals->root.dynamic_sections_created;
530  
531 -         if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
532 +         if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
533               || (info->shared
534 -                 && (info->symbolic || h->dynindx == -1
535 -                     || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
536 -                 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
537 +                 && SYMBOL_REFERENCES_LOCAL (info, h))
538 +             || (ELF_ST_VISIBILITY (h->other)
539 +                 && h->root.type == bfd_link_hash_undefweak))
540             {
541               /* This is actually a static link, or it is a -Bsymbolic link
542                  and the symbol is defined locally.  We must initialize this
543 @@ -1712,7 +1880,8 @@
544                                  contents, rel->r_offset, value,
545                                  (bfd_vma) 0);
546  
547 -      if (h->plt.offset == (bfd_vma) -1)
548 +      if (h->plt.offset == (bfd_vma) -1
549 +         || globals->splt == NULL)
550          /* We didn't make a PLT entry for this symbol.  This
551             happens when statically linking PIC code, or when
552             using -Bsymbolic.  */
553 @@ -1958,7 +2127,7 @@
554               bfd_put_32 (input_bfd, value, contents + rel->r_offset);
555             }
556  #else
557 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
558 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
559  #endif
560         }
561        else
562 @@ -1983,9 +2152,10 @@
563                 case R_ARM_THM_PC22:
564                   if (info->shared
565                       && (
566 -                 (!info->symbolic && h->dynindx != -1)
567 +                         (!info->symbolic && h->dynindx != -1)
568                           || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
569                           )
570 +                     && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
571                       && ((input_section->flags & SEC_ALLOC) != 0
572                           /* DWARF will emit R_ARM_ABS32 relocations in its
573                              sections against symbols defined externally
574 @@ -2603,7 +2773,82 @@
575       asection *sec ATTRIBUTE_UNUSED;
576       const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
577  {
578 -  /* We don't support garbage collection of GOT and PLT relocs yet.  */
579 +  Elf_Internal_Shdr *symtab_hdr;
580 +  struct elf_link_hash_entry **sym_hashes;
581 +  bfd_signed_vma *local_got_refcounts;
582 +  const Elf_Internal_Rela *rel, *relend;
583 +  unsigned long r_symndx;
584 +  struct elf_link_hash_entry *h;
585 +
586 +  elf_section_data (sec)->local_dynrel = NULL;
587 +
588 +  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
589 +  sym_hashes = elf_sym_hashes (abfd);
590 +  local_got_refcounts = elf_local_got_refcounts (abfd);
591 +
592 +  relend = relocs + sec->reloc_count;
593 +  for (rel = relocs; rel < relend; rel++)
594 +    switch (ELF32_R_TYPE (rel->r_info))
595 +      {
596 +      case R_ARM_GOT32:
597 +       r_symndx = ELF32_R_SYM (rel->r_info);
598 +       if (r_symndx >= symtab_hdr->sh_info)
599 +         {
600 +           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
601 +           if (h->got.refcount > 0)
602 +             h->got.refcount -= 1;
603 +         }
604 +       else if (local_got_refcounts != NULL)
605 +         {
606 +           if (local_got_refcounts[r_symndx] > 0)
607 +             local_got_refcounts[r_symndx] -= 1;
608 +         }
609 +       break;
610 +
611 +      case R_ARM_ABS32:
612 +      case R_ARM_REL32:
613 +      case R_ARM_PC24:
614 +       r_symndx = ELF32_R_SYM (rel->r_info);
615 +       if (r_symndx >= symtab_hdr->sh_info)
616 +         {
617 +           struct elf32_arm_link_hash_entry *eh;
618 +           struct elf32_arm_relocs_copied **pp;
619 +           struct elf32_arm_relocs_copied *p;
620 +
621 +           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
622 +
623 +           if (!info->shared && h->plt.refcount > 0)
624 +             h->plt.refcount -= 1;
625 +
626 +           eh = (struct elf32_arm_link_hash_entry *) h;
627 +
628 +           for (pp = &eh->relocs_copied; (p = *pp) != NULL; pp = &p->next)
629 +             if (p->section == sec)
630 +               {
631 +                 if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24)
632 +                   p->pc_count -= 1;
633 +                 p->count -= 1;
634 +                 if (p->count == 0)
635 +                   *pp = p->next;
636 +                 break;
637 +               }
638 +         }
639 +       break;
640 +
641 +      case R_ARM_PLT32:
642 +       r_symndx = ELF32_R_SYM (rel->r_info);
643 +       if (r_symndx >= symtab_hdr->sh_info)
644 +         {
645 +           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
646 +           if (h->plt.refcount > 0)
647 +             h->plt.refcount -= 1;
648 +         }
649 +       break;
650 +
651 +      default:
652 +       break;
653 +      }
654 +
655    return TRUE;
656  }
657  
658 @@ -2622,13 +2867,15 @@
659    const Elf_Internal_Rela *rel;
660    const Elf_Internal_Rela *rel_end;
661    bfd *dynobj;
662 -  asection *sgot, *srelgot, *sreloc;
663 +  asection *sreloc;
664    bfd_vma *local_got_offsets;
665 +  struct elf32_arm_link_hash_table *htab;
666  
667    if (info->relocatable)
668      return TRUE;
669  
670 -  sgot = srelgot = sreloc = NULL;
671 +  htab = elf32_arm_hash_table (info);
672 +  sreloc = NULL;
673  
674    dynobj = elf_hash_table (info)->dynobj;
675    local_got_offsets = elf_local_got_offsets (abfd);
676 @@ -2653,126 +2900,82 @@
677        else
678          h = sym_hashes[r_symndx - symtab_hdr->sh_info];
679  
680 -      /* Some relocs require a global offset table.  */
681 -      if (dynobj == NULL)
682 -       {
683 -         switch (ELF32_R_TYPE (rel->r_info))
684 -           {
685 -           case R_ARM_GOT32:
686 -           case R_ARM_GOTOFF:
687 -           case R_ARM_GOTPC:
688 -             elf_hash_table (info)->dynobj = dynobj = abfd;
689 -             if (! _bfd_elf_create_got_section (dynobj, info))
690 -               return FALSE;
691 -             break;
692 -
693 -           default:
694 -             break;
695 -           }
696 -       }
697 -
698        switch (ELF32_R_TYPE (rel->r_info))
699          {
700 -         case R_ARM_GOT32:
701 -           /* This symbol requires a global offset table entry.  */
702 -           if (sgot == NULL)
703 -             {
704 -               sgot = bfd_get_section_by_name (dynobj, ".got");
705 -               BFD_ASSERT (sgot != NULL);
706 -             }
707 +         case R_ARM_PLT32:
708 +           /* This symbol requires a procedure linkage table entry.  We
709 +               actually build the entry in adjust_dynamic_symbol,
710 +               because this might be a case of linking PIC code which is
711 +               never referenced by a dynamic object, in which case we
712 +               don't need to generate a procedure linkage table entry
713 +               after all.  */
714  
715 -           /* Get the got relocation section if necessary.  */
716 -           if (srelgot == NULL
717 -               && (h != NULL || info->shared))
718 -             {
719 -               srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
720 +           /* If this is a local symbol, we resolve it directly without
721 +               creating a procedure linkage table entry.  */
722 +           if (h == NULL)
723 +             continue;
724  
725 -               /* If no got relocation section, make one and initialize.  */
726 -               if (srelgot == NULL)
727 -                 {
728 -                   srelgot = bfd_make_section (dynobj, ".rel.got");
729 -                   if (srelgot == NULL
730 -                       || ! bfd_set_section_flags (dynobj, srelgot,
731 -                                                   (SEC_ALLOC
732 -                                                    | SEC_LOAD
733 -                                                    | SEC_HAS_CONTENTS
734 -                                                    | SEC_IN_MEMORY
735 -                                                    | SEC_LINKER_CREATED
736 -                                                    | SEC_READONLY))
737 -                       || ! bfd_set_section_alignment (dynobj, srelgot, 2))
738 -                     return FALSE;
739 -                 }
740 -             }
741 +           h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
742 +           h->plt.refcount++;
743 +           break;
744  
745 +         case R_ARM_GOT32:
746 +           /* This symbol requires a global offset table entry.  */
747             if (h != NULL)
748               {
749 -               if (h->got.offset != (bfd_vma) -1)
750 -                 /* We have already allocated space in the .got.  */
751 -                 break;
752 -
753 -               h->got.offset = sgot->_raw_size;
754 -
755 -               /* Make sure this symbol is output as a dynamic symbol.  */
756 -               if (h->dynindx == -1)
757 -                 if (! bfd_elf32_link_record_dynamic_symbol (info, h))
758 -                   return FALSE;
759 -
760 -               srelgot->_raw_size += sizeof (Elf32_External_Rel);
761 +               h->got.refcount++;
762               }
763             else
764               {
765 -               /* This is a global offset table entry for a local
766 -                   symbol.  */
767 -               if (local_got_offsets == NULL)
768 +               bfd_signed_vma *local_got_refcounts;
769 +
770 +               /* This is a global offset table entry for a local symbol.  */
771 +               local_got_refcounts = elf_local_got_refcounts (abfd);
772 +               if (local_got_refcounts == NULL)
773                   {
774                     bfd_size_type size;
775 -                   unsigned int i;
776  
777                     size = symtab_hdr->sh_info;
778 -                   size *= sizeof (bfd_vma);
779 -                   local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
780 -                   if (local_got_offsets == NULL)
781 +                   size *= (sizeof (bfd_signed_vma) + sizeof(char));
782 +                   local_got_refcounts = ((bfd_signed_vma *)
783 +                                          bfd_zalloc (abfd, size));
784 +                   if (local_got_refcounts == NULL)
785                       return FALSE;
786 -                   elf_local_got_offsets (abfd) = local_got_offsets;
787 -                   for (i = 0; i < symtab_hdr->sh_info; i++)
788 -                     local_got_offsets[i] = (bfd_vma) -1;
789 +                   elf_local_got_refcounts (abfd) = local_got_refcounts;
790                   }
791 -
792 -               if (local_got_offsets[r_symndx] != (bfd_vma) -1)
793 -                 /* We have already allocated space in the .got.  */
794 -                 break;
795 -
796 -               local_got_offsets[r_symndx] = sgot->_raw_size;
797 -
798 -               if (info->shared)
799 -                 /* If we are generating a shared object, we need to
800 -                    output a R_ARM_RELATIVE reloc so that the dynamic
801 -                    linker can adjust this GOT entry.  */
802 -                 srelgot->_raw_size += sizeof (Elf32_External_Rel);
803 +               local_got_refcounts[r_symndx] += 1;
804               }
805 -
806 -           sgot->_raw_size += 4;
807             break;
808  
809 -         case R_ARM_PLT32:
810 -           /* This symbol requires a procedure linkage table entry.  We
811 -               actually build the entry in adjust_dynamic_symbol,
812 -               because this might be a case of linking PIC code which is
813 -               never referenced by a dynamic object, in which case we
814 -               don't need to generate a procedure linkage table entry
815 -               after all.  */
816 -
817 -           /* If this is a local symbol, we resolve it directly without
818 -               creating a procedure linkage table entry.  */
819 -           if (h == NULL)
820 -             continue;
821 -
822 -           h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
823 +         case R_ARM_GOTOFF:
824 +         case R_ARM_GOTPC:
825 +           if (htab->sgot == NULL)
826 +             {
827 +               if (htab->root.dynobj == NULL)
828 +                 htab->root.dynobj = abfd;
829 +               if (!create_got_section (htab->root.dynobj, info))
830 +                 return FALSE;
831 +             }
832             break;
833  
834           case R_ARM_ABS32:
835           case R_ARM_REL32:
836           case R_ARM_PC24:
837 +           if (h != NULL && !info->shared)
838 +             {
839 +               /* If this reloc is in a read-only section, we might
840 +                  need a copy reloc.  We can't check reliably at this
841 +                  stage whether the section is read-only, as input
842 +                  sections have not yet been mapped to output sections.
843 +                  Tentatively set the flag for now, and correct in
844 +                  adjust_dynamic_symbol.  */
845 +               h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
846 +               
847 +               /* We may need a .plt entry if the function this reloc
848 +                  refers to is in a shared lib.  */
849 +               h->plt.refcount += 1;
850 +             }
851 +
852             /* If we are creating a shared library, and this is a reloc
853                 against a global symbol, or a non PC relative reloc
854                 against a local symbol, then we need to copy the reloc
855 @@ -2784,14 +2987,17 @@
856                 possible that DEF_REGULAR is not set now but will be set
857                 later (it is never cleared).  We account for that
858                 possibility below by storing information in the
859 -               pcrel_relocs_copied field of the hash table entry.  */
860 +               relocs_copied field of the hash table entry.  */
861             if (info->shared
862 -             && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24
863 -               || (h != NULL
864 -                 && (! info->symbolic
865 -                   || (h->elf_link_hash_flags
866 -                     & ELF_LINK_HASH_DEF_REGULAR) == 0))))
867 +               && (sec->flags & SEC_ALLOC) != 0
868 +               && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24
869 +                   || (h != NULL
870 +                       && (! info->symbolic
871 +                           || (h->elf_link_hash_flags
872 +                               & ELF_LINK_HASH_DEF_REGULAR) == 0))))
873               {
874 +               struct elf32_arm_relocs_copied *p, **head;
875 +
876                 /* When creating a shared object, we must copy these
877                     reloc types into the output file.  We create a reloc
878                     section in dynobj and make room for this reloc.  */
879 @@ -2825,45 +3031,49 @@
880                             || ! bfd_set_section_alignment (dynobj, sreloc, 2))
881                           return FALSE;
882                       }
883 -                 if (sec->flags & SEC_READONLY)
884 -                   info->flags |= DF_TEXTREL;
885 +
886 +                   elf_section_data (sec)->sreloc = sreloc;
887                   }
888  
889 -               sreloc->_raw_size += sizeof (Elf32_External_Rel);
890 -               /* If we are linking with -Bsymbolic, and this is a
891 -                   global symbol, we count the number of PC relative
892 -                   relocations we have entered for this symbol, so that
893 -                   we can discard them again if the symbol is later
894 -                   defined by a regular object.  Note that this function
895 -                   is only called if we are using an elf_i386 linker
896 -                   hash table, which means that h is really a pointer to
897 -                   an elf_i386_link_hash_entry.  */
898 -               if (h != NULL && info->symbolic
899 -                   && ELF32_R_TYPE (rel->r_info) == R_ARM_PC24)
900 +               /* If this is a global symbol, we count the number of
901 +                  relocations we need for this symbol.  */
902 +               if (h != NULL)
903                   {
904 -                   struct elf32_arm_link_hash_entry * eh;
905 -                   struct elf32_arm_pcrel_relocs_copied * p;
906 -
907 -                   eh = (struct elf32_arm_link_hash_entry *) h;
908 -
909 -                   for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
910 -                     if (p->section == sreloc)
911 -                       break;
912 -
913 +                   head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied;
914 +                 }
915 +               else
916 +                 {
917 +                   /* Track dynamic relocs needed for local syms too.
918 +                      We really need local syms available to do this
919 +                      easily.  Oh well.  */
920 +                   
921 +                   asection *s;
922 +                   s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
923 +                                                  sec, r_symndx);
924 +                   if (s == NULL)
925 +                     return FALSE;
926 +                   
927 +                   head = ((struct elf32_arm_relocs_copied **)
928 +                           &elf_section_data (s)->local_dynrel);
929 +                 }
930 +               
931 +               p = *head;
932 +               if (p == NULL || p->section != sec)
933 +                 {
934 +                   bfd_size_type amt = sizeof *p;
935 +                   p = bfd_alloc (htab->root.dynobj, amt);
936                     if (p == NULL)
937 -                     {
938 -                       p = ((struct elf32_arm_pcrel_relocs_copied *)
939 -                            bfd_alloc (dynobj, (bfd_size_type) sizeof * p));
940 -                       if (p == NULL)
941 -                         return FALSE;
942 -                       p->next = eh->pcrel_relocs_copied;
943 -                       eh->pcrel_relocs_copied = p;
944 -                       p->section = sreloc;
945 -                       p->count = 0;
946 -                     }
947 -
948 -                   ++p->count;
949 +                     return FALSE;
950 +                   p->next = *head;
951 +                   *head = p;
952 +                   p->section = sec;
953 +                   p->count = 0;
954 +                   p->pc_count = 0;
955                   }
956 +               
957 +               p->count += 1;
958 +               if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24)
959 +                 p->pc_count += 1;
960               }
961             break;
962  
963 @@ -3003,71 +3213,29 @@
964    if (h->type == STT_FUNC
965        || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
966      {
967 -      /* If we link a program (not a DSO), we'll get rid of unnecessary
968 -        PLT entries; we point to the actual symbols -- even for pic
969 -        relocs, because a program built with -fpic should have the same
970 -        result as one built without -fpic, specifically considering weak
971 -        symbols.
972 -        FIXME: m68k and i386 differ here, for unclear reasons.  */
973 -      if (! info->shared
974 -         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0)
975 +      if (h->plt.refcount <= 0
976 +         || SYMBOL_CALLS_LOCAL (info, h)
977 +         || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
978 +             && h->root.type == bfd_link_hash_undefweak))
979         {
980           /* This case can occur if we saw a PLT32 reloc in an input
981 -            file, but the symbol was not defined by a dynamic object.
982 -            In such a case, we don't actually need to build a
983 -            procedure linkage table, and we can just do a PC32 reloc
984 -            instead.  */
985 -         BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
986 +            file, but the symbol was never referred to by a dynamic
987 +            object, or if all references were garbage collected.  In
988 +            such a case, we don't actually need to build a procedure
989 +            linkage table, and we can just do a PC24 reloc instead.  */
990 +         h->plt.offset = (bfd_vma) -1;
991           h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
992 -         return TRUE;
993 -       }
994 -
995 -      /* Make sure this symbol is output as a dynamic symbol.  */
996 -      if (h->dynindx == -1)
997 -       {
998 -         if (! bfd_elf32_link_record_dynamic_symbol (info, h))
999 -           return FALSE;
1000         }
1001  
1002 -      s = bfd_get_section_by_name (dynobj, ".plt");
1003 -      BFD_ASSERT (s != NULL);
1004 -
1005 -      /* If this is the first .plt entry, make room for the special
1006 -        first entry.  */
1007 -      if (s->_raw_size == 0)
1008 -       s->_raw_size += PLT_ENTRY_SIZE;
1009 -
1010 -      /* If this symbol is not defined in a regular file, and we are
1011 -        not generating a shared library, then set the symbol to this
1012 -        location in the .plt.  This is required to make function
1013 -        pointers compare as equal between the normal executable and
1014 -        the shared library.  */
1015 -      if (! info->shared
1016 -         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
1017 -       {
1018 -         h->root.u.def.section = s;
1019 -         h->root.u.def.value = s->_raw_size;
1020 -       }
1021 -
1022 -      h->plt.offset = s->_raw_size;
1023 -
1024 -      /* Make room for this entry.  */
1025 -      s->_raw_size += PLT_ENTRY_SIZE;
1026 -
1027 -      /* We also need to make an entry in the .got.plt section, which
1028 -        will be placed in the .got section by the linker script.  */
1029 -      s = bfd_get_section_by_name (dynobj, ".got.plt");
1030 -      BFD_ASSERT (s != NULL);
1031 -      s->_raw_size += 4;
1032 -
1033 -      /* We also need to make an entry in the .rel.plt section.  */
1034 -
1035 -      s = bfd_get_section_by_name (dynobj, ".rel.plt");
1036 -      BFD_ASSERT (s != NULL);
1037 -      s->_raw_size += sizeof (Elf32_External_Rel);
1038 -
1039        return TRUE;
1040      }
1041 +  else
1042 +    /* It's possible that we incorrectly decided a .plt reloc was
1043 +       needed for an R_ARM_PC24 reloc to a non-function sym in
1044 +       check_relocs.  We can't decide accurately between function and
1045 +       non-function syms in check-relocs;  Objects loaded later in
1046 +       the link may change h->type.  So fix it now.  */
1047 +    h->plt.offset = (bfd_vma) -1;
1048  
1049    /* If this is a weak symbol, and there is a real definition, the
1050       processor independent code will have arranged for us to see the
1051 @@ -3142,6 +3310,198 @@
1052    return TRUE;
1053  }
1054  
1055 +/* Allocate space in .plt, .got and associated reloc sections for
1056 +   dynamic relocs.  */
1057 +
1058 +static bfd_boolean
1059 +allocate_dynrelocs (h, inf)
1060 +     struct elf_link_hash_entry *h;
1061 +     PTR inf;
1062 +{
1063 +  struct bfd_link_info *info;
1064 +  struct elf32_arm_link_hash_table *htab;
1065 +  struct elf32_arm_link_hash_entry *eh;
1066 +  struct elf32_arm_relocs_copied *p;
1067 +
1068 +  if (h->root.type == bfd_link_hash_indirect)
1069 +    return TRUE;
1070 +
1071 +  if (h->root.type == bfd_link_hash_warning)
1072 +    /* When warning symbols are created, they **replace** the "real"
1073 +       entry in the hash table, thus we never get to see the real
1074 +       symbol in a hash traversal.  So look at it now.  */
1075 +    h = (struct elf_link_hash_entry *) h->root.u.i.link;
1076 +
1077 +  info = (struct bfd_link_info *) inf;
1078 +  htab = elf32_arm_hash_table (info);
1079 +
1080 +  if (htab->root.dynamic_sections_created
1081 +      && h->plt.refcount > 0)
1082 +    {
1083 +      /* Make sure this symbol is output as a dynamic symbol.
1084 +        Undefined weak syms won't yet be marked as dynamic.  */
1085 +      if (h->dynindx == -1
1086 +         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1087 +       {
1088 +         if (! bfd_elf32_link_record_dynamic_symbol (info, h))
1089 +           return FALSE;
1090 +       }
1091 +
1092 +      if (info->shared
1093 +         || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
1094 +       {
1095 +         asection *s = htab->splt;
1096 +
1097 +         /* If this is the first .plt entry, make room for the special
1098 +            first entry.  */
1099 +         if (s->_raw_size == 0)
1100 +           s->_raw_size += PLT_HEADER_SIZE;
1101 +
1102 +         h->plt.offset = s->_raw_size;
1103 +
1104 +         /* If this symbol is not defined in a regular file, and we are
1105 +            not generating a shared library, then set the symbol to this
1106 +            location in the .plt.  This is required to make function
1107 +            pointers compare as equal between the normal executable and
1108 +            the shared library.  */
1109 +         if (! info->shared
1110 +             && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
1111 +           {
1112 +             h->root.u.def.section = s;
1113 +             h->root.u.def.value = h->plt.offset;
1114 +           }
1115 +
1116 +         /* Make room for this entry.  */
1117 +         s->_raw_size += PLT_ENTRY_SIZE;
1118 +
1119 +         /* We also need to make an entry in the .got.plt section, which
1120 +            will be placed in the .got section by the linker script.  */
1121 +         htab->sgotplt->_raw_size += 4;
1122 +
1123 +         /* We also need to make an entry in the .rel.plt section.  */
1124 +         htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
1125 +       }
1126 +      else
1127 +       {
1128 +         h->plt.offset = (bfd_vma) -1;
1129 +         h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
1130 +       }
1131 +    }
1132 +  else
1133 +    {
1134 +      h->plt.offset = (bfd_vma) -1;
1135 +      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
1136 +    }
1137 +
1138 +  if (h->got.refcount > 0)
1139 +    {
1140 +      asection *s;
1141 +      bfd_boolean dyn;
1142 +
1143 +      /* Make sure this symbol is output as a dynamic symbol.
1144 +        Undefined weak syms won't yet be marked as dynamic.  */
1145 +      if (h->dynindx == -1
1146 +         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1147 +       {
1148 +         if (! bfd_elf32_link_record_dynamic_symbol (info, h))
1149 +           return FALSE;
1150 +       }
1151 +
1152 +      s = htab->sgot;
1153 +      h->got.offset = s->_raw_size;
1154 +      s->_raw_size += 4;
1155 +      dyn = htab->root.dynamic_sections_created;
1156 +      if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1157 +          || h->root.type != bfd_link_hash_undefweak)
1158 +         && (info->shared
1159 +             || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
1160 +       htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
1161 +    }
1162 +  else
1163 +    h->got.offset = (bfd_vma) -1;
1164 +
1165 +  eh = (struct elf32_arm_link_hash_entry *) h;
1166 +  if (eh->relocs_copied == NULL)
1167 +    return TRUE;
1168 +
1169 +  /* In the shared -Bsymbolic case, discard space allocated for
1170 +     dynamic pc-relative relocs against symbols which turn out to be
1171 +     defined in regular objects.  For the normal shared case, discard
1172 +     space for pc-relative relocs that have become local due to symbol
1173 +     visibility changes.  */
1174 +
1175 +  if (info->shared)
1176 +    {
1177 +      /* The only reloc that uses pc_count is R_ARM_PC24, which will
1178 +        appear on a call or on something like ".long foo - .".  We
1179 +        want calls to protected symbols to resolve directly to the
1180 +        function rather than going via the plt.  If people want
1181 +        function pointer comparisons to work as expected then they
1182 +        should avoid writing assembly like ".long foo - .".  */
1183 +      if (SYMBOL_CALLS_LOCAL (info, h))
1184 +       {
1185 +         struct elf32_arm_relocs_copied **pp;
1186 +
1187 +         for (pp = &eh->relocs_copied; (p = *pp) != NULL; )
1188 +           {
1189 +             p->count -= p->pc_count;
1190 +             p->pc_count = 0;
1191 +             if (p->count == 0)
1192 +               *pp = p->next;
1193 +             else
1194 +               pp = &p->next;
1195 +           }
1196 +       }
1197 +
1198 +      /* Also discard relocs on undefined weak syms with non-default
1199 +        visibility.  */
1200 +      if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
1201 +         && h->root.type == bfd_link_hash_undefweak)
1202 +       eh->relocs_copied = NULL;
1203 +    }
1204 +  else
1205 +    {
1206 +      /* For the non-shared case, discard space for relocs against
1207 +        symbols which turn out to need copy relocs or are not
1208 +        dynamic.  */
1209 +
1210 +      if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
1211 +         && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
1212 +              && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
1213 +             || (htab->root.dynamic_sections_created
1214 +                 && (h->root.type == bfd_link_hash_undefweak
1215 +                     || h->root.type == bfd_link_hash_undefined))))
1216 +       {
1217 +         /* Make sure this symbol is output as a dynamic symbol.
1218 +            Undefined weak syms won't yet be marked as dynamic.  */
1219 +         if (h->dynindx == -1
1220 +             && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1221 +           {
1222 +             if (! bfd_elf32_link_record_dynamic_symbol (info, h))
1223 +               return FALSE;
1224 +           }
1225 +
1226 +         /* If that succeeded, we know we'll be keeping all the
1227 +            relocs.  */
1228 +         if (h->dynindx != -1)
1229 +           goto keep;
1230 +       }
1231 +
1232 +      eh->relocs_copied = NULL;
1233 +
1234 +    keep: ;
1235 +    }
1236 +
1237 +  /* Finally, allocate space.  */
1238 +  for (p = eh->relocs_copied; p != NULL; p = p->next)
1239 +    {
1240 +      asection *sreloc = elf_section_data (p->section)->sreloc;
1241 +      sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
1242 +    }
1243 +
1244 +  return TRUE;
1245 +}
1246 +
1247  /* Set the sizes of the dynamic sections.  */
1248  
1249  static bfd_boolean
1250 @@ -3153,7 +3513,10 @@
1251    asection * s;
1252    bfd_boolean plt;
1253    bfd_boolean relocs;
1254 +  bfd *ibfd;
1255 +  struct elf32_arm_link_hash_table *htab;
1256  
1257 +  htab = elf32_arm_hash_table (info);
1258    dynobj = elf_hash_table (info)->dynobj;
1259    BFD_ASSERT (dynobj != NULL);
1260  
1261 @@ -3168,26 +3531,74 @@
1262           s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
1263         }
1264      }
1265 -  else
1266 -    {
1267 -      /* We may have created entries in the .rel.got section.
1268 -         However, if we are not creating the dynamic sections, we will
1269 -         not actually use these entries.  Reset the size of .rel.got,
1270 -         which will cause it to get stripped from the output file
1271 -         below.  */
1272 -      s = bfd_get_section_by_name (dynobj, ".rel.got");
1273 -      if (s != NULL)
1274 -       s->_raw_size = 0;
1275 -    }
1276 -
1277 -  /* If this is a -Bsymbolic shared link, then we need to discard all
1278 -     PC relative relocs against symbols defined in a regular object.
1279 -     We allocated space for them in the check_relocs routine, but we
1280 -     will not fill them in in the relocate_section routine.  */
1281 -  if (info->shared && info->symbolic)
1282 -    elf32_arm_link_hash_traverse (elf32_arm_hash_table (info),
1283 -                                 elf32_arm_discard_copies,
1284 -                                 (PTR) NULL);
1285 +
1286 +  /* Set up .got offsets for local syms, and space for local dynamic
1287 +     relocs.  */
1288 +  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
1289 +    {
1290 +      bfd_signed_vma *local_got;
1291 +      bfd_signed_vma *end_local_got;
1292 +      char *local_tls_type;
1293 +      bfd_size_type locsymcount;
1294 +      Elf_Internal_Shdr *symtab_hdr;
1295 +      asection *srel;
1296 +
1297 +      if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
1298 +       continue;
1299 +
1300 +      for (s = ibfd->sections; s != NULL; s = s->next)
1301 +       {
1302 +         struct elf32_arm_relocs_copied *p;
1303 +
1304 +         for (p = *((struct elf32_arm_relocs_copied **)
1305 +                    &elf_section_data (s)->local_dynrel);
1306 +              p != NULL;
1307 +              p = p->next)
1308 +           {
1309 +             if (!bfd_is_abs_section (p->section)
1310 +                 && bfd_is_abs_section (p->section->output_section))
1311 +               {
1312 +                 /* Input section has been discarded, either because
1313 +                    it is a copy of a linkonce section or due to
1314 +                    linker script /DISCARD/, so we'll be discarding
1315 +                    the relocs too.  */
1316 +               }
1317 +             else if (p->count != 0)
1318 +               {
1319 +                 srel = elf_section_data (p->section)->sreloc;
1320 +                 srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
1321 +                 if ((p->section->output_section->flags & SEC_READONLY) != 0)
1322 +                   info->flags |= DF_TEXTREL;
1323 +               }
1324 +           }
1325 +       }
1326 +
1327 +      local_got = elf_local_got_refcounts (ibfd);
1328 +      if (!local_got)
1329 +       continue;
1330 +
1331 +      symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
1332 +      locsymcount = symtab_hdr->sh_info;
1333 +      end_local_got = local_got + locsymcount;
1334 +      s = htab->sgot;
1335 +      srel = htab->srelgot;
1336 +      for (; local_got < end_local_got; ++local_got, ++local_tls_type)
1337 +       {
1338 +         if (*local_got > 0)
1339 +           {
1340 +             *local_got = s->_raw_size;
1341 +             s->_raw_size += 4;
1342 +             if (info->shared)
1343 +               srel->_raw_size += sizeof (Elf32_External_Rel);
1344 +           }
1345 +         else
1346 +           *local_got = (bfd_vma) -1;
1347 +       }
1348 +    }
1349 +
1350 +  /* Allocate global sym .plt and .got entries, and space for global
1351 +     sym dynamic relocs.  */
1352 +  elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info);
1353  
1354    /* The check_relocs and adjust_dynamic_symbol entry points have
1355       determined the sizes of the various dynamic sections.  Allocate
1356 @@ -3312,33 +3723,6 @@
1357    return TRUE;
1358  }
1359  
1360 -/* This function is called via elf32_arm_link_hash_traverse if we are
1361 -   creating a shared object with -Bsymbolic.  It discards the space
1362 -   allocated to copy PC relative relocs against symbols which are
1363 -   defined in regular objects.  We allocated space for them in the
1364 -   check_relocs routine, but we won't fill them in in the
1365 -   relocate_section routine.  */
1366 -
1367 -static bfd_boolean
1368 -elf32_arm_discard_copies (h, ignore)
1369 -     struct elf32_arm_link_hash_entry * h;
1370 -     PTR ignore ATTRIBUTE_UNUSED;
1371 -{
1372 -  struct elf32_arm_pcrel_relocs_copied * s;
1373 -
1374 -  if (h->root.root.type == bfd_link_hash_warning)
1375 -    h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link;
1376 -
1377 -  /* We only discard relocs for symbols defined in a regular object.  */
1378 -  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
1379 -    return TRUE;
1380 -
1381 -  for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
1382 -    s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
1383 -
1384 -  return TRUE;
1385 -}
1386 -
1387  /* Finish up dynamic symbol handling.  We set the contents of various
1388     dynamic sections here.  */
1389  
1390 @@ -3362,6 +3746,7 @@
1391        bfd_vma got_offset;
1392        Elf_Internal_Rela rel;
1393        bfd_byte *loc;
1394 +      bfd_vma got_displacement;
1395  
1396        /* This symbol has an entry in the procedure linkage table.  Set
1397          it up.  */
1398 @@ -3377,35 +3762,43 @@
1399          corresponds to this symbol.  This is the index of this symbol
1400          in all the symbols for which we are making plt entries.  The
1401          first entry in the procedure linkage table is reserved.  */
1402 -      plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
1403 +      plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
1404  
1405        /* Get the offset into the .got table of the entry that
1406          corresponds to this function.  Each .got entry is 4 bytes.
1407          The first three are reserved.  */
1408        got_offset = (plt_index + 3) * 4;
1409  
1410 +      /* Calculate the displacement between the PLT slot and the
1411 +        entry in the GOT.  */
1412 +      got_displacement = (sgot->output_section->vma
1413 +                         + sgot->output_offset
1414 +                         + got_offset
1415 +                         - splt->output_section->vma
1416 +                         - splt->output_offset
1417 +                         - h->plt.offset
1418 +                         - 8);
1419 +
1420 +      BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
1421 +
1422        /* Fill in the entry in the procedure linkage table.  */
1423 -      bfd_put_32 (output_bfd, elf32_arm_plt_entry[0],
1424 +      bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20),
1425                   splt->contents + h->plt.offset + 0);
1426 -      bfd_put_32 (output_bfd, elf32_arm_plt_entry[1],
1427 +      bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | ((got_displacement & 0x000ff000) >> 12),
1428                   splt->contents + h->plt.offset + 4);
1429 -      bfd_put_32 (output_bfd, elf32_arm_plt_entry[2],
1430 +      bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff),
1431                   splt->contents + h->plt.offset + 8);
1432 -      bfd_put_32 (output_bfd,
1433 -                     (sgot->output_section->vma
1434 -                      + sgot->output_offset
1435 -                      + got_offset
1436 -                      - splt->output_section->vma
1437 -                      - splt->output_offset
1438 -                      - h->plt.offset - 12),
1439 -                     splt->contents + h->plt.offset + 12);
1440 +#ifdef FOUR_WORD_PLT
1441 +      bfd_put_32 (output_bfd, elf32_arm_plt_entry[3],
1442 +                 splt->contents + h->plt.offset + 12);
1443 +#endif
1444  
1445        /* Fill in the entry in the global offset table.  */
1446        bfd_put_32 (output_bfd,
1447                   (splt->output_section->vma
1448                    + splt->output_offset),
1449                   sgot->contents + got_offset);
1450 -
1451 +      
1452        /* Fill in the entry in the .rel.plt section.  */
1453        rel.r_offset = (sgot->output_section->vma
1454                       + sgot->output_offset
1455 @@ -3446,16 +3839,20 @@
1456                       + sgot->output_offset
1457                       + (h->got.offset &~ (bfd_vma) 1));
1458  
1459 -      /* If this is a -Bsymbolic link, and the symbol is defined
1460 -        locally, we just want to emit a RELATIVE reloc.  The entry in
1461 -        the global offset table will already have been initialized in
1462 -        the relocate_section function.  */
1463 +      /* If this is a static link, or it is a -Bsymbolic link and the
1464 +        symbol is defined locally or was forced to be local because
1465 +        of a version file, we just want to emit a RELATIVE reloc.
1466 +        The entry in the global offset table will already have been
1467 +        initialized in the relocate_section function.  */
1468        if (info->shared
1469 -         && (info->symbolic || h->dynindx == -1)
1470 -         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
1471 -       rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
1472 +         && SYMBOL_REFERENCES_LOCAL (info, h))
1473 +       {
1474 +         BFD_ASSERT((h->got.offset & 1) != 0);
1475 +         rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
1476 +       }
1477        else
1478         {
1479 +         BFD_ASSERT((h->got.offset & 1) == 0);
1480           bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
1481           rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
1482         }
1483 @@ -3609,10 +4006,26 @@
1484        /* Fill in the first entry in the procedure linkage table.  */
1485        if (splt->_raw_size > 0)
1486         {
1487 +         bfd_vma got_displacement;
1488 +
1489 +         /* Calculate the displacement between the PLT slot and &GOT[0].  */
1490 +         got_displacement = (sgot->output_section->vma
1491 +                             + sgot->output_offset
1492 +                             - splt->output_section->vma
1493 +                             - splt->output_offset
1494 +                             - 16);
1495 +
1496           bfd_put_32 (output_bfd, elf32_arm_plt0_entry[0], splt->contents +  0);
1497           bfd_put_32 (output_bfd, elf32_arm_plt0_entry[1], splt->contents +  4);
1498           bfd_put_32 (output_bfd, elf32_arm_plt0_entry[2], splt->contents +  8);
1499           bfd_put_32 (output_bfd, elf32_arm_plt0_entry[3], splt->contents + 12);
1500 +#ifdef FOUR_WORD_PLT
1501 +         /* The displacement value goes in the otherwise-unused last word of
1502 +            the second entry.  */
1503 +         bfd_put_32 (output_bfd, got_displacement,        splt->contents + 28);
1504 +#else
1505 +         bfd_put_32 (output_bfd, got_displacement,        splt->contents + 16);
1506 +#endif
1507         }
1508  
1509        /* UnixWare sets the entsize of .plt to 4, although that doesn't
1510 @@ -3714,7 +4127,7 @@
1511  #define elf_backend_check_relocs                elf32_arm_check_relocs
1512  #define elf_backend_relocate_section           elf32_arm_relocate_section
1513  #define elf_backend_adjust_dynamic_symbol      elf32_arm_adjust_dynamic_symbol
1514 -#define elf_backend_create_dynamic_sections    _bfd_elf_create_dynamic_sections
1515 +#define elf_backend_create_dynamic_sections     elf32_arm_create_dynamic_sections
1516  #define elf_backend_finish_dynamic_symbol      elf32_arm_finish_dynamic_symbol
1517  #define elf_backend_finish_dynamic_sections    elf32_arm_finish_dynamic_sections
1518  #define elf_backend_size_dynamic_sections      elf32_arm_size_dynamic_sections
1519 @@ -3723,7 +4136,9 @@
1520  #define elf_backend_object_p                   elf32_arm_object_p
1521  #define elf_backend_section_flags              elf32_arm_section_flags
1522  #define elf_backend_final_write_processing      elf32_arm_final_write_processing
1523 +#define elf_backend_copy_indirect_symbol        elf32_arm_copy_indirect_symbol
1524  
1525 +#define elf_backend_can_refcount    1
1526  #define elf_backend_can_gc_sections 1
1527  #define elf_backend_plt_readonly    1
1528  #define elf_backend_want_got_plt    1
1529 @@ -3733,7 +4148,7 @@
1530  #endif
1531  
1532  #define elf_backend_got_header_size    12
1533 -#define elf_backend_plt_header_size    PLT_ENTRY_SIZE
1534 +#define elf_backend_plt_header_size    PLT_HEADER_SIZE
1535  
1536  #include "elf32-target.h"
1537  
1538 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-avr.c binutils-2.14.90.0.7/bfd/elf32-avr.c
1539 --- binutils-2.14.90.0.7.orig/bfd/elf32-avr.c   2003-07-23 09:08:08.000000000 -0600
1540 +++ binutils-2.14.90.0.7/bfd/elf32-avr.c        2004-04-20 01:26:12.000000000 -0600
1541 @@ -750,7 +750,7 @@
1542         {
1543           sym = local_syms + r_symndx;
1544           sec = local_sections [r_symndx];
1545 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1546 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1547  
1548           name = bfd_elf_string_from_elf_section
1549             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1550 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-cris.c binutils-2.14.90.0.7/bfd/elf32-cris.c
1551 --- binutils-2.14.90.0.7.orig/bfd/elf32-cris.c  2003-08-21 09:28:47.000000000 -0600
1552 +++ binutils-2.14.90.0.7/bfd/elf32-cris.c       2004-04-20 01:26:12.000000000 -0600
1553 @@ -847,7 +847,7 @@
1554         {
1555           sym = local_syms + r_symndx;
1556           sec = local_sections [r_symndx];
1557 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1558 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1559  
1560           symname = (bfd_elf_string_from_elf_section
1561                      (input_bfd, symtab_hdr->sh_link, sym->st_name));
1562 @@ -1292,16 +1292,7 @@
1563                     {
1564                       long indx;
1565  
1566 -                     if (h == NULL)
1567 -                       sec = local_sections[r_symndx];
1568 -                     else
1569 -                       {
1570 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
1571 -                                     || (h->root.type
1572 -                                         == bfd_link_hash_defweak));
1573 -                         sec = h->root.u.def.section;
1574 -                       }
1575 -                     if (sec != NULL && bfd_is_abs_section (sec))
1576 +                     if (bfd_is_abs_section (sec))
1577                         indx = 0;
1578                       else if (sec == NULL || sec->owner == NULL)
1579                         {
1580 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-fr30.c binutils-2.14.90.0.7/bfd/elf32-fr30.c
1581 --- binutils-2.14.90.0.7.orig/bfd/elf32-fr30.c  2003-07-23 09:08:08.000000000 -0600
1582 +++ binutils-2.14.90.0.7/bfd/elf32-fr30.c       2004-04-20 01:26:12.000000000 -0600
1583 @@ -552,7 +552,7 @@
1584         {
1585           sym = local_syms + r_symndx;
1586           sec = local_sections [r_symndx];
1587 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1588 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1589  
1590           name = bfd_elf_string_from_elf_section
1591             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1592 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-frv.c binutils-2.14.90.0.7/bfd/elf32-frv.c
1593 --- binutils-2.14.90.0.7.orig/bfd/elf32-frv.c   2003-10-29 10:37:47.000000000 -0700
1594 +++ binutils-2.14.90.0.7/bfd/elf32-frv.c        2004-04-20 01:26:12.000000000 -0600
1595 @@ -724,7 +724,7 @@
1596         {
1597           sym = local_syms + r_symndx;
1598           sec = local_sections [r_symndx];
1599 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1600 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1601  
1602           name = bfd_elf_string_from_elf_section
1603             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1604 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-h8300.c binutils-2.14.90.0.7/bfd/elf32-h8300.c
1605 --- binutils-2.14.90.0.7.orig/bfd/elf32-h8300.c 2003-10-29 10:37:47.000000000 -0700
1606 +++ binutils-2.14.90.0.7/bfd/elf32-h8300.c      2004-04-20 01:26:12.000000000 -0600
1607 @@ -435,7 +435,7 @@
1608         {
1609           sym = local_syms + r_symndx;
1610           sec = local_sections[r_symndx];
1611 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1612 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1613         }
1614        else
1615         {
1616 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-hppa.c binutils-2.14.90.0.7/bfd/elf32-hppa.c
1617 --- binutils-2.14.90.0.7.orig/bfd/elf32-hppa.c  2003-10-29 10:37:47.000000000 -0700
1618 +++ binutils-2.14.90.0.7/bfd/elf32-hppa.c       2004-04-20 01:26:12.000000000 -0600
1619 @@ -3408,7 +3408,7 @@
1620           /* This is a local symbol, h defaults to NULL.  */
1621           sym = local_syms + r_symndx;
1622           sym_sec = local_sections[r_symndx];
1623 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
1624 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
1625         }
1626        else
1627         {
1628 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-i370.c binutils-2.14.90.0.7/bfd/elf32-i370.c
1629 --- binutils-2.14.90.0.7.orig/bfd/elf32-i370.c  2003-07-23 09:08:08.000000000 -0600
1630 +++ binutils-2.14.90.0.7/bfd/elf32-i370.c       2004-04-20 01:26:12.000000000 -0600
1631 @@ -1210,7 +1210,7 @@
1632           sec = local_sections[r_symndx];
1633           sym_name = "<local symbol>";
1634  
1635 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1636 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1637           addend = rel->r_addend;
1638         }
1639        else
1640 @@ -1363,16 +1363,7 @@
1641                     {
1642                       long indx;
1643  
1644 -                     if (h == NULL)
1645 -                       sec = local_sections[r_symndx];
1646 -                     else
1647 -                       {
1648 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
1649 -                                     || (h->root.type
1650 -                                         == bfd_link_hash_defweak));
1651 -                         sec = h->root.u.def.section;
1652 -                       }
1653 -                     if (sec != NULL && bfd_is_abs_section (sec))
1654 +                     if (bfd_is_abs_section (sec))
1655                         indx = 0;
1656                       else if (sec == NULL || sec->owner == NULL)
1657                         {
1658 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-i860.c binutils-2.14.90.0.7/bfd/elf32-i860.c
1659 --- binutils-2.14.90.0.7.orig/bfd/elf32-i860.c  2003-10-29 10:37:47.000000000 -0700
1660 +++ binutils-2.14.90.0.7/bfd/elf32-i860.c       2004-04-20 01:26:12.000000000 -0600
1661 @@ -1104,7 +1104,7 @@
1662         {
1663           sym = local_syms + r_symndx;
1664           sec = local_sections [r_symndx];
1665 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1666 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1667  
1668           name = bfd_elf_string_from_elf_section
1669             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1670 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-m32r.c binutils-2.14.90.0.7/bfd/elf32-m32r.c
1671 --- binutils-2.14.90.0.7.orig/bfd/elf32-m32r.c  2003-10-29 10:37:47.000000000 -0700
1672 +++ binutils-2.14.90.0.7/bfd/elf32-m32r.c       2004-04-20 01:26:12.000000000 -0600
1673 @@ -1107,7 +1107,7 @@
1674               sec = local_sections[r_symndx];
1675               sym_name = "<local symbol>";
1676  #if !USE_REL
1677 -             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1678 +             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1679               addend = rel->r_addend;
1680  #else
1681               /* FIXME: This won't handle local relocations against SEC_MERGE
1682 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-m68k.c binutils-2.14.90.0.7/bfd/elf32-m68k.c
1683 --- binutils-2.14.90.0.7.orig/bfd/elf32-m68k.c  2003-08-21 09:28:47.000000000 -0600
1684 +++ binutils-2.14.90.0.7/bfd/elf32-m68k.c       2004-04-20 01:26:12.000000000 -0600
1685 @@ -1403,7 +1403,7 @@
1686         {
1687           sym = local_syms + r_symndx;
1688           sec = local_sections[r_symndx];
1689 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1690 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1691         }
1692        else
1693         {
1694 @@ -1657,16 +1657,7 @@
1695                     {
1696                       long indx;
1697  
1698 -                     if (h == NULL)
1699 -                       sec = local_sections[r_symndx];
1700 -                     else
1701 -                       {
1702 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
1703 -                                     || (h->root.type
1704 -                                         == bfd_link_hash_defweak));
1705 -                         sec = h->root.u.def.section;
1706 -                       }
1707 -                     if (sec != NULL && bfd_is_abs_section (sec))
1708 +                     if (bfd_is_abs_section (sec))
1709                         indx = 0;
1710                       else if (sec == NULL || sec->owner == NULL)
1711                         {
1712 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-mcore.c binutils-2.14.90.0.7/bfd/elf32-mcore.c
1713 --- binutils-2.14.90.0.7.orig/bfd/elf32-mcore.c 2003-10-29 10:37:48.000000000 -0700
1714 +++ binutils-2.14.90.0.7/bfd/elf32-mcore.c      2004-04-20 01:26:12.000000000 -0600
1715 @@ -467,7 +467,7 @@
1716         {
1717           sym = local_syms + r_symndx;
1718           sec = local_sections [r_symndx];
1719 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1720 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1721           addend = rel->r_addend;
1722         }
1723        else
1724 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-msp430.c binutils-2.14.90.0.7/bfd/elf32-msp430.c
1725 --- binutils-2.14.90.0.7.orig/bfd/elf32-msp430.c        2003-08-21 09:28:47.000000000 -0600
1726 +++ binutils-2.14.90.0.7/bfd/elf32-msp430.c     2004-04-20 01:26:12.000000000 -0600
1727 @@ -449,7 +449,7 @@
1728         {
1729           sym = local_syms + r_symndx;
1730           sec = local_sections[r_symndx];
1731 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1732 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1733  
1734           name = bfd_elf_string_from_elf_section
1735               (input_bfd, symtab_hdr->sh_link, sym->st_name);
1736 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-openrisc.c binutils-2.14.90.0.7/bfd/elf32-openrisc.c
1737 --- binutils-2.14.90.0.7.orig/bfd/elf32-openrisc.c      2003-07-23 09:08:08.000000000 -0600
1738 +++ binutils-2.14.90.0.7/bfd/elf32-openrisc.c   2004-04-20 01:26:12.000000000 -0600
1739 @@ -375,7 +375,7 @@
1740         {
1741           sym = local_syms + r_symndx;
1742           sec = local_sections[r_symndx];
1743 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1744 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1745  
1746           name = bfd_elf_string_from_elf_section
1747             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1748 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-ppc.c binutils-2.14.90.0.7/bfd/elf32-ppc.c
1749 --- binutils-2.14.90.0.7.orig/bfd/elf32-ppc.c   2003-10-29 10:37:48.000000000 -0700
1750 +++ binutils-2.14.90.0.7/bfd/elf32-ppc.c        2004-04-20 01:26:12.000000000 -0600
1751 @@ -4727,7 +4727,7 @@
1752           sec = local_sections[r_symndx];
1753           sym_name = bfd_elf_local_sym_name (input_bfd, sym);
1754  
1755 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1756 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1757         }
1758        else
1759         {
1760 @@ -5455,44 +5455,9 @@
1761           break;
1762  
1763         case R_PPC_RELAX32:
1764 -         {
1765 -           unsigned long r_symndx;
1766 -           Elf_Internal_Sym *sym;
1767 -           asection *sym_sec;
1768 -           bfd_byte *hit_addr = 0;
1769 -           bfd_vma value = 0;
1770 -
1771 -           r_symndx = ELF32_R_SYM (rel->r_info);
1772 -
1773 -           if (r_symndx < symtab_hdr->sh_info)
1774 -             {
1775 -               sym = local_syms + r_symndx;
1776 -               sym_sec = local_sections[r_symndx];
1777 -
1778 -               value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
1779 -             }
1780 -           else
1781 -             {
1782 -               bfd_boolean warned;
1783 -               bfd_boolean unresolved_reloc;
1784 -
1785 -               RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd),
1786 -                                        r_symndx, symtab_hdr,
1787 -                                        value, sym_sec,
1788 -                                        unresolved_reloc, info,
1789 -                                        warned);
1790 -               if (warned)
1791 -                 continue;
1792 -             }
1793 -           hit_addr = contents + rel->r_offset;
1794 -           value += rel->r_addend;
1795 -
1796 -           r = ppc_elf_install_value (output_bfd, hit_addr, value, r_type);
1797 -           if (r != bfd_reloc_ok)
1798 -             break;
1799 -           else
1800 -             continue;
1801 -         }
1802 +         ppc_elf_install_value (output_bfd, contents + rel->r_offset,
1803 +                                relocation + addend, r_type);
1804 +         continue;
1805  
1806           /* Indirect .sdata relocation.  */
1807         case R_PPC_EMB_SDAI16:
1808 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-s390.c binutils-2.14.90.0.7/bfd/elf32-s390.c
1809 --- binutils-2.14.90.0.7.orig/bfd/elf32-s390.c  2003-08-21 09:28:47.000000000 -0600
1810 +++ binutils-2.14.90.0.7/bfd/elf32-s390.c       2004-04-20 01:26:12.000000000 -0600
1811 @@ -2327,7 +2327,7 @@
1812         {
1813           sym = local_syms + r_symndx;
1814           sec = local_sections[r_symndx];
1815 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1816 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1817         }
1818        else
1819         {
1820 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-sh.c binutils-2.14.90.0.7/bfd/elf32-sh.c
1821 --- binutils-2.14.90.0.7.orig/bfd/elf32-sh.c    2003-10-29 10:37:48.000000000 -0700
1822 +++ binutils-2.14.90.0.7/bfd/elf32-sh.c 2004-04-20 01:26:12.000000000 -0600
1823 @@ -4805,7 +4805,7 @@
1824             }
1825           else if (! howto->partial_inplace)
1826             {
1827 -             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1828 +             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1829               addend = rel->r_addend;
1830             }
1831           else if ((sec->flags & SEC_MERGE)
1832 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-sparc.c binutils-2.14.90.0.7/bfd/elf32-sparc.c
1833 --- binutils-2.14.90.0.7.orig/bfd/elf32-sparc.c 2003-08-21 09:28:48.000000000 -0600
1834 +++ binutils-2.14.90.0.7/bfd/elf32-sparc.c      2004-04-20 01:26:12.000000000 -0600
1835 @@ -2182,7 +2182,7 @@
1836         {
1837           sym = local_syms + r_symndx;
1838           sec = local_sections[r_symndx];
1839 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1840 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1841         }
1842        else
1843         {
1844 @@ -2459,16 +2459,8 @@
1845  
1846                       if (is_plt)
1847                         sec = htab->splt;
1848 -                     else if (h == NULL)
1849 -                       sec = local_sections[r_symndx];
1850 -                     else
1851 -                       {
1852 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
1853 -                                     || (h->root.type
1854 -                                         == bfd_link_hash_defweak));
1855 -                         sec = h->root.u.def.section;
1856 -                       }
1857 -                     if (sec != NULL && bfd_is_abs_section (sec))
1858 +
1859 +                     if (bfd_is_abs_section (sec))
1860                         indx = 0;
1861                       else if (sec == NULL || sec->owner == NULL)
1862                         {
1863 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-v850.c binutils-2.14.90.0.7/bfd/elf32-v850.c
1864 --- binutils-2.14.90.0.7.orig/bfd/elf32-v850.c  2003-10-29 10:37:48.000000000 -0700
1865 +++ binutils-2.14.90.0.7/bfd/elf32-v850.c       2004-04-20 01:26:12.000000000 -0600
1866 @@ -1681,7 +1681,7 @@
1867         {
1868           sym = local_syms + r_symndx;
1869           sec = local_sections[r_symndx];
1870 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1871 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1872  #if 0
1873           {
1874             char * name;
1875 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-vax.c binutils-2.14.90.0.7/bfd/elf32-vax.c
1876 --- binutils-2.14.90.0.7.orig/bfd/elf32-vax.c   2003-08-21 09:28:48.000000000 -0600
1877 +++ binutils-2.14.90.0.7/bfd/elf32-vax.c        2004-04-20 01:26:12.000000000 -0600
1878 @@ -1483,7 +1483,7 @@
1879         {
1880           sym = local_syms + r_symndx;
1881           sec = local_sections[r_symndx];
1882 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1883 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1884         }
1885        else
1886         {
1887 @@ -1737,16 +1737,7 @@
1888                     {
1889                       long indx;
1890  
1891 -                     if (h == NULL)
1892 -                       sec = local_sections[r_symndx];
1893 -                     else
1894 -                       {
1895 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
1896 -                                     || (h->root.type
1897 -                                         == bfd_link_hash_defweak));
1898 -                         sec = h->root.u.def.section;
1899 -                       }
1900 -                     if (sec != NULL && bfd_is_abs_section (sec))
1901 +                     if (bfd_is_abs_section (sec))
1902                         indx = 0;
1903                       else if (sec == NULL || sec->owner == NULL)
1904                         {
1905 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-xstormy16.c binutils-2.14.90.0.7/bfd/elf32-xstormy16.c
1906 --- binutils-2.14.90.0.7.orig/bfd/elf32-xstormy16.c     2003-07-23 09:08:09.000000000 -0600
1907 +++ binutils-2.14.90.0.7/bfd/elf32-xstormy16.c  2004-04-20 01:26:12.000000000 -0600
1908 @@ -845,7 +845,7 @@
1909         {
1910           sym = local_syms + r_symndx;
1911           sec = local_sections [r_symndx];
1912 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1913 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1914  
1915           name = bfd_elf_string_from_elf_section
1916             (input_bfd, symtab_hdr->sh_link, sym->st_name);
1917 diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-xtensa.c binutils-2.14.90.0.7/bfd/elf32-xtensa.c
1918 --- binutils-2.14.90.0.7.orig/bfd/elf32-xtensa.c        2003-10-29 10:37:48.000000000 -0700
1919 +++ binutils-2.14.90.0.7/bfd/elf32-xtensa.c     2004-04-20 01:26:12.000000000 -0600
1920 @@ -2004,7 +2004,7 @@
1921         {
1922           sym = local_syms + r_symndx;
1923           sec = local_sections[r_symndx];
1924 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1925 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1926         }
1927        else
1928         {
1929 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-alpha.c binutils-2.14.90.0.7/bfd/elf64-alpha.c
1930 --- binutils-2.14.90.0.7.orig/bfd/elf64-alpha.c 2003-10-29 10:37:48.000000000 -0700
1931 +++ binutils-2.14.90.0.7/bfd/elf64-alpha.c      2004-04-20 01:26:12.000000000 -0600
1932 @@ -4394,9 +4394,11 @@
1933  
1934        if (r_symndx < symtab_hdr->sh_info)
1935         {
1936 +         asection *msec;
1937           sym = local_syms + r_symndx;
1938           sec = local_sections[r_symndx];
1939 -         value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1940 +         msec = sec;
1941 +         value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
1942  
1943           /* If this is a tp-relative relocation against sym 0,
1944              this is hackery from relax_section.  Force the value to
1945 @@ -4424,7 +4426,6 @@
1946               && !gotent->reloc_xlated)
1947             {
1948               struct alpha_elf_got_entry *ent;
1949 -             asection *msec;
1950  
1951               for (ent = gotent; ent; ent = ent->next)
1952                 {
1953 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-hppa.c binutils-2.14.90.0.7/bfd/elf64-hppa.c
1954 --- binutils-2.14.90.0.7.orig/bfd/elf64-hppa.c  2003-10-29 10:37:48.000000000 -0700
1955 +++ binutils-2.14.90.0.7/bfd/elf64-hppa.c       2004-04-20 01:26:12.000000000 -0600
1956 @@ -173,7 +173,7 @@
1957            PTR info));
1958  
1959  static const char *get_dyn_name
1960 -  PARAMS ((asection *, struct elf_link_hash_entry *,
1961 +  PARAMS ((bfd *, struct elf_link_hash_entry *,
1962            const Elf_Internal_Rela *, char **, size_t *));
1963  
1964  /* This must follow the definitions of the various derived linker
1965 @@ -446,13 +446,14 @@
1966     allocate memory as necessary, possibly reusing PBUF/PLEN.  */
1967  
1968  static const char *
1969 -get_dyn_name (sec, h, rel, pbuf, plen)
1970 -     asection *sec;
1971 +get_dyn_name (abfd, h, rel, pbuf, plen)
1972 +     bfd *abfd;
1973       struct elf_link_hash_entry *h;
1974       const Elf_Internal_Rela *rel;
1975       char **pbuf;
1976       size_t *plen;
1977  {
1978 +  asection *sec = abfd->sections;
1979    size_t nlen, tlen;
1980    char *buf;
1981    size_t len;
1982 @@ -858,7 +859,7 @@
1983         continue;
1984  
1985        /* Collect a canonical name for this address.  */
1986 -      addr_name = get_dyn_name (sec, h, rel, &buf, &buf_len);
1987 +      addr_name = get_dyn_name (abfd, h, rel, &buf, &buf_len);
1988  
1989        /* Collect the canonical entry data for this address.  */
1990        dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
1991 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-mmix.c binutils-2.14.90.0.7/bfd/elf64-mmix.c
1992 --- binutils-2.14.90.0.7.orig/bfd/elf64-mmix.c  2003-10-29 10:37:48.000000000 -0700
1993 +++ binutils-2.14.90.0.7/bfd/elf64-mmix.c       2004-04-20 01:26:12.000000000 -0600
1994 @@ -1472,7 +1472,7 @@
1995         {
1996           sym = local_syms + r_symndx;
1997           sec = local_sections [r_symndx];
1998 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1999 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2000  
2001           name = bfd_elf_string_from_elf_section
2002             (input_bfd, symtab_hdr->sh_link, sym->st_name);
2003 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-ppc.c binutils-2.14.90.0.7/bfd/elf64-ppc.c
2004 --- binutils-2.14.90.0.7.orig/bfd/elf64-ppc.c   2003-10-29 10:37:48.000000000 -0700
2005 +++ binutils-2.14.90.0.7/bfd/elf64-ppc.c        2004-04-20 01:26:12.000000000 -0600
2006 @@ -7385,7 +7385,7 @@
2007           sec = local_sections[r_symndx];
2008           sym_name = bfd_elf_local_sym_name (input_bfd, sym);
2009           sym_type = ELF64_ST_TYPE (sym->st_info);
2010 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
2011 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2012           if (elf_section_data (sec) != NULL)
2013             {
2014               long *opd_sym_adjust;
2015 @@ -8178,7 +8178,9 @@
2016           relocation = TOCstart;
2017           if (r_symndx == 0)
2018             relocation += htab->stub_group[input_section->id].toc_off;
2019 -         else if (sec != NULL && !unresolved_reloc)
2020 +         else if (unresolved_reloc)
2021 +           ;
2022 +         else if (sec != NULL && sec->id <= htab->top_id)
2023             relocation += htab->stub_group[sec->id].toc_off;
2024           else
2025             unresolved_reloc = TRUE;
2026 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-s390.c binutils-2.14.90.0.7/bfd/elf64-s390.c
2027 --- binutils-2.14.90.0.7.orig/bfd/elf64-s390.c  2003-08-21 09:28:48.000000000 -0600
2028 +++ binutils-2.14.90.0.7/bfd/elf64-s390.c       2004-04-20 01:26:12.000000000 -0600
2029 @@ -2297,7 +2297,7 @@
2030         {
2031           sym = local_syms + r_symndx;
2032           sec = local_sections[r_symndx];
2033 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
2034 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2035         }
2036        else
2037         {
2038 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-sh64.c binutils-2.14.90.0.7/bfd/elf64-sh64.c
2039 --- binutils-2.14.90.0.7.orig/bfd/elf64-sh64.c  2003-10-29 10:37:48.000000000 -0700
2040 +++ binutils-2.14.90.0.7/bfd/elf64-sh64.c       2004-04-20 01:26:12.000000000 -0600
2041 @@ -1582,7 +1582,7 @@
2042             }
2043           else if (! howto->partial_inplace)
2044             {
2045 -             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
2046 +             relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2047               relocation |= ((sym->st_other & STO_SH5_ISA32) != 0);
2048             }
2049           else if ((sec->flags & SEC_MERGE)
2050 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-sparc.c binutils-2.14.90.0.7/bfd/elf64-sparc.c
2051 --- binutils-2.14.90.0.7.orig/bfd/elf64-sparc.c 2003-08-21 09:28:48.000000000 -0600
2052 +++ binutils-2.14.90.0.7/bfd/elf64-sparc.c      2004-04-20 01:26:12.000000000 -0600
2053 @@ -2070,7 +2070,7 @@
2054         {
2055           sym = local_syms + r_symndx;
2056           sec = local_sections[r_symndx];
2057 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
2058 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2059         }
2060        else
2061         {
2062 @@ -2247,16 +2247,8 @@
2063  
2064                         if (is_plt)
2065                           sec = splt;
2066 -                       else if (h == NULL)
2067 -                         sec = local_sections[r_symndx];
2068 -                       else
2069 -                         {
2070 -                           BFD_ASSERT (h->root.type == bfd_link_hash_defined
2071 -                                       || (h->root.type
2072 -                                           == bfd_link_hash_defweak));
2073 -                           sec = h->root.u.def.section;
2074 -                         }
2075 -                       if (sec != NULL && bfd_is_abs_section (sec))
2076 +
2077 +                       if (bfd_is_abs_section (sec))
2078                           indx = 0;
2079                         else if (sec == NULL || sec->owner == NULL)
2080                           {
2081 diff -urN binutils-2.14.90.0.7.orig/bfd/elf64-x86-64.c binutils-2.14.90.0.7/bfd/elf64-x86-64.c
2082 --- binutils-2.14.90.0.7.orig/bfd/elf64-x86-64.c        2003-08-21 09:28:48.000000000 -0600
2083 +++ binutils-2.14.90.0.7/bfd/elf64-x86-64.c     2004-04-20 01:26:12.000000000 -0600
2084 @@ -1823,7 +1823,7 @@
2085           sym = local_syms + r_symndx;
2086           sec = local_sections[r_symndx];
2087  
2088 -         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
2089 +         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2090         }
2091        else
2092         {
2093 @@ -2048,16 +2048,7 @@
2094                     {
2095                       long sindx;
2096  
2097 -                     if (h == NULL)
2098 -                       sec = local_sections[r_symndx];
2099 -                     else
2100 -                       {
2101 -                         BFD_ASSERT (h->root.type == bfd_link_hash_defined
2102 -                                     || (h->root.type
2103 -                                         == bfd_link_hash_defweak));
2104 -                         sec = h->root.u.def.section;
2105 -                       }
2106 -                     if (sec != NULL && bfd_is_abs_section (sec))
2107 +                     if (bfd_is_abs_section (sec))
2108                         sindx = 0;
2109                       else if (sec == NULL || sec->owner == NULL)
2110                         {
2111 diff -urN binutils-2.14.90.0.7.orig/bfd/elfxx-ia64.c binutils-2.14.90.0.7/bfd/elfxx-ia64.c
2112 --- binutils-2.14.90.0.7.orig/bfd/elfxx-ia64.c  2003-10-29 10:37:48.000000000 -0700
2113 +++ binutils-2.14.90.0.7/bfd/elfxx-ia64.c       2004-04-20 01:26:12.000000000 -0600
2114 @@ -3849,9 +3849,11 @@
2115        if (r_symndx < symtab_hdr->sh_info)
2116         {
2117           /* Reloc against local symbol.  */
2118 +         asection *msec;
2119           sym = local_syms + r_symndx;
2120           sym_sec = local_sections[r_symndx];
2121 -         value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
2122 +         msec = sym_sec;
2123 +         value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
2124           if ((sym_sec->flags & SEC_MERGE)
2125               && ELF_ST_TYPE (sym->st_info) == STT_SECTION
2126               && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
2127 @@ -3862,7 +3864,6 @@
2128               if (loc_h && ! loc_h->sec_merge_done)
2129                 {
2130                   struct elfNN_ia64_dyn_sym_info *dynent;
2131 -                 asection *msec;
2132  
2133                   for (dynent = loc_h->info; dynent; dynent = dynent->next)
2134                     {
2135 diff -urN binutils-2.14.90.0.7.orig/bfd/opncls.c binutils-2.14.90.0.7/bfd/opncls.c
2136 --- binutils-2.14.90.0.7.orig/bfd/opncls.c      2003-10-29 10:37:48.000000000 -0700
2137 +++ binutils-2.14.90.0.7/bfd/opncls.c   2004-04-20 01:26:11.000000000 -0600
2138 @@ -150,6 +150,13 @@
2139  {
2140    bfd *nbfd;
2141    const bfd_target *target_vec;
2142 +  struct stat s;
2143 +
2144 +  if (stat (filename, &s) == 0)
2145 +    if (S_ISDIR(s.st_mode)) {
2146 +      bfd_set_error (bfd_error_file_not_recognized);
2147 +      return NULL;
2148 +    }
2149  
2150    nbfd = _bfd_new_bfd ();
2151    if (nbfd == NULL)
2152 diff -urN binutils-2.14.90.0.7.orig/binutils/objcopy.c binutils-2.14.90.0.7/binutils/objcopy.c
2153 --- binutils-2.14.90.0.7.orig/binutils/objcopy.c        2003-10-29 10:37:48.000000000 -0700
2154 +++ binutils-2.14.90.0.7/binutils/objcopy.c     2004-04-20 01:26:12.000000000 -0600
2155 @@ -27,6 +27,7 @@
2156  #include "libiberty.h"
2157  #include "budbg.h"
2158  #include "filenames.h"
2159 +#include "elf-bfd.h"
2160  #include <sys/stat.h>
2161  
2162  /* A list of symbols to explicitly strip out, or to keep.  A linked
2163 @@ -385,6 +386,7 @@
2164    -g --strip-debug                 Remove all debugging symbols & sections\n\
2165       --strip-unneeded              Remove all symbols not needed by relocations\n\
2166    -N --strip-symbol <name>         Do not copy symbol <name>\n\
2167 +     --only-keep-debug             Strip everything but the debug information\n\
2168    -K --keep-symbol <name>          Only copy symbol <name>\n\
2169    -L --localize-symbol <name>      Force symbol <name> to be marked as a local\n\
2170    -G --keep-global-symbol <name>   Localize all symbols except <name>\n\
2171 @@ -457,6 +459,7 @@
2172    -s --strip-all                   Remove all symbol and relocation information\n\
2173    -g -S -d --strip-debug           Remove all debugging symbols & sections\n\
2174       --strip-unneeded              Remove all symbols not needed by relocations\n\
2175 +     --only-keep-debug             Strip everything but the debug information\n\
2176    -N --strip-symbol=<name>         Do not copy symbol <name>\n\
2177    -K --keep-symbol=<name>          Only copy symbol <name>\n\
2178    -x --discard-all                 Remove all non-global symbols\n\
2179 @@ -734,7 +737,7 @@
2180         return FALSE;
2181      }
2182  
2183 -  return strip_symbols == STRIP_NONDEBUG ? TRUE : FALSE;
2184 +  return FALSE;
2185  }
2186  
2187  /* Choose which symbol entries to copy; put the result in OSYMS.
2188 @@ -1806,6 +1809,13 @@
2189  
2190    if (p != NULL && p->set_flags)
2191      flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
2192 +  else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0)
2193 +    {
2194 +      flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD);
2195 +      if (obfd->xvec->flavour == bfd_target_elf_flavour)
2196 +       elf_section_type (osection) = SHT_NOBITS;
2197 +    }
2198 +
2199    if (!bfd_set_section_flags (obfd, osection, flags))
2200      {
2201        err = _("flags");
2202 @@ -1926,6 +1936,8 @@
2203         }
2204  
2205        bfd_set_reloc (obfd, osection, relcount == 0 ? NULL : relpp, relcount);
2206 +      if (relcount == 0)
2207 +       free (relpp);
2208      }
2209  
2210    isection->_cooked_size = isection->_raw_size;
2211 diff -urN binutils-2.14.90.0.7.orig/binutils/readelf.c binutils-2.14.90.0.7/binutils/readelf.c
2212 --- binutils-2.14.90.0.7.orig/binutils/readelf.c        2003-10-29 10:37:48.000000000 -0700
2213 +++ binutils-2.14.90.0.7/binutils/readelf.c     2004-04-20 01:26:12.000000000 -0600
2214 @@ -6055,7 +6055,7 @@
2215  
2216    bytes = section->sh_size;
2217  
2218 -  if (bytes == 0)
2219 +  if (bytes == 0 || section->sh_type == SHT_NOBITS)
2220      {
2221        printf (_("\nSection '%s' has no data to dump.\n"),
2222               SECTION_NAME (section));
2223 diff -urN binutils-2.14.90.0.7.orig/gprof/gprof.texi binutils-2.14.90.0.7/gprof/gprof.texi
2224 --- binutils-2.14.90.0.7.orig/gprof/gprof.texi  2002-08-01 18:49:32.000000000 -0600
2225 +++ binutils-2.14.90.0.7/gprof/gprof.texi       2004-04-20 01:26:11.000000000 -0600
2226 @@ -137,6 +137,10 @@
2227  If more than one profile file is specified, the @code{gprof}
2228  output shows the sum of the profile information in the given profile files.
2229  
2230 +If you use gcc 2.95.x or 3.0 to compile your binaries, you may need
2231 +to add the @samp{-fprofile-arcs} to the compile command line in order
2232 +for the call graphs to be properly stored in gmon.out.
2233 +
2234  @code{Gprof} calculates the amount of time spent in each routine.
2235  Next, these times are propagated along the edges of the call graph.
2236  Cycles are discovered, and calls into a cycle are made to share the time
2237 @@ -181,7 +185,7 @@
2238  @c man end
2239  
2240  @c man begin SEEALSO
2241 -monitor(3), profil(2), cc(1), prof(1), and the Info entry for @file{gprof}.
2242 +profil(2), cc(1), prof(1), and the Info entry for @file{gprof}.
2243  
2244  ``An Execution Profiler for Modular Programs'',
2245  by S. Graham, P. Kessler, M. McKusick;
2246 @@ -267,6 +271,11 @@
2247  options.  The same option, @samp{-pg}, alters either compilation or linking
2248  to do what is necessary for profiling.  Here are examples:
2249  
2250 +If you use gcc 2.95.x or 3.0.x, you may need to add the
2251 +@samp{-fprofile-arcs} option to the compile line along with @samp{-pg}
2252 +in order to allow the call-graphs to be properly included in the gmon.out
2253 +file.
2254 +
2255  @example
2256  cc -g -c myprog.c utils.c -pg
2257  cc -o myprog myprog.o utils.o -pg
2258 diff -urN binutils-2.14.90.0.7.orig/ld/Makefile.am binutils-2.14.90.0.7/ld/Makefile.am
2259 --- binutils-2.14.90.0.7.orig/ld/Makefile.am    2003-10-29 10:37:48.000000000 -0700
2260 +++ binutils-2.14.90.0.7/ld/Makefile.am 2004-04-20 01:26:11.000000000 -0600
2261 @@ -19,7 +19,7 @@
2262  # We put the scripts in the directory $(scriptdir)/ldscripts.
2263  # We can't put the scripts in $(datadir) because the SEARCH_DIR
2264  # directives need to be different for native and cross linkers.
2265 -scriptdir = $(tooldir)/lib
2266 +scriptdir = $(libdir)
2267  
2268  EMUL = @EMUL@
2269  EMULATION_OFILES = @EMULATION_OFILES@
2270 diff -urN binutils-2.14.90.0.7.orig/ld/Makefile.in binutils-2.14.90.0.7/ld/Makefile.in
2271 --- binutils-2.14.90.0.7.orig/ld/Makefile.in    2003-10-29 10:37:48.000000000 -0700
2272 +++ binutils-2.14.90.0.7/ld/Makefile.in 2004-04-20 01:26:11.000000000 -0600
2273 @@ -128,7 +128,7 @@
2274  # We put the scripts in the directory $(scriptdir)/ldscripts.
2275  # We can't put the scripts in $(datadir) because the SEARCH_DIR
2276  # directives need to be different for native and cross linkers.
2277 -scriptdir = $(tooldir)/lib
2278 +scriptdir = $(libdir)
2279  
2280  EMUL = @EMUL@
2281  EMULATION_OFILES = @EMULATION_OFILES@
2282 diff -urN binutils-2.14.90.0.7.orig/ld/emultempl/elf32.em binutils-2.14.90.0.7/ld/emultempl/elf32.em
2283 --- binutils-2.14.90.0.7.orig/ld/emultempl/elf32.em     2003-08-21 09:28:48.000000000 -0600
2284 +++ binutils-2.14.90.0.7/ld/emultempl/elf32.em  2004-04-20 01:26:11.000000000 -0600
2285 @@ -679,6 +679,8 @@
2286               && command_line.rpath == NULL)
2287             {
2288               lib_path = (const char *) getenv ("LD_RUN_PATH");
2289 +             if ((lib_path) && (strlen (lib_path) == 0))
2290 +                 lib_path = NULL;
2291               if (gld${EMULATION_NAME}_search_needed (lib_path, l->name,
2292                                                       force))
2293                 break;
2294 @@ -855,6 +857,8 @@
2295    rpath = command_line.rpath;
2296    if (rpath == NULL)
2297      rpath = (const char *) getenv ("LD_RUN_PATH");
2298 +  if ((rpath) && (strlen (rpath) == 0))
2299 +      rpath = NULL;
2300    if (! (bfd_elf${ELFSIZE}_size_dynamic_sections
2301          (output_bfd, command_line.soname, rpath,
2302           command_line.filter_shlib,
2303 diff -urN binutils-2.14.90.0.7.orig/ltmain.sh binutils-2.14.90.0.7/ltmain.sh
2304 --- binutils-2.14.90.0.7.orig/ltmain.sh 2002-03-22 15:06:16.000000000 -0700
2305 +++ binutils-2.14.90.0.7/ltmain.sh      2004-04-20 01:26:12.000000000 -0600
2306 @@ -4413,6 +4413,10 @@
2307        # LD_LIBRARY_PATH before the program is installed.
2308        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
2309        $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
2310 +      if test -n "$linkname"; then
2311 +        $show "(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)"
2312 +        $run eval '(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)' || exit $?
2313 +      fi
2314        ;;
2315      esac
2316      exit 0
2317 diff -urN binutils-2.14.90.0.7.orig/opcodes/Makefile.am binutils-2.14.90.0.7/opcodes/Makefile.am
2318 --- binutils-2.14.90.0.7.orig/opcodes/Makefile.am       2003-10-29 10:37:49.000000000 -0700
2319 +++ binutils-2.14.90.0.7/opcodes/Makefile.am    2004-04-20 01:26:12.000000000 -0600
2320 @@ -284,7 +284,7 @@
2321  
2322  libopcodes_la_SOURCES =  dis-buf.c disassemble.c dis-init.c
2323  libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la
2324 -libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la
2325 +libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd
2326  libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
2327  
2328  # libtool will build .libs/libopcodes.a.  We create libopcodes.a in
2329 diff -urN binutils-2.14.90.0.7.orig/opcodes/Makefile.in binutils-2.14.90.0.7/opcodes/Makefile.in
2330 --- binutils-2.14.90.0.7.orig/opcodes/Makefile.in       2003-10-29 10:37:49.000000000 -0700
2331 +++ binutils-2.14.90.0.7/opcodes/Makefile.in    2004-04-20 01:26:12.000000000 -0600
2332 @@ -394,7 +394,7 @@
2333  
2334  libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
2335  libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la
2336 -libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la
2337 +libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd
2338  libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
2339  
2340  # libtool will build .libs/libopcodes.a.  We create libopcodes.a in
2341 @@ -593,7 +593,7 @@
2342  all-recursive install-data-recursive install-exec-recursive \
2343  installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
2344  check-recursive installcheck-recursive info-recursive dvi-recursive:
2345 -       @set fnord $(MAKEFLAGS); amf=$$2; \
2346 +       @set fnord $$MAKEFLAGS; amf=$$2; \
2347         dot_seen=no; \
2348         target=`echo $@ | sed s/-recursive//`; \
2349         list='$(SUBDIRS)'; for subdir in $$list; do \
2350 @@ -613,7 +613,7 @@
2351  
2352  mostlyclean-recursive clean-recursive distclean-recursive \
2353  maintainer-clean-recursive:
2354 -       @set fnord $(MAKEFLAGS); amf=$$2; \
2355 +       @set fnord $$MAKEFLAGS; amf=$$2; \
2356         dot_seen=no; \
2357         rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
2358           rev="$$subdir $$rev"; \
2359 diff -urN binutils-2.14.90.0.7.orig/opcodes/alpha-opc.c binutils-2.14.90.0.7/opcodes/alpha-opc.c
2360 --- binutils-2.14.90.0.7.orig/opcodes/alpha-opc.c       2003-01-21 11:21:34.000000000 -0700
2361 +++ binutils-2.14.90.0.7/opcodes/alpha-opc.c    2004-04-20 01:26:11.000000000 -0600
2362 @@ -1105,7 +1105,8 @@
2363    { "wmb",             MFC(0x18,0x4400), BASE, ARG_NONE },
2364    { "fetch",           MFC(0x18,0x8000), BASE, { ZA, PRB } },
2365    { "fetch_m",         MFC(0x18,0xA000), BASE, { ZA, PRB } },
2366 -  { "rpcc",            MFC(0x18,0xC000), BASE, { RA } },
2367 +  { "rpcc",            MFC(0x18,0xC000), BASE, { RA, ZB } },
2368 +  { "rpcc",            MFC(0x18,0xC000), BASE, { RA, RB } },   /* ev6 una */
2369    { "rc",              MFC(0x18,0xE000), BASE, { RA } },
2370    { "ecb",             MFC(0x18,0xE800), BASE, { ZA, PRB } },  /* ev56 una */
2371    { "rs",              MFC(0x18,0xF000), BASE, { RA } },
2372 diff -urN binutils-2.14.90.0.7.orig/opcodes/m68k-opc.c binutils-2.14.90.0.7/opcodes/m68k-opc.c
2373 --- binutils-2.14.90.0.7.orig/opcodes/m68k-opc.c        2003-10-29 10:37:49.000000000 -0700
2374 +++ binutils-2.14.90.0.7/opcodes/m68k-opc.c     2004-04-20 01:26:12.000000000 -0600
2375 @@ -847,15 +847,15 @@
2376  {"fmoved",     two(0xF000, 0x7400), two(0xF1C0, 0xFC7F), "IiF7ws", cfloat },
2377  {"fmovel",     two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "Ii;lF7", mfloat },
2378  {"fmovel",     two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7$l", mfloat },
2379 +/* FIXME: the next two variants should not permit moving an address
2380 +   register to anything but the floating point instruction register.  */
2381 +{"fmovel",     two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat },
2382 +{"fmovel",     two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8", mfloat },
2383  {"fmovel",     two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "IibsF7", cfloat },
2384  {"fmovel",     two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7bs", cfloat },
2385    /* Move the FP control registers */
2386  {"fmovel",     two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8ps", cfloat },
2387  {"fmovel",     two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Iibss8", cfloat },
2388 -/* FIXME: the next two variants should not permit moving an address
2389 -   register to anything but the floating point instruction register.  */
2390 -{"fmovel",     two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8%s", mfloat },
2391 -{"fmovel",     two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8", mfloat },
2392  {"fmovep",     two(0xF000, 0x4C00), two(0xF1C0, 0xFC7F), "Ii;pF7", mfloat },
2393  {"fmovep",     two(0xF000, 0x6C00), two(0xF1C0, 0xFC00), "IiF7~pkC", mfloat },
2394  {"fmovep",     two(0xF000, 0x7C00), two(0xF1C0, 0xFC0F), "IiF7~pDk", mfloat },