xref: /freebsd/contrib/elftoolchain/libelf/elf_strptr.3 (revision ae500c1ff8974130f7f2692772cf288b90349e0d)
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*ae500c1fSEd Maste.\" $Id: elf_strptr.3 3639 2018-10-14 14:07:02Z jkoshy $
252de3b87aSKai Wang.\"
262de3b87aSKai Wang.Dd December 16, 2006
272de3b87aSKai Wang.Dt ELF_STRPTR 3
28*ae500c1fSEd Maste.Os
292de3b87aSKai Wang.Sh NAME
302de3b87aSKai Wang.Nm elf_strptr
312de3b87aSKai Wang.Nd retrieve a string pointer in a string table
322de3b87aSKai Wang.Sh LIBRARY
332de3b87aSKai Wang.Lb libelf
342de3b87aSKai Wang.Sh SYNOPSIS
352de3b87aSKai Wang.In libelf.h
362de3b87aSKai Wang.Ft "char *"
372de3b87aSKai Wang.Fn elf_strptr "Elf *elf" "size_t scndx" "size_t stroffset"
382de3b87aSKai Wang.Sh DESCRIPTION
392de3b87aSKai WangFunction
402de3b87aSKai Wang.Fn elf_strptr
412de3b87aSKai Wangallows an application to convert a string table offset to a string
422de3b87aSKai Wangpointer, correctly translating the offset in the presence
432de3b87aSKai Wangof multiple
442de3b87aSKai Wang.Vt Elf_Data
452de3b87aSKai Wangdescriptors covering the contents of the section.
462de3b87aSKai Wang.Pp
472de3b87aSKai WangArgument
482de3b87aSKai Wang.Ar elf
492de3b87aSKai Wangis a descriptor for an ELF object.
502de3b87aSKai WangArgument
512de3b87aSKai Wang.Ar scndx
522de3b87aSKai Wangis the section index for an ELF string table.
532de3b87aSKai WangArgument
542de3b87aSKai Wang.Ar stroffset
552de3b87aSKai Wangis the index of the desired string in the string
562de3b87aSKai Wangtable.
572de3b87aSKai Wang.Sh RETURN VALUES
582de3b87aSKai WangFunction
592de3b87aSKai Wang.Fn elf_strptr
602de3b87aSKai Wangreturns a valid pointer on success or NULL in case an error was
612de3b87aSKai Wangencountered.
622de3b87aSKai Wang.Sh ERRORS
632de3b87aSKai Wang.Bl -tag -width "[ELF_E_RESOURCE]"
642de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
652de3b87aSKai WangArgument
662de3b87aSKai Wang.Ar elf
672de3b87aSKai Wangwas NULL
682de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
692de3b87aSKai WangArgument
702de3b87aSKai Wang.Ar elf
712de3b87aSKai Wangwas not a descriptor for an ELF object.
722de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
732de3b87aSKai WangArgument
742de3b87aSKai Wang.Ar scndx
752de3b87aSKai Wangwas not the section index for a string table.
762de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
772de3b87aSKai WangArgument
782de3b87aSKai Wang.Ar stroffset
792de3b87aSKai Wangexceeded the size of the string table.
802de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT
812de3b87aSKai WangArgument
822de3b87aSKai Wang.Ar stroffset
832de3b87aSKai Wangindex an unallocated region of the string table.
842de3b87aSKai Wang.It Bq Er ELF_E_DATA
852de3b87aSKai WangOffset
862de3b87aSKai Wang.Ar stroffset
872de3b87aSKai Wangindexed a region that was not covered by any Elf_Data
882de3b87aSKai Wangdescriptor.
892de3b87aSKai Wang.It Bq Er ELF_E_DATA
902de3b87aSKai WangAn erroneous
912de3b87aSKai Wang.Vt Elf_Data
922de3b87aSKai Wangdescriptor was part of the section specified by argument
932de3b87aSKai Wang.Ar scndx .
942de3b87aSKai Wang.It Bq Er ELF_E_HEADER
952de3b87aSKai WangELF descriptor
962de3b87aSKai Wang.Ar elf
972de3b87aSKai Wangcontained an invalid section header.
982de3b87aSKai Wang.It Bq Er ELF_E_RESOURCE
992de3b87aSKai WangAn out of memory condition was detected.
1002de3b87aSKai Wang.It Bq Er ELF_E_SECTION
1012de3b87aSKai WangSection
1022de3b87aSKai Wang.Ar scndx
1032de3b87aSKai Wangcontained a malformed section header.
1042de3b87aSKai Wang.It Bq Er ELF_E_SECTION
1052de3b87aSKai WangThe ELF descriptor in argument
1062de3b87aSKai Wang.Ar elf
1072de3b87aSKai Wangdid not adhere to the conventions used for extended numbering.
1082de3b87aSKai Wang.El
1092de3b87aSKai Wang.Sh SEE ALSO
1102de3b87aSKai Wang.Xr elf 3 ,
1112de3b87aSKai Wang.Xr elf32_getshdr 3 ,
1122de3b87aSKai Wang.Xr elf64_getshdr 3 ,
1132de3b87aSKai Wang.Xr elf_getdata 3 ,
1142de3b87aSKai Wang.Xr elf_rawdata 3 ,
1152de3b87aSKai Wang.Xr gelf 3 ,
1162de3b87aSKai Wang.Xr gelf_getshdr 3
117