xref: /freebsd/contrib/elftoolchain/libelf/gelf_getsym.3 (revision d003e0d7fe0d3a9b4b2c5835bb3f0f6faf3ab538)
12de3b87aSKai Wang.\" Copyright (c) 2006,2008 Joseph Koshy.  All rights reserved.
22de3b87aSKai Wang.\"
32de3b87aSKai Wang.\" Redistribution and use in source and binary forms, with or without
42de3b87aSKai Wang.\" modification, are permitted provided that the following conditions
52de3b87aSKai Wang.\" are met:
62de3b87aSKai Wang.\" 1. Redistributions of source code must retain the above copyright
72de3b87aSKai Wang.\"    notice, this list of conditions and the following disclaimer.
82de3b87aSKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright
92de3b87aSKai Wang.\"    notice, this list of conditions and the following disclaimer in the
102de3b87aSKai Wang.\"    documentation and/or other materials provided with the distribution.
112de3b87aSKai Wang.\"
122de3b87aSKai Wang.\" This software is provided by Joseph Koshy ``as is'' and
132de3b87aSKai Wang.\" any express or implied warranties, including, but not limited to, the
142de3b87aSKai Wang.\" implied warranties of merchantability and fitness for a particular purpose
152de3b87aSKai Wang.\" are disclaimed.  in no event shall Joseph Koshy be liable
162de3b87aSKai Wang.\" for any direct, indirect, incidental, special, exemplary, or consequential
172de3b87aSKai Wang.\" damages (including, but not limited to, procurement of substitute goods
182de3b87aSKai Wang.\" or services; loss of use, data, or profits; or business interruption)
192de3b87aSKai Wang.\" however caused and on any theory of liability, whether in contract, strict
202de3b87aSKai Wang.\" liability, or tort (including negligence or otherwise) arising in any way
212de3b87aSKai Wang.\" out of the use of this software, even if advised of the possibility of
222de3b87aSKai Wang.\" such damage.
232de3b87aSKai Wang.\"
24*d003e0d7SEd Maste.\" $Id: gelf_getsym.3 3734 2019-04-22 14:10:49Z jkoshy $
252de3b87aSKai Wang.\"
26*d003e0d7SEd Maste.Dd April 22, 2019
272de3b87aSKai Wang.Dt GELF_GETSYM 3
28ae500c1fSEd Maste.Os
292de3b87aSKai Wang.Sh NAME
302de3b87aSKai Wang.Nm gelf_getsym ,
312de3b87aSKai Wang.Nm gelf_update_sym
322de3b87aSKai Wang.Nd read and update symbol information
332de3b87aSKai Wang.Sh LIBRARY
342de3b87aSKai Wang.Lb libelf
352de3b87aSKai Wang.Sh SYNOPSIS
362de3b87aSKai Wang.In gelf.h
372de3b87aSKai Wang.Ft "GElf_Sym *"
382de3b87aSKai Wang.Fn gelf_getsym "Elf_Data *data" "int ndx" "GElf_Sym *sym"
392de3b87aSKai Wang.Ft int
402de3b87aSKai Wang.Fn gelf_update_sym "Elf_Data *data" "int ndx" "GElf_Sym *sym"
412de3b87aSKai Wang.Sh DESCRIPTION
422de3b87aSKai WangThese convenience functions are used to retrieve and update class-dependent
432de3b87aSKai Wang.Vt Elf32_Sym
442de3b87aSKai Wangand
452de3b87aSKai Wang.Vt Elf64_Sym
462de3b87aSKai Wangstructures in an ELF object.
472de3b87aSKai Wang.Pp
482de3b87aSKai WangArgument
492de3b87aSKai Wang.Ar data
502de3b87aSKai Wangis an
512de3b87aSKai Wang.Vt Elf_Data
522de3b87aSKai Wangdescriptor associated with a section of type
532de3b87aSKai Wang.Dv SHT_SYMTAB ,
542de3b87aSKai Wang.Dv SHT_DYNSYM
552de3b87aSKai Wangor
562de3b87aSKai Wang.Dv SHT_GNU_versym .
572de3b87aSKai WangArgument
582de3b87aSKai Wang.Ar ndx
592de3b87aSKai Wangis the index of the symbol being retrieved or updated.
602de3b87aSKai WangThe class-independent
612de3b87aSKai Wang.Vt GElf_Sym
622de3b87aSKai Wangstructure is described in
632de3b87aSKai Wang.Xr gelf 3 .
642de3b87aSKai Wang.Pp
652de3b87aSKai WangFunction
662de3b87aSKai Wang.Fn gelf_getsym
672de3b87aSKai Wangretrieves class-dependent symbol information at index
682de3b87aSKai Wang.Ar ndx
692de3b87aSKai Wangin data buffer
702de3b87aSKai Wang.Ar data
712de3b87aSKai Wangand copies it to the destination pointed to by argument
722de3b87aSKai Wang.Ar sym
732de3b87aSKai Wangafter translation to class-independent form.
742de3b87aSKai Wang.Pp
752de3b87aSKai WangFunction
762de3b87aSKai Wang.Fn gelf_update_sym
772de3b87aSKai Wangconverts the class-independent symbol information pointed to
782de3b87aSKai Wangby argument
792de3b87aSKai Wang.Ar sym
802de3b87aSKai Wangto class-dependent form, and writes it to the symbol entry at index
812de3b87aSKai Wang.Ar ndx
822de3b87aSKai Wangin the data buffer described by argument
832de3b87aSKai Wang.Ar data .
842de3b87aSKai WangFunction
852de3b87aSKai Wang.Fn gelf_update_sym
862de3b87aSKai Wangsignals an error if any of the values in the class-independent
872de3b87aSKai Wangrepresentation exceeds the representable limits of the target
882de3b87aSKai Wangtype.
892de3b87aSKai Wang.Sh RETURN VALUES
902de3b87aSKai WangFunction
912de3b87aSKai Wang.Fn gelf_getsym
922de3b87aSKai Wangreturns the value of argument
932de3b87aSKai Wang.Ar sym
942de3b87aSKai Wangif successful, or NULL in case of an error.
952de3b87aSKai WangFunction
962de3b87aSKai Wang.Fn gelf_update_sym
972de3b87aSKai Wangreturns a non-zero value if successful, or zero in case of an error.
982de3b87aSKai Wang.Sh ERRORS
992de3b87aSKai WangThese functions may fail with the following errors:
1002de3b87aSKai Wang.Bl -tag -width "[ELF_E_RESOURCE]"
1012de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
1022de3b87aSKai WangArguments
1032de3b87aSKai Wang.Ar data
1042de3b87aSKai Wangor
1052de3b87aSKai Wang.Ar sym
1062de3b87aSKai Wangwere NULL.
1072de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
1082de3b87aSKai WangArgument
1092de3b87aSKai Wang.Ar ndx
1102de3b87aSKai Wangwas less than zero or larger than the number of symbols in the data
1112de3b87aSKai Wangdescriptor.
1122de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
1132de3b87aSKai WangData descriptor
1142de3b87aSKai Wang.Ar data
1152de3b87aSKai Wangwas not associated with a section containing symbol information.
1162de3b87aSKai Wang.It Bq Er ELF_E_RANGE
1172de3b87aSKai WangA value was not representable in the target type.
118*d003e0d7SEd Maste.It Bq Er ELF_E_VERSION
119*d003e0d7SEd MasteThe
120*d003e0d7SEd Maste.Vt Elf_Data
121*d003e0d7SEd Mastedescriptor denoted by argument
122*d003e0d7SEd Maste.Ar data
123*d003e0d7SEd Masteis associated with an ELF object with an unsupported version.
1242de3b87aSKai Wang.El
1252de3b87aSKai Wang.Sh SEE ALSO
1262de3b87aSKai Wang.Xr elf 3 ,
1272de3b87aSKai Wang.Xr elf_getdata 3 ,
1282de3b87aSKai Wang.Xr elf_getscn 3 ,
1292de3b87aSKai Wang.Xr gelf 3 ,
1302de3b87aSKai Wang.Xr gelf_getsyminfo 3 ,
1312de3b87aSKai Wang.Xr gelf_update_syminfo 3
132