1260684Skaiw/*- 2260684Skaiw * Copyright (c) 2008,2009 Kai Wang 3260684Skaiw * All rights reserved. 4260684Skaiw * 5260684Skaiw * Redistribution and use in source and binary forms, with or without 6260684Skaiw * modification, are permitted provided that the following conditions 7260684Skaiw * are met: 8260684Skaiw * 1. Redistributions of source code must retain the above copyright 9260684Skaiw * notice, this list of conditions and the following disclaimer 10260684Skaiw * in this position and unchanged. 11260684Skaiw * 2. Redistributions in binary form must reproduce the above copyright 12260684Skaiw * notice, this list of conditions and the following disclaimer in the 13260684Skaiw * documentation and/or other materials provided with the distribution. 14260684Skaiw * 15260684Skaiw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16260684Skaiw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17260684Skaiw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18260684Skaiw * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19260684Skaiw * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20260684Skaiw * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21260684Skaiw * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22260684Skaiw * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23260684Skaiw * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24260684Skaiw * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25260684Skaiw */ 26260684Skaiw 27260684Skaiw#include <sys/param.h> 28260684Skaiw#include <string.h> 29260684Skaiw#include <libelftc.h> 30260684Skaiw 31260684Skaiw#include "_libelftc.h" 32260684Skaiw 33280932SemasteELFTC_VCSID("$Id: elftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $"); 34260684Skaiw 35260684SkaiwElftc_Bfd_Target * 36260684Skaiwelftc_bfd_find_target(const char *tgt_name) 37260684Skaiw{ 38260684Skaiw Elftc_Bfd_Target *tgt; 39260684Skaiw 40260684Skaiw for (tgt = _libelftc_targets; tgt->bt_name; tgt++) 41260684Skaiw if (!strcmp(tgt_name, tgt->bt_name)) 42260684Skaiw return (tgt); 43260684Skaiw 44260684Skaiw return (NULL); /* not found */ 45260684Skaiw} 46260684Skaiw 47260684SkaiwElftc_Bfd_Target_Flavor 48260684Skaiwelftc_bfd_target_flavor(Elftc_Bfd_Target *tgt) 49260684Skaiw{ 50260684Skaiw 51260684Skaiw return (tgt->bt_type); 52260684Skaiw} 53260684Skaiw 54260684Skaiwunsigned int 55260684Skaiwelftc_bfd_target_byteorder(Elftc_Bfd_Target *tgt) 56260684Skaiw{ 57260684Skaiw 58260684Skaiw return (tgt->bt_byteorder); 59260684Skaiw} 60260684Skaiw 61260684Skaiwunsigned int 62260684Skaiwelftc_bfd_target_class(Elftc_Bfd_Target *tgt) 63260684Skaiw{ 64260684Skaiw 65260684Skaiw return (tgt->bt_elfclass); 66260684Skaiw} 67260684Skaiw 68260684Skaiwunsigned int 69260684Skaiwelftc_bfd_target_machine(Elftc_Bfd_Target *tgt) 70260684Skaiw{ 71260684Skaiw 72260684Skaiw return (tgt->bt_machine); 73260684Skaiw} 74