Path: blob/main/contrib/elftoolchain/libelftc/libelftc.h
39483 views
/*-1* Copyright (c) 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*25* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $26* $Id: libelftc.h 3744 2019-06-28 00:41:47Z emaste $27*/2829#ifndef _LIBELFTC_H_30#define _LIBELFTC_H_3132#include <sys/stat.h>3334#include <libelf.h>3536/*37* Types meant to be opaque to the consumers of these APIs.38*/39typedef struct _Elftc_Bfd_Target Elftc_Bfd_Target;40typedef struct _Elftc_String_Table Elftc_String_Table;4142/* Target types. */43typedef enum {44ETF_NONE,45ETF_ELF,46ETF_BINARY,47ETF_SREC,48ETF_IHEX,49ETF_PE,50ETF_EFI,51} Elftc_Bfd_Target_Flavor;5253/*54* Demangler flags.55*/5657/* Name mangling style. */58#define ELFTC_DEM_UNKNOWN 0x00000000U /* Not specified. */59#define ELFTC_DEM_ARM 0x00000001U /* C++ Ann. Ref. Manual. */60#define ELFTC_DEM_GNU2 0x00000002U /* GNU version 2. */61#define ELFTC_DEM_GNU3 0x00000004U /* GNU version 3. */6263/* Demangling behaviour control. */64#define ELFTC_DEM_NOPARAM 0x00010000U6566#ifdef __cplusplus67extern "C" {68#endif69Elftc_Bfd_Target *elftc_bfd_find_target(const char *_tgt_name);70Elftc_Bfd_Target_Flavor elftc_bfd_target_flavor(Elftc_Bfd_Target *_tgt);71unsigned int elftc_bfd_target_byteorder(Elftc_Bfd_Target *_tgt);72unsigned int elftc_bfd_target_class(Elftc_Bfd_Target *_tgt);73unsigned int elftc_bfd_target_machine(Elftc_Bfd_Target *_tgt);74unsigned int elftc_bfd_target_osabi(Elftc_Bfd_Target *_tgt);75int elftc_copyfile(int _srcfd, int _dstfd);76int elftc_demangle(const char *_mangledname, char *_buffer,77size_t _bufsize, unsigned int _flags);78const char *elftc_reloc_type_str(unsigned int mach, unsigned int type);79int elftc_set_timestamps(const char *_filename, struct stat *_sb);80Elftc_String_Table *elftc_string_table_create(size_t _sizehint);81void elftc_string_table_destroy(Elftc_String_Table *_table);82Elftc_String_Table *elftc_string_table_from_section(Elf_Scn *_scn,83size_t _sizehint);84const char *elftc_string_table_image(Elftc_String_Table *_table,85size_t *_sz);86size_t elftc_string_table_insert(Elftc_String_Table *_table,87const char *_string);88size_t elftc_string_table_lookup(Elftc_String_Table *_table,89const char *_string);90int elftc_string_table_remove(Elftc_String_Table *_table,91const char *_string);92const char *elftc_string_table_to_string(Elftc_String_Table *_table,93size_t offset);94int elftc_timestamp(time_t *_timestamp);95const char *elftc_version(void);96#ifdef __cplusplus97}98#endif99100#endif /* _LIBELFTC_H_ */101102103