1a85fe12eSEd Maste /*-
2a85fe12eSEd Maste * Copyright (c) 2008,2009 Kai Wang
3a85fe12eSEd Maste * All rights reserved.
4a85fe12eSEd Maste *
5a85fe12eSEd Maste * Redistribution and use in source and binary forms, with or without
6a85fe12eSEd Maste * modification, are permitted provided that the following conditions
7a85fe12eSEd Maste * are met:
8a85fe12eSEd Maste * 1. Redistributions of source code must retain the above copyright
9a85fe12eSEd Maste * notice, this list of conditions and the following disclaimer
10a85fe12eSEd Maste * in this position and unchanged.
11a85fe12eSEd Maste * 2. Redistributions in binary form must reproduce the above copyright
12a85fe12eSEd Maste * notice, this list of conditions and the following disclaimer in the
13a85fe12eSEd Maste * documentation and/or other materials provided with the distribution.
14a85fe12eSEd Maste *
15a85fe12eSEd Maste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16a85fe12eSEd Maste * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17a85fe12eSEd Maste * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18a85fe12eSEd Maste * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19a85fe12eSEd Maste * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20a85fe12eSEd Maste * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21a85fe12eSEd Maste * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22a85fe12eSEd Maste * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23a85fe12eSEd Maste * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24a85fe12eSEd Maste * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25a85fe12eSEd Maste */
26a85fe12eSEd Maste
27a85fe12eSEd Maste #include <sys/param.h>
28a85fe12eSEd Maste #include <string.h>
29a85fe12eSEd Maste #include <libelftc.h>
30a85fe12eSEd Maste
31a85fe12eSEd Maste #include "_libelftc.h"
32a85fe12eSEd Maste
3367d97fe7SEd Maste ELFTC_VCSID("$Id: elftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $");
34a85fe12eSEd Maste
35a85fe12eSEd Maste Elftc_Bfd_Target *
elftc_bfd_find_target(const char * tgt_name)36a85fe12eSEd Maste elftc_bfd_find_target(const char *tgt_name)
37a85fe12eSEd Maste {
38a85fe12eSEd Maste Elftc_Bfd_Target *tgt;
39a85fe12eSEd Maste
40a85fe12eSEd Maste for (tgt = _libelftc_targets; tgt->bt_name; tgt++)
41a85fe12eSEd Maste if (!strcmp(tgt_name, tgt->bt_name))
42a85fe12eSEd Maste return (tgt);
43a85fe12eSEd Maste
44a85fe12eSEd Maste return (NULL); /* not found */
45a85fe12eSEd Maste }
46a85fe12eSEd Maste
47a85fe12eSEd Maste Elftc_Bfd_Target_Flavor
elftc_bfd_target_flavor(Elftc_Bfd_Target * tgt)48a85fe12eSEd Maste elftc_bfd_target_flavor(Elftc_Bfd_Target *tgt)
49a85fe12eSEd Maste {
50a85fe12eSEd Maste
51a85fe12eSEd Maste return (tgt->bt_type);
52a85fe12eSEd Maste }
53a85fe12eSEd Maste
54a85fe12eSEd Maste unsigned int
elftc_bfd_target_byteorder(Elftc_Bfd_Target * tgt)55a85fe12eSEd Maste elftc_bfd_target_byteorder(Elftc_Bfd_Target *tgt)
56a85fe12eSEd Maste {
57a85fe12eSEd Maste
58a85fe12eSEd Maste return (tgt->bt_byteorder);
59a85fe12eSEd Maste }
60a85fe12eSEd Maste
61a85fe12eSEd Maste unsigned int
elftc_bfd_target_class(Elftc_Bfd_Target * tgt)62a85fe12eSEd Maste elftc_bfd_target_class(Elftc_Bfd_Target *tgt)
63a85fe12eSEd Maste {
64a85fe12eSEd Maste
65a85fe12eSEd Maste return (tgt->bt_elfclass);
66a85fe12eSEd Maste }
67a85fe12eSEd Maste
68a85fe12eSEd Maste unsigned int
elftc_bfd_target_machine(Elftc_Bfd_Target * tgt)69a85fe12eSEd Maste elftc_bfd_target_machine(Elftc_Bfd_Target *tgt)
70a85fe12eSEd Maste {
71a85fe12eSEd Maste
72a85fe12eSEd Maste return (tgt->bt_machine);
73a85fe12eSEd Maste }
74*57d7e4ccSEd Maste
75*57d7e4ccSEd Maste unsigned int
elftc_bfd_target_osabi(Elftc_Bfd_Target * tgt)76*57d7e4ccSEd Maste elftc_bfd_target_osabi(Elftc_Bfd_Target *tgt)
77*57d7e4ccSEd Maste {
78*57d7e4ccSEd Maste
79*57d7e4ccSEd Maste return (tgt->bt_osabi);
80*57d7e4ccSEd Maste }
81