Path: blob/main/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
39478 views
/*-1* Copyright (c) 2008,2009 Kai Wang2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer9* in this position and unchanged.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR15* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES16* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.17* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT19* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,20* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY21* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF23* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.24*/2526#include <sys/param.h>27#include <string.h>28#include <libelftc.h>2930#include "_libelftc.h"3132ELFTC_VCSID("$Id: elftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $");3334Elftc_Bfd_Target *35elftc_bfd_find_target(const char *tgt_name)36{37Elftc_Bfd_Target *tgt;3839for (tgt = _libelftc_targets; tgt->bt_name; tgt++)40if (!strcmp(tgt_name, tgt->bt_name))41return (tgt);4243return (NULL); /* not found */44}4546Elftc_Bfd_Target_Flavor47elftc_bfd_target_flavor(Elftc_Bfd_Target *tgt)48{4950return (tgt->bt_type);51}5253unsigned int54elftc_bfd_target_byteorder(Elftc_Bfd_Target *tgt)55{5657return (tgt->bt_byteorder);58}5960unsigned int61elftc_bfd_target_class(Elftc_Bfd_Target *tgt)62{6364return (tgt->bt_elfclass);65}6667unsigned int68elftc_bfd_target_machine(Elftc_Bfd_Target *tgt)69{7071return (tgt->bt_machine);72}7374unsigned int75elftc_bfd_target_osabi(Elftc_Bfd_Target *tgt)76{7778return (tgt->bt_osabi);79}808182