1 /* MeP-specific support for 32-bit ELF.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301, USA. */
27 #include "libiberty.h"
29 /* Forward declarations. */
31 /* Private relocation functions. */
33 #define MEPREL(type, size, bits, right, left, pcrel, overflow, mask) \
34 {(unsigned)type, right, size, bits, pcrel, left, overflow, mep_reloc, #type, FALSE, 0, mask, 0 }
36 #define N complain_overflow_dont
37 #define S complain_overflow_signed
38 #define U complain_overflow_unsigned
40 static bfd_reloc_status_type
mep_reloc (bfd
*, arelent
*, struct bfd_symbol
*,
41 void *, asection
*, bfd
*, char **);
43 static reloc_howto_type mep_elf_howto_table
[] =
45 /* type, size, bits, leftshift, rightshift, pcrel, OD/OS/OU, mask. */
46 MEPREL (R_MEP_NONE
, 0, 0, 0, 0, 0, N
, 0),
47 MEPREL (R_RELC
, 0, 0, 0, 0, 0, N
, 0),
49 /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
50 MEPREL (R_MEP_8
, 0, 8, 0, 0, 0, U
, 0xff),
51 MEPREL (R_MEP_16
, 1, 16, 0, 0, 0, U
, 0xffff),
52 MEPREL (R_MEP_32
, 2, 32, 0, 0, 0, U
, 0xffffffff),
53 MEPREL (R_MEP_PCREL8A2
, 1, 8, 1, 1, 1, S
, 0x00fe),
54 MEPREL (R_MEP_PCREL12A2
,1, 12, 1, 1, 1, S
, 0x0ffe),
55 MEPREL (R_MEP_PCREL17A2
,2, 17, 0, 1, 1, S
, 0x0000ffff),
56 MEPREL (R_MEP_PCREL24A2
,2, 24, 0, 1, 1, S
, 0x07f0ffff),
57 MEPREL (R_MEP_PCABS24A2
,2, 24, 0, 1, 0, U
, 0x07f0ffff),
58 MEPREL (R_MEP_LOW16
, 2, 16, 0, 0, 0, N
, 0x0000ffff),
59 MEPREL (R_MEP_HI16U
, 2, 32, 0,16, 0, N
, 0x0000ffff),
60 MEPREL (R_MEP_HI16S
, 2, 32, 0,16, 0, N
, 0x0000ffff),
61 MEPREL (R_MEP_GPREL
, 2, 16, 0, 0, 0, S
, 0x0000ffff),
62 MEPREL (R_MEP_TPREL
, 2, 16, 0, 0, 0, S
, 0x0000ffff),
63 MEPREL (R_MEP_TPREL7
, 1, 7, 0, 0, 0, U
, 0x007f),
64 MEPREL (R_MEP_TPREL7A2
, 1, 7, 1, 1, 0, U
, 0x007e),
65 MEPREL (R_MEP_TPREL7A4
, 1, 7, 2, 2, 0, U
, 0x007c),
66 MEPREL (R_MEP_UIMM24
, 2, 24, 0, 0, 0, U
, 0x00ffffff),
67 MEPREL (R_MEP_ADDR24A4
, 2, 24, 0, 2, 0, U
, 0x00fcffff),
68 MEPREL (R_MEP_GNU_VTINHERIT
,1, 0,16,32, 0, N
, 0x0000),
69 MEPREL (R_MEP_GNU_VTENTRY
,1, 0,16,32, 0, N
, 0x0000),
73 #define VALID_MEP_RELOC(N) ((N) >= 0 \
74 && (N) < ARRAY_SIZE (mep_elf_howto_table)
80 static bfd_reloc_status_type
82 (bfd
* abfd ATTRIBUTE_UNUSED
,
83 arelent
* reloc_entry ATTRIBUTE_UNUSED
,
84 struct bfd_symbol
* symbol ATTRIBUTE_UNUSED
,
85 void * data ATTRIBUTE_UNUSED
,
86 asection
* input_section ATTRIBUTE_UNUSED
,
87 bfd
* output_bfd ATTRIBUTE_UNUSED
,
88 char ** error_message ATTRIBUTE_UNUSED
)
95 #define BFD_RELOC_MEP_NONE BFD_RELOC_NONE
96 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
97 #define MAP(n) case BFD_RELOC_MEP_##n: type = R_MEP_##n; break
99 #define MAP(n) case BFD_RELOC_MEP_/**/n: type = R_MEP_/**/n; break
102 static reloc_howto_type
*
103 mep_reloc_type_lookup
104 (bfd
* abfd ATTRIBUTE_UNUSED
,
105 bfd_reloc_code_real_type code
)
107 unsigned int type
= 0;
121 case BFD_RELOC_VTABLE_ENTRY
:
122 type
= R_MEP_GNU_VTENTRY
;
124 case BFD_RELOC_VTABLE_INHERIT
:
125 type
= R_MEP_GNU_VTINHERIT
;
132 /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
156 /* Pacify gcc -Wall. */
157 fprintf (stderr
, "mep: no reloc for code %d\n", code
);
161 if (mep_elf_howto_table
[type
].type
!= type
)
163 fprintf (stderr
, "MeP: howto %d has type %d\n", type
, mep_elf_howto_table
[type
].type
);
167 return mep_elf_howto_table
+ type
;
172 static reloc_howto_type
*
173 mep_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
, const char *r_name
)
178 i
< sizeof (mep_elf_howto_table
) / sizeof (mep_elf_howto_table
[0]);
180 if (mep_elf_howto_table
[i
].name
!= NULL
181 && strcasecmp (mep_elf_howto_table
[i
].name
, r_name
) == 0)
182 return &mep_elf_howto_table
[i
];
187 /* Perform a single relocation. */
189 static struct bfd_link_info
*mep_info
;
190 static int warn_tp
= 0, warn_sda
= 0;
199 struct bfd_link_hash_entry
*h
;
204 h
= bfd_link_hash_lookup (mep_info
->hash
, name
, FALSE
, FALSE
, TRUE
);
205 if (h
== 0 || h
->type
!= bfd_link_hash_defined
)
210 *cache
= (h
->u
.def
.value
211 + h
->u
.def
.section
->output_section
->vma
212 + h
->u
.def
.section
->output_offset
);
217 mep_tpoff_base (bfd_vma ofs
)
219 static bfd_vma cache
= 0;
220 return mep_lookup_global ("__tpbase", ofs
, &cache
, &warn_tp
);
224 mep_sdaoff_base (bfd_vma ofs
)
226 static bfd_vma cache
= 0;
227 return mep_lookup_global ("__sdabase", ofs
, &cache
, &warn_sda
);
230 static bfd_reloc_status_type
231 mep_final_link_relocate
232 (reloc_howto_type
* howto
,
234 asection
* input_section
,
236 Elf_Internal_Rela
* rel
,
243 bfd_reloc_status_type r
= bfd_reloc_ok
;
246 if (bfd_big_endian (input_bfd
))
257 pc
= (input_section
->output_section
->vma
258 + input_section
->output_offset
261 s
= relocation
+ rel
->r_addend
;
263 byte
= (unsigned char *)contents
+ rel
->r_offset
;
265 if (howto
->type
== R_MEP_PCREL24A2
269 /* This is an unreachable branch to an undefined weak function.
270 Silently ignore it, since the opcode can't do that but should
271 never be executed anyway. */
275 if (howto
->pc_relative
)
278 u
= (unsigned long) s
;
283 /* This section generated from bfd/mep-relocs.pl from include/elf/mep.h. */
284 case R_MEP_8
: /* 76543210 */
285 if (u
> 255) r
= bfd_reloc_overflow
;
286 byte
[0] = (u
& 0xff);
288 case R_MEP_16
: /* fedcba9876543210 */
289 if (u
> 65535) r
= bfd_reloc_overflow
;
290 byte
[0^e2
] = ((u
>> 8) & 0xff);
291 byte
[1^e2
] = (u
& 0xff);
293 case R_MEP_32
: /* vutsrqponmlkjihgfedcba9876543210 */
294 byte
[0^e4
] = ((u
>> 24) & 0xff);
295 byte
[1^e4
] = ((u
>> 16) & 0xff);
296 byte
[2^e4
] = ((u
>> 8) & 0xff);
297 byte
[3^e4
] = (u
& 0xff);
299 case R_MEP_PCREL8A2
: /* --------7654321- */
300 if (-128 > s
|| s
> 127) r
= bfd_reloc_overflow
;
301 byte
[1^e2
] = (byte
[1^e2
] & 0x01) | (s
& 0xfe);
303 case R_MEP_PCREL12A2
: /* ----ba987654321- */
304 if (-2048 > s
|| s
> 2047) r
= bfd_reloc_overflow
;
305 byte
[0^e2
] = (byte
[0^e2
] & 0xf0) | ((s
>> 8) & 0x0f);
306 byte
[1^e2
] = (byte
[1^e2
] & 0x01) | (s
& 0xfe);
308 case R_MEP_PCREL17A2
: /* ----------------gfedcba987654321 */
309 if (-65536 > s
|| s
> 65535) r
= bfd_reloc_overflow
;
310 byte
[2^e2
] = ((s
>> 9) & 0xff);
311 byte
[3^e2
] = ((s
>> 1) & 0xff);
313 case R_MEP_PCREL24A2
: /* -----7654321----nmlkjihgfedcba98 */
314 if (-8388608 > s
|| s
> 8388607) r
= bfd_reloc_overflow
;
315 byte
[0^e2
] = (byte
[0^e2
] & 0xf8) | ((s
>> 5) & 0x07);
316 byte
[1^e2
] = (byte
[1^e2
] & 0x0f) | ((s
<< 3) & 0xf0);
317 byte
[2^e2
] = ((s
>> 16) & 0xff);
318 byte
[3^e2
] = ((s
>> 8) & 0xff);
320 case R_MEP_PCABS24A2
: /* -----7654321----nmlkjihgfedcba98 */
321 if (u
> 16777215) r
= bfd_reloc_overflow
;
322 byte
[0^e2
] = (byte
[0^e2
] & 0xf8) | ((u
>> 5) & 0x07);
323 byte
[1^e2
] = (byte
[1^e2
] & 0x0f) | ((u
<< 3) & 0xf0);
324 byte
[2^e2
] = ((u
>> 16) & 0xff);
325 byte
[3^e2
] = ((u
>> 8) & 0xff);
327 case R_MEP_LOW16
: /* ----------------fedcba9876543210 */
328 byte
[2^e2
] = ((u
>> 8) & 0xff);
329 byte
[3^e2
] = (u
& 0xff);
331 case R_MEP_HI16U
: /* ----------------vutsrqponmlkjihg */
332 byte
[2^e2
] = ((u
>> 24) & 0xff);
333 byte
[3^e2
] = ((u
>> 16) & 0xff);
335 case R_MEP_HI16S
: /* ----------------vutsrqponmlkjihg */
338 byte
[2^e2
] = ((s
>> 24) & 0xff);
339 byte
[3^e2
] = ((s
>> 16) & 0xff);
341 case R_MEP_GPREL
: /* ----------------fedcba9876543210 */
342 s
-= mep_sdaoff_base(rel
->r_offset
);
343 if (-32768 > s
|| s
> 32767) r
= bfd_reloc_overflow
;
344 byte
[2^e2
] = ((s
>> 8) & 0xff);
345 byte
[3^e2
] = (s
& 0xff);
347 case R_MEP_TPREL
: /* ----------------fedcba9876543210 */
348 s
-= mep_tpoff_base(rel
->r_offset
);
349 if (-32768 > s
|| s
> 32767) r
= bfd_reloc_overflow
;
350 byte
[2^e2
] = ((s
>> 8) & 0xff);
351 byte
[3^e2
] = (s
& 0xff);
353 case R_MEP_TPREL7
: /* ---------6543210 */
354 u
-= mep_tpoff_base(rel
->r_offset
);
355 if (u
> 127) r
= bfd_reloc_overflow
;
356 byte
[1^e2
] = (byte
[1^e2
] & 0x80) | (u
& 0x7f);
358 case R_MEP_TPREL7A2
: /* ---------654321- */
359 u
-= mep_tpoff_base(rel
->r_offset
);
360 if (u
> 127) r
= bfd_reloc_overflow
;
361 byte
[1^e2
] = (byte
[1^e2
] & 0x81) | (u
& 0x7e);
363 case R_MEP_TPREL7A4
: /* ---------65432-- */
364 u
-= mep_tpoff_base(rel
->r_offset
);
365 if (u
> 127) r
= bfd_reloc_overflow
;
366 byte
[1^e2
] = (byte
[1^e2
] & 0x83) | (u
& 0x7c);
368 case R_MEP_UIMM24
: /* --------76543210nmlkjihgfedcba98 */
369 if (u
> 16777215) r
= bfd_reloc_overflow
;
370 byte
[1^e2
] = (u
& 0xff);
371 byte
[2^e2
] = ((u
>> 16) & 0xff);
372 byte
[3^e2
] = ((u
>> 8) & 0xff);
374 case R_MEP_ADDR24A4
: /* --------765432--nmlkjihgfedcba98 */
375 if (u
> 16777215) r
= bfd_reloc_overflow
;
376 byte
[1^e2
] = (byte
[1^e2
] & 0x03) | (u
& 0xfc);
377 byte
[2^e2
] = ((u
>> 16) & 0xff);
378 byte
[3^e2
] = ((u
>> 8) & 0xff);
380 case R_MEP_GNU_VTINHERIT
: /* ---------------- */
382 case R_MEP_GNU_VTENTRY
: /* ---------------- */
392 /* Set the howto pointer for a MEP ELF reloc. */
395 mep_info_to_howto_rela
396 (bfd
* abfd ATTRIBUTE_UNUSED
,
398 Elf_Internal_Rela
* dst
)
402 r_type
= ELF32_R_TYPE (dst
->r_info
);
403 cache_ptr
->howto
= & mep_elf_howto_table
[r_type
];
406 /* Relocate a MEP ELF section.
407 There is some attempt to make this function usable for many architectures,
408 both USE_REL and USE_RELA ['twould be nice if such a critter existed],
409 if only to serve as a learning tool.
411 The RELOCATE_SECTION function is called by the new ELF backend linker
412 to handle the relocations for a section.
414 The relocs are always passed as Rela structures; if the section
415 actually uses Rel structures, the r_addend field will always be
418 This function is responsible for adjusting the section contents as
419 necessary, and (if using Rela relocs and generating a relocatable
420 output file) adjusting the reloc addend as necessary.
422 This function does not have to worry about setting the reloc
423 address or the reloc symbol index.
425 LOCAL_SYMS is a pointer to the swapped in local symbols.
427 LOCAL_SECTIONS is an array giving the section in the input file
428 corresponding to the st_shndx field of each local symbol.
430 The global hash table entry for the global symbols can be found
431 via elf_sym_hashes (input_bfd).
433 When generating relocatable output, this function must handle
434 STB_LOCAL/STT_SECTION symbols specially. The output symbol is
435 going to be the section symbol corresponding to the output
436 section, which means that the addend must be adjusted
440 mep_elf_relocate_section
441 (bfd
* output_bfd ATTRIBUTE_UNUSED
,
442 struct bfd_link_info
* info
,
444 asection
* input_section
,
446 Elf_Internal_Rela
* relocs
,
447 Elf_Internal_Sym
* local_syms
,
448 asection
** local_sections
)
450 Elf_Internal_Shdr
* symtab_hdr
;
451 struct elf_link_hash_entry
** sym_hashes
;
452 Elf_Internal_Rela
* rel
;
453 Elf_Internal_Rela
* relend
;
455 symtab_hdr
= & elf_tdata (input_bfd
)->symtab_hdr
;
456 sym_hashes
= elf_sym_hashes (input_bfd
);
457 relend
= relocs
+ input_section
->reloc_count
;
461 for (rel
= relocs
; rel
< relend
; rel
++)
463 reloc_howto_type
* howto
;
464 unsigned long r_symndx
;
465 Elf_Internal_Sym
* sym
;
467 struct elf_link_hash_entry
* h
;
469 bfd_reloc_status_type r
;
470 const char * name
= NULL
;
473 r_type
= ELF32_R_TYPE (rel
->r_info
);
474 r_symndx
= ELF32_R_SYM (rel
->r_info
);
475 howto
= mep_elf_howto_table
+ ELF32_R_TYPE (rel
->r_info
);
480 if (r_symndx
< symtab_hdr
->sh_info
)
482 sym
= local_syms
+ r_symndx
;
483 sec
= local_sections
[r_symndx
];
484 relocation
= _bfd_elf_rela_local_sym (output_bfd
, sym
, &sec
, rel
);
486 name
= bfd_elf_string_from_elf_section
487 (input_bfd
, symtab_hdr
->sh_link
, sym
->st_name
);
488 name
= (name
== NULL
) ? bfd_section_name (input_bfd
, sec
) : name
;
492 bfd_boolean warned
, unresolved_reloc
;
494 RELOC_FOR_GLOBAL_SYMBOL(info
, input_bfd
, input_section
, rel
,
495 r_symndx
, symtab_hdr
, sym_hashes
,
497 unresolved_reloc
, warned
);
499 name
= h
->root
.root
.string
;
502 if (sec
!= NULL
&& elf_discarded_section (sec
))
503 RELOC_AGAINST_DISCARDED_SECTION (info
, input_bfd
, input_section
,
504 rel
, relend
, howto
, contents
);
506 if (info
->relocatable
)
509 if (r_type
== R_RELC
)
510 r
= bfd_elf_perform_complex_relocation (input_bfd
, input_section
,
511 contents
, rel
, relocation
);
513 r
= mep_final_link_relocate (howto
, input_bfd
, input_section
,
514 contents
, rel
, relocation
);
516 if (r
!= bfd_reloc_ok
)
518 const char * msg
= (const char *) NULL
;
522 case bfd_reloc_overflow
:
523 r
= info
->callbacks
->reloc_overflow
524 (info
, (h
? &h
->root
: NULL
), name
, howto
->name
, (bfd_vma
) 0,
525 input_bfd
, input_section
, rel
->r_offset
);
528 case bfd_reloc_undefined
:
529 r
= info
->callbacks
->undefined_symbol
530 (info
, name
, input_bfd
, input_section
, rel
->r_offset
, TRUE
);
533 case bfd_reloc_outofrange
:
534 msg
= _("internal error: out of range error");
537 case bfd_reloc_notsupported
:
538 msg
= _("internal error: unsupported relocation error");
541 case bfd_reloc_dangerous
:
542 msg
= _("internal error: dangerous relocation");
546 msg
= _("internal error: unknown error");
551 r
= info
->callbacks
->warning
552 (info
, msg
, name
, input_bfd
, input_section
, rel
->r_offset
);
560 info
->callbacks
->undefined_symbol
561 (info
, "__tpbase", input_bfd
, input_section
, warn_tp
-1, TRUE
);
563 info
->callbacks
->undefined_symbol
564 (info
, "__sdabase", input_bfd
, input_section
, warn_sda
-1, TRUE
);
565 if (warn_sda
|| warn_tp
)
571 /* Function to set the ELF flag bits. */
574 mep_elf_set_private_flags (bfd
* abfd
,
577 elf_elfheader (abfd
)->e_flags
= flags
;
578 elf_flags_init (abfd
) = TRUE
;
583 mep_elf_copy_private_bfd_data (bfd
* ibfd
, bfd
* obfd
)
585 if (bfd_get_flavour (ibfd
) != bfd_target_elf_flavour
586 || bfd_get_flavour (obfd
) != bfd_target_elf_flavour
)
589 elf_elfheader (obfd
)->e_flags
= elf_elfheader (ibfd
)->e_flags
;
590 elf_flags_init (obfd
) = TRUE
;
592 /* Copy object attributes. */
593 _bfd_elf_copy_obj_attributes (ibfd
, obfd
);
598 /* Merge backend specific data from an object file to the output
599 object file when linking. */
602 mep_elf_merge_private_bfd_data (bfd
* ibfd
, bfd
* obfd
)
604 static bfd
*last_ibfd
= 0;
605 flagword old_flags
, new_flags
;
606 flagword old_partial
, new_partial
;
608 /* Check if we have the same endianess. */
609 if (_bfd_generic_verify_endian_match (ibfd
, obfd
) == FALSE
)
612 new_flags
= elf_elfheader (ibfd
)->e_flags
;
613 old_flags
= elf_elfheader (obfd
)->e_flags
;
616 _bfd_error_handler ("%B: old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s",
617 ibfd
, old_flags
, new_flags
, elf_flags_init (obfd
) ? "yes" : "no");
620 /* First call, no flags set. */
621 if (!elf_flags_init (obfd
))
623 elf_flags_init (obfd
) = TRUE
;
624 old_flags
= new_flags
;
626 else if ((new_flags
| old_flags
) & EF_MEP_LIBRARY
)
628 /* Non-library flags trump library flags. The choice doesn't really
629 matter if both OLD_FLAGS and NEW_FLAGS have EF_MEP_LIBRARY set. */
630 if (old_flags
& EF_MEP_LIBRARY
)
631 old_flags
= new_flags
;
635 /* Make sure they're for the same mach. Allow upgrade from the "mep"
637 new_partial
= (new_flags
& EF_MEP_CPU_MASK
);
638 old_partial
= (old_flags
& EF_MEP_CPU_MASK
);
639 if (new_partial
== old_partial
)
641 else if (new_partial
== EF_MEP_CPU_MEP
)
643 else if (old_partial
== EF_MEP_CPU_MEP
)
644 old_flags
= (old_flags
& ~EF_MEP_CPU_MASK
) | new_partial
;
647 _bfd_error_handler (_("%B and %B are for different cores"), last_ibfd
, ibfd
);
648 bfd_set_error (bfd_error_invalid_target
);
652 /* Make sure they're for the same me_module. Allow basic config to
653 mix with any other. */
654 new_partial
= (new_flags
& EF_MEP_INDEX_MASK
);
655 old_partial
= (old_flags
& EF_MEP_INDEX_MASK
);
656 if (new_partial
== old_partial
)
658 else if (new_partial
== 0)
660 else if (old_partial
== 0)
661 old_flags
= (old_flags
& ~EF_MEP_INDEX_MASK
) | new_partial
;
664 _bfd_error_handler (_("%B and %B are for different configurations"), last_ibfd
, ibfd
);
665 bfd_set_error (bfd_error_invalid_target
);
670 elf_elfheader (obfd
)->e_flags
= old_flags
;
675 /* This will be edited by the MeP configration tool. */
676 static const char * config_names
[] =
679 /* start-mepcfgtool */
684 static const char * core_names
[] =
686 "MeP", "MeP-c2", "MeP-c3", "MeP-h1"
690 mep_elf_print_private_bfd_data (bfd
* abfd
, void * ptr
)
692 FILE * file
= (FILE *) ptr
;
693 flagword flags
, partial_flags
;
695 BFD_ASSERT (abfd
!= NULL
&& ptr
!= NULL
);
697 /* Print normal ELF private data. */
698 _bfd_elf_print_private_bfd_data (abfd
, ptr
);
700 flags
= elf_elfheader (abfd
)->e_flags
;
701 fprintf (file
, _("private flags = 0x%lx"), (unsigned long) flags
);
703 partial_flags
= (flags
& EF_MEP_CPU_MASK
) >> 24;
704 if (partial_flags
< ARRAY_SIZE (core_names
))
705 fprintf (file
, " core: %s", core_names
[(long)partial_flags
]);
707 partial_flags
= flags
& EF_MEP_INDEX_MASK
;
708 if (partial_flags
< ARRAY_SIZE (config_names
))
709 fprintf (file
, " me_module: %s", config_names
[(long)partial_flags
]);
716 /* Return the machine subcode from the ELF e_flags header. */
719 elf32_mep_machine (bfd
* abfd
)
721 switch (elf_elfheader (abfd
)->e_flags
& EF_MEP_CPU_MASK
)
724 case EF_MEP_CPU_C2
: return bfd_mach_mep
;
725 case EF_MEP_CPU_C3
: return bfd_mach_mep
;
726 case EF_MEP_CPU_C4
: return bfd_mach_mep
;
727 case EF_MEP_CPU_C5
: return bfd_mach_mep_c5
;
728 case EF_MEP_CPU_H1
: return bfd_mach_mep_h1
;
735 mep_elf_object_p (bfd
* abfd
)
737 bfd_default_set_arch_mach (abfd
, bfd_arch_mep
, elf32_mep_machine (abfd
));
742 mep_elf_section_flags (flagword
* flags
, const Elf_Internal_Shdr
* hdr
)
744 if (hdr
->sh_flags
& SHF_MEP_VLIW
)
745 * flags
|= SEC_MEP_VLIW
;
750 mep_elf_fake_sections (bfd
* abfd ATTRIBUTE_UNUSED
,
751 Elf_Internal_Shdr
* hdr
,
754 if (sec
->flags
& SEC_MEP_VLIW
)
755 hdr
->sh_flags
|= SHF_MEP_VLIW
;
760 #define ELF_ARCH bfd_arch_mep
761 #define ELF_MACHINE_CODE EM_CYGNUS_MEP
762 #define ELF_MAXPAGESIZE 0x1000
764 #define TARGET_BIG_SYM bfd_elf32_mep_vec
765 #define TARGET_BIG_NAME "elf32-mep"
767 #define TARGET_LITTLE_SYM bfd_elf32_mep_little_vec
768 #define TARGET_LITTLE_NAME "elf32-mep-little"
770 #define elf_info_to_howto_rel NULL
771 #define elf_info_to_howto mep_info_to_howto_rela
772 #define elf_backend_relocate_section mep_elf_relocate_section
773 #define elf_backend_object_p mep_elf_object_p
774 #define elf_backend_section_flags mep_elf_section_flags
775 #define elf_backend_fake_sections mep_elf_fake_sections
777 #define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup
778 #define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup
779 #define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags
780 #define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data
781 #define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data
782 #define bfd_elf32_bfd_print_private_bfd_data mep_elf_print_private_bfd_data
784 #define elf_backend_rela_normal 1
786 #include "elf32-target.h"