ð
[platform/upstream/binutils.git] / bfd / elf32-hppa.c
1 /* BFD back-end for HP PA-RISC ELF files.
2    Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
3    Free Software Foundation, Inc.
4
5    Written by
6
7         Center for Software Science
8         Department of Computer Science
9         University of Utah
10
11 This file is part of BFD, the Binary File Descriptor library.
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
26
27 #include "bfd.h"
28 #include "sysdep.h"
29 #include "libbfd.h"
30 #include "elf-bfd.h"
31 #include "elf/hppa.h"
32 #include "libhppa.h"
33 #include "elf32-hppa.h"
34 #define ARCH_SIZE               32
35 #include "elf-hppa.h"
36
37
38 /* We use three different hash tables to hold information for
39    linking PA ELF objects.
40
41    The first is the elf32_hppa_link_hash_table which is derived
42    from the standard ELF linker hash table.  We use this as a place to
43    attach other hash tables and static information.
44
45    The second is the stub hash table which is derived from the
46    base BFD hash table.  The stub hash table holds the information
47    necessary to build the linker stubs during a link.  */
48
49 /* Hash table for linker stubs.  */
50
51 struct elf32_hppa_stub_hash_entry
52 {
53   /* Base hash table entry structure, we can get the name of the stub
54      (and thus know exactly what actions it performs) from the base
55      hash table entry.  */
56   struct bfd_hash_entry root;
57
58   /* Offset of the beginning of this stub.  */
59   bfd_vma offset;
60
61   /* Given the symbol's value and its section we can determine its final
62      value when building the stubs (so the stub knows where to jump.  */
63   symvalue target_value;
64   asection *target_section;
65 };
66
67 struct elf32_hppa_stub_hash_table
68 {
69   /* The hash table itself.  */
70   struct bfd_hash_table root;
71
72   /* The stub BFD.  */
73   bfd *stub_bfd;
74
75   /* Where to place the next stub.  */
76   bfd_byte *location;
77
78   /* Current offset in the stub section.  */
79   unsigned int offset;
80
81 };
82
83 struct elf32_hppa_link_hash_entry
84 {
85   struct elf_link_hash_entry root;
86 };
87
88 struct elf32_hppa_link_hash_table
89 {
90   /* The main hash table.  */
91   struct elf_link_hash_table root;
92
93   /* The stub hash table.  */
94   struct elf32_hppa_stub_hash_table *stub_hash_table;
95
96   /* A count of the number of output symbols.  */
97   unsigned int output_symbol_count;
98
99   /* Stuff so we can handle DP relative relocations.  */
100   long global_value;
101   int global_sym_defined;
102 };
103
104 /* ELF32/HPPA relocation support
105
106         This file contains ELF32/HPPA relocation support as specified
107         in the Stratus FTX/Golf Object File Format (SED-1762) dated
108         February 1994.  */
109
110 #include "elf32-hppa.h"
111 #include "hppa_stubs.h"
112
113 static bfd_reloc_status_type hppa_elf_reloc
114   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
115
116 static unsigned long hppa_elf_relocate_insn
117   PARAMS ((bfd *, asection *, unsigned long, unsigned long, long,
118            long, unsigned long, unsigned long, unsigned long));
119
120 static bfd_reloc_status_type hppa_elf_reloc
121   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd*, char **));
122
123 static boolean hppa_elf_is_local_label_name PARAMS ((bfd *, const char *));
124
125 static boolean elf32_hppa_add_symbol_hook
126   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
127            const char **, flagword *, asection **, bfd_vma *));
128
129 static bfd_reloc_status_type elf32_hppa_bfd_final_link_relocate
130   PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *,
131            bfd_byte *, bfd_vma, bfd_vma, bfd_vma, struct bfd_link_info *,
132            asection *, const char *, int));
133
134 static struct bfd_link_hash_table *elf32_hppa_link_hash_table_create
135   PARAMS ((bfd *));
136
137 static struct bfd_hash_entry *
138 elf32_hppa_stub_hash_newfunc
139   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
140
141 static boolean
142 elf32_hppa_relocate_section
143   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
144            bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
145
146 static boolean
147 elf32_hppa_stub_hash_table_init
148   PARAMS ((struct elf32_hppa_stub_hash_table *, bfd *,
149            struct bfd_hash_entry *(*) PARAMS ((struct bfd_hash_entry *,
150                                                struct bfd_hash_table *,
151                                                const char *))));
152
153 static boolean
154 elf32_hppa_build_one_stub PARAMS ((struct bfd_hash_entry *, PTR));
155
156 static unsigned int elf32_hppa_size_of_stub
157   PARAMS ((bfd_vma, bfd_vma, const char *));
158
159 static void elf32_hppa_name_of_stub
160   PARAMS ((bfd_vma, bfd_vma, char *));
161
162 /* For linker stub hash tables.  */
163 #define elf32_hppa_stub_hash_lookup(table, string, create, copy) \
164   ((struct elf32_hppa_stub_hash_entry *) \
165    bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
166
167 #define elf32_hppa_stub_hash_traverse(table, func, info) \
168   (bfd_hash_traverse \
169    (&(table)->root, \
170     (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \
171     (info)))
172
173 /* For HPPA linker hash table.  */
174
175 #define elf32_hppa_link_hash_lookup(table, string, create, copy, follow)\
176   ((struct elf32_hppa_link_hash_entry *)                                \
177    elf_link_hash_lookup (&(table)->root, (string), (create),            \
178                          (copy), (follow)))
179
180 #define elf32_hppa_link_hash_traverse(table, func, info)                \
181   (elf_link_hash_traverse                                               \
182    (&(table)->root,                                                     \
183     (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),  \
184     (info)))
185
186 /* Get the PA ELF linker hash table from a link_info structure.  */
187
188 #define elf32_hppa_hash_table(p) \
189   ((struct elf32_hppa_link_hash_table *) ((p)->hash))
190
191
192 /* Assorted hash table functions.  */
193
194 /* Initialize an entry in the stub hash table.  */
195
196 static struct bfd_hash_entry *
197 elf32_hppa_stub_hash_newfunc (entry, table, string)
198      struct bfd_hash_entry *entry;
199      struct bfd_hash_table *table;
200      const char *string;
201 {
202   struct elf32_hppa_stub_hash_entry *ret;
203
204   ret = (struct elf32_hppa_stub_hash_entry *) entry;
205
206   /* Allocate the structure if it has not already been allocated by a
207      subclass.  */
208   if (ret == NULL)
209     ret = ((struct elf32_hppa_stub_hash_entry *)
210            bfd_hash_allocate (table,
211                               sizeof (struct elf32_hppa_stub_hash_entry)));
212   if (ret == NULL)
213     return NULL;
214
215   /* Call the allocation method of the superclass.  */
216   ret = ((struct elf32_hppa_stub_hash_entry *)
217          bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
218
219   if (ret)
220     {
221       /* Initialize the local fields.  */
222       ret->offset = 0;
223       ret->target_value = 0;
224       ret->target_section = NULL;
225     }
226
227   return (struct bfd_hash_entry *) ret;
228 }
229
230 /* Initialize a stub hash table.  */
231
232 static boolean
233 elf32_hppa_stub_hash_table_init (table, stub_bfd, newfunc)
234      struct elf32_hppa_stub_hash_table *table;
235      bfd *stub_bfd;
236      struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
237                                                 struct bfd_hash_table *,
238                                                 const char *));
239 {
240   table->offset = 0;
241   table->location = 0;
242   table->stub_bfd = stub_bfd;
243   return (bfd_hash_table_init (&table->root, newfunc));
244 }
245
246 /* Create the derived linker hash table.  The PA ELF port uses the derived
247    hash table to keep information specific to the PA ELF linker (without
248    using static variables).  */
249
250 static struct bfd_link_hash_table *
251 elf32_hppa_link_hash_table_create (abfd)
252      bfd *abfd;
253 {
254   struct elf32_hppa_link_hash_table *ret;
255
256   ret = ((struct elf32_hppa_link_hash_table *)
257          bfd_alloc (abfd, sizeof (struct elf32_hppa_link_hash_table)));
258   if (ret == NULL)
259     return NULL;
260   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
261                                       _bfd_elf_link_hash_newfunc))
262     {
263       bfd_release (abfd, ret);
264       return NULL;
265     }
266   ret->stub_hash_table = NULL;
267   ret->output_symbol_count = 0;
268   ret->global_value = 0;
269   ret->global_sym_defined = 0;
270
271   return &ret->root.root;
272 }
273
274 /* Relocate the given INSN given the various input parameters.
275
276    FIXME: endianness and sizeof (long) issues abound here.  */
277
278 static unsigned long
279 hppa_elf_relocate_insn (abfd, input_sect, insn, address, sym_value,
280                         r_addend, r_format, r_field, pcrel)
281      bfd *abfd;
282      asection *input_sect;
283      unsigned long insn;
284      unsigned long address;
285      long sym_value;
286      long r_addend;
287      unsigned long r_format;
288      unsigned long r_field;
289      unsigned long pcrel;
290 {
291   unsigned char opcode = get_opcode (insn);
292   long constant_value;
293
294   switch (opcode)
295     {
296     case LDO:
297     case LDB:
298     case LDH:
299     case LDW:
300     case LDWM:
301     case STB:
302     case STH:
303     case STW:
304     case STWM:
305     case COMICLR:
306     case SUBI:
307     case ADDIT:
308     case ADDI:
309     case LDIL:
310     case ADDIL:
311       constant_value = HPPA_R_CONSTANT (r_addend);
312
313       if (pcrel)
314         sym_value -= address;
315
316       sym_value = hppa_field_adjust (sym_value, constant_value, r_field);
317       return hppa_rebuild_insn (abfd, insn, sym_value, r_format);
318
319     case BL:
320     case BE:
321     case BLE:
322       /* XXX computing constant_value is not needed??? */
323       constant_value = assemble_17 ((insn & 0x001f0000) >> 16,
324                                     (insn & 0x00001ffc) >> 2,
325                                     insn & 1);
326
327       constant_value = (constant_value << 15) >> 15;
328       if (pcrel)
329         {
330           sym_value -=
331             address + input_sect->output_offset
332             + input_sect->output_section->vma;
333           sym_value = hppa_field_adjust (sym_value, -8, r_field);
334         }
335       else
336         sym_value = hppa_field_adjust (sym_value, constant_value, r_field);
337
338       return hppa_rebuild_insn (abfd, insn, sym_value >> 2, r_format);
339
340     default:
341       if (opcode == 0)
342         {
343           constant_value = HPPA_R_CONSTANT (r_addend);
344
345           if (pcrel)
346             sym_value -= address;
347
348           return hppa_field_adjust (sym_value, constant_value, r_field);
349         }
350       else
351         abort ();
352     }
353 }
354
355 /* Relocate an HPPA ELF section.  */
356
357 static boolean
358 elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
359                              contents, relocs, local_syms, local_sections)
360      bfd *output_bfd;
361      struct bfd_link_info *info;
362      bfd *input_bfd;
363      asection *input_section;
364      bfd_byte *contents;
365      Elf_Internal_Rela *relocs;
366      Elf_Internal_Sym *local_syms;
367      asection **local_sections;
368 {
369   Elf_Internal_Shdr *symtab_hdr;
370   Elf_Internal_Rela *rel;
371   Elf_Internal_Rela *relend;
372
373   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
374
375   rel = relocs;
376   relend = relocs + input_section->reloc_count;
377   for (; rel < relend; rel++)
378     {
379       int r_type;
380       reloc_howto_type *howto;
381       unsigned long r_symndx;
382       struct elf_link_hash_entry *h;
383       Elf_Internal_Sym *sym;
384       asection *sym_sec;
385       bfd_vma relocation;
386       bfd_reloc_status_type r;
387       const char *sym_name;
388
389       r_type = ELF32_R_TYPE (rel->r_info);
390       if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
391         {
392           bfd_set_error (bfd_error_bad_value);
393           return false;
394         }
395       howto = elf_hppa_howto_table + r_type;
396
397       r_symndx = ELF32_R_SYM (rel->r_info);
398
399       if (info->relocateable)
400         {
401           /* This is a relocateable link.  We don't have to change
402              anything, unless the reloc is against a section symbol,
403              in which case we have to adjust according to where the
404              section symbol winds up in the output section.  */
405           if (r_symndx < symtab_hdr->sh_info)
406             {
407               sym = local_syms + r_symndx;
408               if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
409                 {
410                   sym_sec = local_sections[r_symndx];
411                   rel->r_addend += sym_sec->output_offset;
412                 }
413             }
414
415           continue;
416         }
417
418       /* This is a final link.  */
419       h = NULL;
420       sym = NULL;
421       sym_sec = NULL;
422       if (r_symndx < symtab_hdr->sh_info)
423         {
424           sym = local_syms + r_symndx;
425           sym_sec = local_sections[r_symndx];
426           relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
427                            ? 0 : sym->st_value)
428                          + sym_sec->output_offset
429                          + sym_sec->output_section->vma);
430         }
431       else
432         {
433           long indx;
434
435           indx = r_symndx - symtab_hdr->sh_info;
436           h = elf_sym_hashes (input_bfd)[indx];
437           while (h->root.type == bfd_link_hash_indirect
438                  || h->root.type == bfd_link_hash_warning)
439             h = (struct elf_link_hash_entry *) h->root.u.i.link;
440           if (h->root.type == bfd_link_hash_defined
441               || h->root.type == bfd_link_hash_defweak)
442             {
443               sym_sec = h->root.u.def.section;
444               relocation = (h->root.u.def.value
445                             + sym_sec->output_offset
446                             + sym_sec->output_section->vma);
447             }
448           else if (h->root.type == bfd_link_hash_undefweak)
449             relocation = 0;
450           else
451             {
452               if (!((*info->callbacks->undefined_symbol)
453                     (info, h->root.root.string, input_bfd,
454                      input_section, rel->r_offset)))
455                 return false;
456               break;
457             }
458         }
459
460       if (h != NULL)
461         sym_name = h->root.root.string;
462       else
463         {
464           sym_name = bfd_elf_string_from_elf_section (input_bfd,
465                                                       symtab_hdr->sh_link,
466                                                       sym->st_name);
467           if (sym_name == NULL)
468             return false;
469           if (*sym_name == '\0')
470             sym_name = bfd_section_name (input_bfd, sym_sec);
471         }
472
473       r = elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd,
474                                               input_section, contents,
475                                               rel->r_offset, relocation,
476                                               rel->r_addend, info, sym_sec,
477                                               sym_name, h == NULL);
478
479       if (r != bfd_reloc_ok)
480         {
481           switch (r)
482             {
483             /* This can happen for DP relative relocs if $global$ is
484                undefined.  This is a panic situation so we don't try
485                to continue.  */
486             case bfd_reloc_undefined:
487             case bfd_reloc_notsupported:
488               if (!((*info->callbacks->undefined_symbol)
489                     (info, "$global$", input_bfd,
490                      input_section, rel->r_offset)))
491                 return false;
492               return false;
493             case bfd_reloc_dangerous:
494               {
495                 /* We use this return value to indicate that we performed
496                    a "dangerous" relocation.  This doesn't mean we did
497                    the wrong thing, it just means there may be some cleanup
498                    that needs to be done here.
499
500                    In particular we had to swap the last call insn and its
501                    delay slot.  If the delay slot insn needed a relocation,
502                    then we'll need to adjust the next relocation entry's
503                    offset to account for the fact that the insn moved.
504
505                    This hair wouldn't be necessary if we inserted stubs
506                    between procedures and used a "bl" to get to the stub.  */
507                 if (rel != relend)
508                   {
509                     Elf_Internal_Rela *next_rel = rel + 1;
510
511                     if (rel->r_offset + 4 == next_rel->r_offset)
512                       next_rel->r_offset -= 4;
513                   }
514                 break;
515               }
516             default:
517             case bfd_reloc_outofrange:
518             case bfd_reloc_overflow:
519               {
520                 if (!((*info->callbacks->reloc_overflow)
521                       (info, sym_name, howto->name, (bfd_vma) 0,
522                         input_bfd, input_section, rel->r_offset)))
523                   return false;
524               }
525               break;
526             }
527         }
528     }
529
530   return true;
531 }
532
533 /* Actually perform a relocation.  NOTE this is (mostly) superceeded
534    by elf32_hppa_bfd_final_link_relocate which is called by the new
535    fast linker.  */
536
537 static bfd_reloc_status_type
538 hppa_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
539                 error_message)
540      bfd *abfd;
541      arelent *reloc_entry;
542      asymbol *symbol_in;
543      PTR data;
544      asection *input_section;
545      bfd *output_bfd;
546      char **error_message;
547 {
548   /* It is no longer valid to call hppa_elf_reloc when creating
549      a final executable.  */
550   if (output_bfd)
551     {
552       reloc_entry->address += input_section->output_offset;
553
554       /* Work around lossage in generic elf code to write relocations.
555          (maps different section symbols into the same symbol index).  */
556       if ((symbol_in->flags & BSF_SECTION_SYM)
557           && symbol_in->section)
558         reloc_entry->addend += symbol_in->section->output_offset;
559       return bfd_reloc_ok;
560     }
561   else
562     {
563       *error_message = (char *) _("Unsupported call to hppa_elf_reloc");
564       return bfd_reloc_notsupported;
565     }
566 }
567
568 /* Actually perform a relocation as part of a final link.  This can get
569    rather hairy when linker stubs are needed.  */
570
571 static bfd_reloc_status_type
572 elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd,
573                                     input_section, contents, offset, value,
574                                     addend, info, sym_sec, sym_name, is_local)
575      reloc_howto_type *howto;
576      bfd *input_bfd;
577      bfd *output_bfd;
578      asection *input_section;
579      bfd_byte *contents;
580      bfd_vma offset;
581      bfd_vma value;
582      bfd_vma addend;
583      struct bfd_link_info *info;
584      asection *sym_sec;
585      const char *sym_name;
586      int is_local;
587 {
588   unsigned long insn;
589   unsigned long r_type = howto->type;
590   unsigned long r_format = howto->bitsize;
591   unsigned long r_field = e_fsel;
592   bfd_byte *hit_data = contents + offset;
593   boolean r_pcrel = howto->pc_relative;
594
595   insn = bfd_get_32 (input_bfd, hit_data);
596
597   /* Make sure we have a value for $global$.  FIXME isn't this effectively
598      just like the gp pointer on MIPS?  Can we use those routines for this
599      purpose?  */
600   if (!elf32_hppa_hash_table (info)->global_sym_defined)
601     {
602       struct elf_link_hash_entry *h;
603       asection *sec;
604
605       h = elf_link_hash_lookup (elf_hash_table (info), "$global$", false,
606                                  false, false);
607
608       /* If there isn't a $global$, then we're in deep trouble.  */
609       if (h == NULL)
610         return bfd_reloc_notsupported;
611
612       /* If $global$ isn't a defined symbol, then we're still in deep
613          trouble.  */
614       if (h->root.type != bfd_link_hash_defined)
615         return bfd_reloc_undefined;
616
617       sec = h->root.u.def.section;
618       elf32_hppa_hash_table (info)->global_value = (h->root.u.def.value
619                                                     + sec->output_section->vma
620                                                     + sec->output_offset);
621       elf32_hppa_hash_table (info)->global_sym_defined = 1;
622     }
623
624   switch (r_type)
625     {
626     case R_PARISC_NONE:
627       break;
628
629     case R_PARISC_DIR32:
630     case R_PARISC_DIR17F:
631     case R_PARISC_PCREL17C:
632       r_field = e_fsel;
633       goto do_basic_type_1;
634     case R_PARISC_DIR21L:
635     case R_PARISC_PCREL21L:
636       r_field = e_lrsel;
637       goto do_basic_type_1;
638     case R_PARISC_DIR17R:
639     case R_PARISC_PCREL17R:
640     case R_PARISC_DIR14R:
641     case R_PARISC_PCREL14R:
642       r_field = e_rrsel;
643       goto do_basic_type_1;
644
645     /* For all the DP relative relocations, we need to examine the symbol's
646        section.  If it's a code section, then "data pointer relative" makes
647        no sense.  In that case we don't adjust the "value", and for 21 bit
648        addil instructions, we change the source addend register from %dp to
649        %r0.  */
650     case R_PARISC_DPREL21L:
651       r_field = e_lrsel;
652       if (sym_sec->flags & SEC_CODE)
653         {
654           if ((insn & 0xfc000000) >> 26 == 0xa
655                && (insn & 0x03e00000) >> 21 == 0x1b)
656             insn &= ~0x03e00000;
657         }
658       else
659         value -= elf32_hppa_hash_table (info)->global_value;
660       goto do_basic_type_1;
661     case R_PARISC_DPREL14R:
662       r_field = e_rrsel;
663       if ((sym_sec->flags & SEC_CODE) == 0)
664         value -= elf32_hppa_hash_table (info)->global_value;
665       goto do_basic_type_1;
666     case R_PARISC_DPREL14F:
667       r_field = e_fsel;
668       if ((sym_sec->flags & SEC_CODE) == 0)
669         value -= elf32_hppa_hash_table (info)->global_value;
670       goto do_basic_type_1;
671
672     /* These cases are separate as they may involve a lot more work
673        to deal with linker stubs.  */
674     case R_PARISC_PLABEL32:
675     case R_PARISC_PLABEL21L:
676     case R_PARISC_PLABEL14R:
677     case R_PARISC_PCREL17F:
678       {
679         bfd_vma location;
680         unsigned int len, caller_args, callee_args;
681         char *new_name, *stub_name;
682
683         /* Get the field selector right.  We'll need it in a minute.  */
684         if (r_type == R_PARISC_PCREL17F
685             || r_type == R_PARISC_PLABEL32)
686           r_field = e_fsel;
687         else if (r_type == R_PARISC_PLABEL21L)
688           r_field = e_lrsel;
689         else if (r_type == R_PARISC_PLABEL14R)
690           r_field = e_rrsel;
691
692         /* Find out where we are and where we're going.  */
693         location = (offset +
694                     input_section->output_offset +
695                     input_section->output_section->vma);
696
697         len = strlen (sym_name) + 1;
698         if (is_local)
699           len += 9;
700         new_name = bfd_malloc (len);
701         if (!new_name)
702           return bfd_reloc_notsupported;
703         strcpy (new_name, sym_name);
704
705         /* Local symbols have unique IDs.  */
706         if (is_local)
707           sprintf (new_name + len - 10, "_%08x", (int)sym_sec);
708
709         /* Any kind of linker stub needed?  */
710         if (((int)(value - location) > 0x3ffff)
711             || ((int)(value - location) < (int)0xfffc0000))
712           {
713             struct elf32_hppa_stub_hash_table *stub_hash_table;
714             struct elf32_hppa_stub_hash_entry *stub_hash;
715             asection *stub_section;
716
717             /* Build a name for the stub.  */
718
719             len = strlen (new_name);
720             len += 23;
721             stub_name = bfd_malloc (len);
722             if (!stub_name)
723               return bfd_reloc_notsupported;
724             elf32_hppa_name_of_stub (location, value, stub_name);
725             strcat (stub_name, new_name);
726             free (new_name);
727
728             stub_hash_table = elf32_hppa_hash_table (info)->stub_hash_table;
729
730             stub_hash
731               = elf32_hppa_stub_hash_lookup (stub_hash_table, stub_name,
732                                              false, false);
733
734             /* We're done with that name.  */
735             free (stub_name);
736
737             /* The stub BFD only has one section.  */
738             stub_section = stub_hash_table->stub_bfd->sections;
739
740             if (stub_hash != NULL)
741               {
742                 if (r_type == R_PARISC_PCREL17F)
743                   {
744                     unsigned long delay_insn;
745                     unsigned int opcode, rtn_reg, ldo_target_reg, ldo_src_reg;
746
747                     /* We'll need to peek at the next insn.  */
748                     delay_insn = bfd_get_32 (input_bfd, hit_data + 4);
749                     opcode = get_opcode (delay_insn);
750
751                     /* We also need to know the return register for this
752                        call.  */
753                     rtn_reg = (insn & 0x03e00000) >> 21;
754
755                     ldo_src_reg = (delay_insn & 0x03e00000) >> 21;
756                     ldo_target_reg = (delay_insn & 0x001f0000) >> 16;
757
758                     /* Munge up the value and other parameters for
759                        hppa_elf_relocate_insn.  */
760
761                     value = (stub_hash->offset
762                              + stub_section->output_offset
763                              + stub_section->output_section->vma);
764
765                     r_format = 17;
766                     r_field = e_fsel;
767                     r_pcrel = 0;
768                     addend = 0;
769
770                     /* We need to peek at the delay insn and determine if
771                        we'll need to swap the branch and its delay insn.  */
772                     if ((insn & 2)
773                         || (opcode == LDO
774                             && ldo_target_reg == rtn_reg)
775                         || (delay_insn == 0x08000240))
776                       {
777                         /* No need to swap the branch and its delay slot, but
778                            we do need to make sure to jump past the return
779                            pointer update in the stub.  */
780                         value += 4;
781
782                         /* If the delay insn does a return pointer adjustment,
783                            then we have to make sure it stays valid.  */
784                         if (opcode == LDO
785                             && ldo_target_reg == rtn_reg)
786                           {
787                             delay_insn &= 0xfc00ffff;
788                             delay_insn |= ((31 << 21) | (31 << 16));
789                             bfd_put_32 (input_bfd, delay_insn, hit_data + 4);
790                           }
791                         /* Use a BLE to reach the stub.  */
792                         insn = BLE_SR4_R0;
793                       }
794                     else
795                       {
796                         /* Wonderful, we have to swap the call insn and its
797                            delay slot.  */
798                         bfd_put_32 (input_bfd, delay_insn, hit_data);
799                         /* Use a BLE,n to reach the stub.  */
800                         insn = (BLE_SR4_R0 | 0x2);
801                         bfd_put_32 (input_bfd, insn, hit_data + 4);
802                         insn = hppa_elf_relocate_insn (input_bfd,
803                                                        input_section,
804                                                        insn, offset + 4,
805                                                        value, addend,
806                                                        r_format, r_field,
807                                                        r_pcrel);
808                         /* Update the instruction word.  */
809                         bfd_put_32 (input_bfd, insn, hit_data + 4);
810                         return bfd_reloc_dangerous;
811                       }
812                   }
813                 else
814                   return bfd_reloc_notsupported;
815               }
816           }
817         goto do_basic_type_1;
818       }
819
820 do_basic_type_1:
821       insn = hppa_elf_relocate_insn (input_bfd, input_section, insn,
822                                      offset, value, addend, r_format,
823                                      r_field, r_pcrel);
824       break;
825
826     /* Something we don't know how to handle.  */
827     default:
828       return bfd_reloc_notsupported;
829     }
830
831   /* Update the instruction word.  */
832   bfd_put_32 (input_bfd, insn, hit_data);
833   return (bfd_reloc_ok);
834 }
835
836 /* Return true if SYM represents a local label symbol.  */
837
838 static boolean
839 hppa_elf_is_local_label_name (abfd, name)
840      bfd *abfd;
841      const char *name;
842 {
843   return (name[0] == 'L' && name[1] == '$');
844 }
845
846 /* Undo the generic ELF code's subtraction of section->vma from the
847    value of each external symbol.  */
848
849 static boolean
850 elf32_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
851      bfd *abfd;
852      struct bfd_link_info *info;
853      const Elf_Internal_Sym *sym;
854      const char **namep;
855      flagword *flagsp;
856      asection **secp;
857      bfd_vma *valp;
858 {
859   *valp += (*secp)->vma;
860   return true;
861 }
862
863 /* Determine the name of the stub needed to perform a call assuming the
864    argument relocation bits for caller and callee are in CALLER and CALLEE
865    for a call from LOCATION to DESTINATION.  Copy the name into STUB_NAME.  */
866
867 static void
868 elf32_hppa_name_of_stub (location, destination, stub_name)
869      bfd_vma location, destination;
870      char *stub_name;
871 {
872   strcpy (stub_name, "_____long_branch_stub_");
873 }
874
875 /* Compute the size of the stub needed to call from LOCATION to DESTINATION
876    (a function named SYM_NAME), with argument relocation bits CALLER and
877    CALLEE.  Return zero if no stub is needed to perform such a call.  */
878
879 static unsigned int
880 elf32_hppa_size_of_stub (location, destination, sym_name)
881      bfd_vma location, destination;
882      const char *sym_name;
883 {
884   /* Determine if a long branch stub is needed.  */
885   if (!(((int)(location - destination) > 0x3ffff)
886         || ((int)(location - destination) < (int)0xfffc0000)))
887     return 0;
888
889   if (!strncmp ("$$", sym_name, 2)
890       && strcmp ("$$dyncall", sym_name))
891     return 12;
892   else
893     return 16;
894 }
895
896 /* Build one linker stub as defined by the stub hash table entry GEN_ENTRY.
897    IN_ARGS contains the stub BFD and link info pointers.  */
898
899 static boolean
900 elf32_hppa_build_one_stub (gen_entry, in_args)
901      struct bfd_hash_entry *gen_entry;
902      PTR in_args;
903 {
904   void **args = (void **)in_args;
905   bfd *stub_bfd = (bfd *)args[0];
906   struct bfd_link_info *info = (struct bfd_link_info *)args[1];
907   struct elf32_hppa_stub_hash_entry *entry;
908   struct elf32_hppa_stub_hash_table *stub_hash_table;
909   bfd_byte *loc;
910   symvalue sym_value;
911   const char *sym_name;
912
913   /* Initialize pointers to the stub hash table, the particular entry we
914      are building a stub for, and where (in memory) we should place the stub
915      instructions.  */
916   entry = (struct elf32_hppa_stub_hash_entry *)gen_entry;
917   stub_hash_table = elf32_hppa_hash_table(info)->stub_hash_table;
918   loc = stub_hash_table->location;
919
920   /* Make a note of the offset within the stubs for this entry.  */
921   entry->offset = stub_hash_table->offset;
922
923   /* The symbol's name starts at offset 22.  */
924   sym_name = entry->root.string + 22;
925
926   sym_value = (entry->target_value
927                + entry->target_section->output_offset
928                + entry->target_section->output_section->vma);
929
930   if (1)
931     {
932       /* Create one of two variant long branch stubs.  One for $$dyncall and
933          normal calls, the other for calls to millicode.  */
934       unsigned long insn;
935       int millicode_call = 0;
936
937       if (!strncmp ("$$", sym_name, 2) && strcmp ("$$dyncall", sym_name))
938         millicode_call = 1;
939
940       /* First the return pointer adjustment.  Depending on exact calling
941          sequence this instruction may be skipped.  */
942       bfd_put_32 (stub_bfd, LDO_M4_R31_R31, loc);
943
944       /* The next two instructions are the long branch itself.  A long branch
945          is formed with "ldil" loading the upper bits of the target address
946          into a register, then branching with "be" which adds in the lower bits.
947          Long branches to millicode nullify the delay slot of the "be".  */
948       insn = hppa_rebuild_insn (stub_bfd, LDIL_R1,
949                                 hppa_field_adjust (sym_value, 0, e_lrsel), 21);
950       bfd_put_32 (stub_bfd, insn, loc + 4);
951       insn = hppa_rebuild_insn (stub_bfd, BE_SR4_R1 | (millicode_call ? 2 : 0),
952                                 hppa_field_adjust (sym_value, 0, e_rrsel) >> 2,
953                                 17);
954       bfd_put_32 (stub_bfd, insn, loc + 8);
955
956       if (!millicode_call)
957         {
958           /* The sequence to call this stub places the return pointer into %r31,
959              the final target expects the return pointer in %r2, so copy the
960               return pointer into the proper register.  */
961           bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 12);
962
963           /* Update the location and offsets.  */
964           stub_hash_table->location += 16;
965           stub_hash_table->offset += 16;
966         }
967       else
968         {
969           /* Update the location and offsets.  */
970           stub_hash_table->location += 12;
971           stub_hash_table->offset += 12;
972         }
973
974     }
975   return true;
976 }
977
978 /* External entry points for sizing and building linker stubs.  */
979
980 /* Build all the stubs associated with the current output file.  The
981    stubs are kept in a hash table attached to the main linker hash
982    table.  This is called via hppaelf_finish in the linker.  */
983
984 boolean
985 elf32_hppa_build_stubs (stub_bfd, info)
986      bfd *stub_bfd;
987      struct bfd_link_info *info;
988 {
989   /* The stub BFD only has one section.  */
990   asection *stub_sec = stub_bfd->sections;
991   struct elf32_hppa_stub_hash_table *table;
992   unsigned int size;
993   void *args[2];
994
995   /* So we can pass both the BFD for the stubs and the link info
996      structure to the routine which actually builds stubs.  */
997   args[0] = stub_bfd;
998   args[1] = info;
999
1000   /* Allocate memory to hold the linker stubs.  */
1001   size = bfd_section_size (stub_bfd, stub_sec);
1002   stub_sec->contents = (unsigned char *) bfd_zalloc (stub_bfd, size);
1003   if (stub_sec->contents == NULL)
1004     return false;
1005   table = elf32_hppa_hash_table(info)->stub_hash_table;
1006   table->location = stub_sec->contents;
1007
1008   /* Build the stubs as directed by the stub hash table.  */
1009   elf32_hppa_stub_hash_traverse (table, elf32_hppa_build_one_stub, args);
1010
1011   return true;
1012 }
1013
1014 /* Determine and set the size of the stub section for a final link.
1015
1016    The basic idea here is to examine all the relocations looking for
1017    PC-relative calls to a target that is unreachable with a "bl"
1018    instruction or calls where the caller and callee disagree on the
1019    location of their arguments or return value.  */
1020
1021 boolean
1022 elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info)
1023      bfd *stub_bfd;
1024      bfd *output_bfd;
1025      struct bfd_link_info *link_info;
1026 {
1027   bfd *input_bfd;
1028   asection *section, *stub_sec = 0;
1029   Elf_Internal_Shdr *symtab_hdr;
1030   Elf_Internal_Sym *local_syms, *isym, **all_local_syms;
1031   Elf32_External_Sym *ext_syms, *esym;
1032   unsigned int i, index, bfd_count = 0;
1033   struct elf32_hppa_stub_hash_table *stub_hash_table = 0;
1034
1035   /* Create and initialize the stub hash table.  */
1036   stub_hash_table = ((struct elf32_hppa_stub_hash_table *)
1037                      bfd_malloc (sizeof (struct elf32_hppa_stub_hash_table)));
1038   if (!stub_hash_table)
1039     goto error_return;
1040
1041   if (!elf32_hppa_stub_hash_table_init (stub_hash_table, stub_bfd,
1042                                         elf32_hppa_stub_hash_newfunc))
1043     goto error_return;
1044
1045   /* Attach the hash tables to the main hash table.  */
1046   elf32_hppa_hash_table(link_info)->stub_hash_table = stub_hash_table;
1047
1048   /* Count the number of input BFDs.  */
1049   for (input_bfd = link_info->input_bfds;
1050        input_bfd != NULL;
1051        input_bfd = input_bfd->link_next)
1052      bfd_count++;
1053
1054   /* Magic as we know the stub bfd only has one section.  */
1055   stub_sec = stub_bfd->sections;
1056
1057   /* If generating a relocateable output file, then we don't
1058      have to examine the relocs.  */
1059   if (link_info->relocateable)
1060     {
1061       for (i = 0; i < bfd_count; i++)
1062         if (all_local_syms[i])
1063           free (all_local_syms[i]);
1064       free (all_local_syms);
1065       return true;
1066     }
1067
1068   /* Now that we have argument location information for all the global
1069      functions we can start looking for stubs.  */
1070   for (input_bfd = link_info->input_bfds, index = 0;
1071        input_bfd != NULL;
1072        input_bfd = input_bfd->link_next, index++)
1073     {
1074       /* We'll need the symbol table in a second.  */
1075       symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1076       if (symtab_hdr->sh_info == 0)
1077         continue;
1078
1079       local_syms = all_local_syms[index];
1080
1081       /* Walk over each section attached to the input bfd.  */
1082       for (section = input_bfd->sections;
1083            section != NULL;
1084            section = section->next)
1085         {
1086           Elf_Internal_Shdr *input_rel_hdr;
1087           Elf32_External_Rela *external_relocs, *erelaend, *erela;
1088           Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
1089
1090           /* If there aren't any relocs, then there's nothing to do.  */
1091           if ((section->flags & SEC_RELOC) == 0
1092               || section->reloc_count == 0)
1093             continue;
1094
1095           /* Allocate space for the external relocations.  */
1096           external_relocs
1097             = ((Elf32_External_Rela *)
1098                bfd_malloc (section->reloc_count
1099                            * sizeof (Elf32_External_Rela)));
1100           if (external_relocs == NULL)
1101             {
1102               for (i = 0; i < bfd_count; i++)
1103                 if (all_local_syms[i])
1104                   free (all_local_syms[i]);
1105               free (all_local_syms);
1106               goto error_return;
1107             }
1108
1109           /* Likewise for the internal relocations.  */
1110           internal_relocs
1111             = ((Elf_Internal_Rela *)
1112                bfd_malloc (section->reloc_count * sizeof (Elf_Internal_Rela)));
1113           if (internal_relocs == NULL)
1114             {
1115               free (external_relocs);
1116               for (i = 0; i < bfd_count; i++)
1117                 if (all_local_syms[i])
1118                   free (all_local_syms[i]);
1119               free (all_local_syms);
1120               goto error_return;
1121             }
1122
1123           /* Read in the external relocs.  */
1124           input_rel_hdr = &elf_section_data (section)->rel_hdr;
1125           if (bfd_seek (input_bfd, input_rel_hdr->sh_offset, SEEK_SET) != 0
1126               || bfd_read (external_relocs, 1, input_rel_hdr->sh_size,
1127                            input_bfd) != input_rel_hdr->sh_size)
1128             {
1129               free (external_relocs);
1130               free (internal_relocs);
1131               for (i = 0; i < bfd_count; i++)
1132                 if (all_local_syms[i])
1133                   free (all_local_syms[i]);
1134               free (all_local_syms);
1135               goto error_return;
1136             }
1137
1138           /* Swap in the relocs.  */
1139           erela = external_relocs;
1140           erelaend = erela + section->reloc_count;
1141           irela = internal_relocs;
1142           for (; erela < erelaend; erela++, irela++)
1143             bfd_elf32_swap_reloca_in (input_bfd, erela, irela);
1144
1145           /* We're done with the external relocs, free them.  */
1146           free (external_relocs);
1147
1148           /* Now examine each relocation.  */
1149           irela = internal_relocs;
1150           irelaend = irela + section->reloc_count;
1151           for (; irela < irelaend; irela++)
1152             {
1153               long r_type, size_of_stub;
1154               unsigned long r_index;
1155               struct elf_link_hash_entry *hash;
1156               struct elf32_hppa_stub_hash_entry *stub_hash;
1157               Elf_Internal_Sym *sym;
1158               asection *sym_sec;
1159               const char *sym_name;
1160               symvalue sym_value;
1161               bfd_vma location, destination;
1162               char *new_name = NULL;
1163
1164               r_type = ELF32_R_TYPE (irela->r_info);
1165               r_index = ELF32_R_SYM (irela->r_info);
1166
1167               if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
1168                 {
1169                   bfd_set_error (bfd_error_bad_value);
1170                   free (internal_relocs);
1171                   for (i = 0; i < bfd_count; i++)
1172                     if (all_local_syms[i])
1173                       free (all_local_syms[i]);
1174                   free (all_local_syms);
1175                   goto error_return;
1176                 }
1177
1178               /* Only look for stubs on call instructions or plabel
1179                  references.  */
1180               if (r_type != R_PARISC_PCREL17F
1181                   && r_type != R_PARISC_PLABEL32
1182                   && r_type != R_PARISC_PLABEL21L
1183                   && r_type != R_PARISC_PLABEL14R)
1184                 continue;
1185
1186               /* Now determine the call target, its name, value, section
1187                  and argument relocation bits.  */
1188               hash = NULL;
1189               sym = NULL;
1190               sym_sec = NULL;
1191               if (r_index < symtab_hdr->sh_info)
1192                 {
1193                   /* It's a local symbol.  */
1194                   Elf_Internal_Shdr *hdr;
1195
1196                   sym = local_syms + r_index;
1197                   hdr = elf_elfsections (input_bfd)[sym->st_shndx];
1198                   sym_sec = hdr->bfd_section;
1199                   sym_name = bfd_elf_string_from_elf_section (input_bfd,
1200                                                               symtab_hdr->sh_link,
1201                                                               sym->st_name);
1202                   sym_value = (ELF_ST_TYPE (sym->st_info) == STT_SECTION
1203                                ? 0 : sym->st_value);
1204                   destination = (sym_value
1205                                  + sym_sec->output_offset
1206                                  + sym_sec->output_section->vma);
1207
1208                   /* Tack on an ID so we can uniquely identify this local
1209                      symbol in the stub or arg info hash tables.  */
1210                   new_name = bfd_malloc (strlen (sym_name) + 10);
1211                   if (new_name == 0)
1212                     {
1213                       free (internal_relocs);
1214                       for (i = 0; i < bfd_count; i++)
1215                         if (all_local_syms[i])
1216                           free (all_local_syms[i]);
1217                       free (all_local_syms);
1218                       goto error_return;
1219                     }
1220                   sprintf (new_name, "%s_%08x", sym_name, (int)sym_sec);
1221                   sym_name = new_name;
1222                 }
1223               else
1224                 {
1225                   /* It's an external symbol.  */
1226                   long index;
1227
1228                   index = r_index - symtab_hdr->sh_info;
1229                   hash = elf_sym_hashes (input_bfd)[index];
1230                   if (hash->root.type == bfd_link_hash_defined
1231                       || hash->root.type == bfd_link_hash_defweak)
1232                     {
1233                       sym_sec = hash->root.u.def.section;
1234                       sym_name = hash->root.root.string;
1235                       sym_value = hash->root.u.def.value;
1236                       destination = (sym_value
1237                                      + sym_sec->output_offset
1238                                      + sym_sec->output_section->vma);
1239                     }
1240                   else
1241                     {
1242                       bfd_set_error (bfd_error_bad_value);
1243                       free (internal_relocs);
1244                       for (i = 0; i < bfd_count; i++)
1245                         if (all_local_syms[i])
1246                           free (all_local_syms[i]);
1247                       free (all_local_syms);
1248                       goto error_return;
1249                     }
1250                 }
1251
1252               /* Now determine where the call point is.  */
1253               location = (section->output_offset
1254                           + section->output_section->vma
1255                           + irela->r_offset);
1256
1257               /* We only care about the destination for PCREL function
1258                  calls (eg. we don't care for PLABELS).  */
1259               if (r_type != R_PARISC_PCREL17F)
1260                 location = destination;
1261
1262               /* Determine what (if any) linker stub is needed and its
1263                  size (in bytes).  */
1264               size_of_stub = elf32_hppa_size_of_stub (location,
1265                                                       destination,
1266                                                       sym_name);
1267               if (size_of_stub != 0)
1268                 {
1269                   char *stub_name;
1270                   unsigned int len;
1271
1272                   /* Get the name of this stub.  */
1273                   len = strlen (sym_name);
1274                   len += 23;
1275
1276                   stub_name = bfd_malloc (len);
1277                   if (!stub_name)
1278                     {
1279                       /* Because sym_name was mallocd above for local
1280                          symbols.  */
1281                       if (r_index < symtab_hdr->sh_info)
1282                         free (new_name);
1283
1284                       free (internal_relocs);
1285                       for (i = 0; i < bfd_count; i++)
1286                         if (all_local_syms[i])
1287                           free (all_local_syms[i]);
1288                       free (all_local_syms);
1289                       goto error_return;
1290                     }
1291                   elf32_hppa_name_of_stub (location, destination, stub_name);
1292                   strcat (stub_name + 22, sym_name);
1293
1294                   /* Because sym_name was malloced above for local symbols.  */
1295                   if (r_index < symtab_hdr->sh_info)
1296                     free (new_name);
1297
1298                   stub_hash
1299                     = elf32_hppa_stub_hash_lookup (stub_hash_table, stub_name,
1300                                                    false, false);
1301                   if (stub_hash != NULL)
1302                     {
1303                       /* The proper stub has already been created, nothing
1304                          else to do.  */
1305                       free (stub_name);
1306                     }
1307                   else
1308                     {
1309                       bfd_set_section_size (stub_bfd, stub_sec,
1310                                             (bfd_section_size (stub_bfd,
1311                                                                stub_sec)
1312                                              + size_of_stub));
1313
1314                       /* Enter this entry into the linker stub hash table.  */
1315                       stub_hash
1316                         = elf32_hppa_stub_hash_lookup (stub_hash_table,
1317                                                        stub_name, true, true);
1318                       if (stub_hash == NULL)
1319                         {
1320                           free (stub_name);
1321                           free (internal_relocs);
1322                           for (i = 0; i < bfd_count; i++)
1323                             if (all_local_syms[i])
1324                               free (all_local_syms[i]);
1325                           free (all_local_syms);
1326                           goto error_return;
1327                         }
1328
1329                       /* We'll need these to determine the address that the
1330                          stub will branch to.  */
1331                       stub_hash->target_value = sym_value;
1332                       stub_hash->target_section = sym_sec;
1333                     }
1334                   free (stub_name);
1335                 }
1336             }
1337           /* We're done with the internal relocs, free them.  */
1338           free (internal_relocs);
1339         }
1340     }
1341   /* We're done with the local symbols, free them.  */
1342   for (i = 0; i < bfd_count; i++)
1343     if (all_local_syms[i])
1344       free (all_local_syms[i]);
1345   free (all_local_syms);
1346   return true;
1347
1348 error_return:
1349   /* Return gracefully, avoiding dangling references to the hash tables.  */
1350   if (stub_hash_table)
1351     {
1352       elf32_hppa_hash_table(link_info)->stub_hash_table = NULL;
1353       free (stub_hash_table);
1354     }
1355   /* Set the size of the stub section to zero since we're never going
1356      to create them.   Avoids losing when we try to get its contents
1357      too.  */
1358   bfd_set_section_size (stub_bfd, stub_sec, 0);
1359   return false;
1360 }
1361
1362 /* Misc BFD support code.  */
1363 #define bfd_elf32_bfd_reloc_type_lookup         elf_hppa_reloc_type_lookup
1364 #define bfd_elf32_bfd_is_local_label_name       hppa_elf_is_local_label_name
1365 #define elf_info_to_howto                       elf_hppa_info_to_howto
1366 #define elf_info_to_howto_rel                   elf_hppa_info_to_howto_rel
1367
1368 /* Stuff for the BFD linker.  */
1369 #define elf_backend_relocate_section            elf32_hppa_relocate_section
1370 #define elf_backend_add_symbol_hook             elf32_hppa_add_symbol_hook
1371 #define bfd_elf32_bfd_link_hash_table_create \
1372   elf32_hppa_link_hash_table_create
1373
1374 #define TARGET_BIG_SYM          bfd_elf32_hppa_vec
1375 #define TARGET_BIG_NAME         "elf32-hppa"
1376 #define ELF_ARCH                bfd_arch_hppa
1377 #define ELF_MACHINE_CODE        EM_PARISC
1378 #define ELF_MAXPAGESIZE         0x1000
1379
1380 #include "elf32-target.h"