xref: /netbsd-src/external/bsd/elftoolchain/dist/libelf/elf_strptr.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1*5ac3bc71Schristos.\"	$NetBSD: elf_strptr.3,v 1.6 2024/03/03 17:37:33 christos Exp $
2e81373b4Schristos.\"
39dd9d0cfSchristos.\" Copyright (c) 2006,2008 Joseph Koshy.  All rights reserved.
49dd9d0cfSchristos.\"
59dd9d0cfSchristos.\" Redistribution and use in source and binary forms, with or without
69dd9d0cfSchristos.\" modification, are permitted provided that the following conditions
79dd9d0cfSchristos.\" are met:
89dd9d0cfSchristos.\" 1. Redistributions of source code must retain the above copyright
99dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer.
109dd9d0cfSchristos.\" 2. Redistributions in binary form must reproduce the above copyright
119dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer in the
129dd9d0cfSchristos.\"    documentation and/or other materials provided with the distribution.
139dd9d0cfSchristos.\"
149dd9d0cfSchristos.\" This software is provided by Joseph Koshy ``as is'' and
159dd9d0cfSchristos.\" any express or implied warranties, including, but not limited to, the
169dd9d0cfSchristos.\" implied warranties of merchantability and fitness for a particular purpose
179dd9d0cfSchristos.\" are disclaimed.  in no event shall Joseph Koshy be liable
189dd9d0cfSchristos.\" for any direct, indirect, incidental, special, exemplary, or consequential
199dd9d0cfSchristos.\" damages (including, but not limited to, procurement of substitute goods
209dd9d0cfSchristos.\" or services; loss of use, data, or profits; or business interruption)
219dd9d0cfSchristos.\" however caused and on any theory of liability, whether in contract, strict
229dd9d0cfSchristos.\" liability, or tort (including negligence or otherwise) arising in any way
239dd9d0cfSchristos.\" out of the use of this software, even if advised of the possibility of
249dd9d0cfSchristos.\" such damage.
259dd9d0cfSchristos.\"
263f622274Sjkoshy.\" Id: elf_strptr.3 3957 2022-03-12 14:11:52Z jkoshy
279dd9d0cfSchristos.\"
289dd9d0cfSchristos.Dd December 16, 2006
299dd9d0cfSchristos.Dt ELF_STRPTR 3
30c5261b83Sjkoshy.Os
319dd9d0cfSchristos.Sh NAME
329dd9d0cfSchristos.Nm elf_strptr
339dd9d0cfSchristos.Nd retrieve a string pointer in a string table
349dd9d0cfSchristos.Sh LIBRARY
359dd9d0cfSchristos.Lb libelf
369dd9d0cfSchristos.Sh SYNOPSIS
379dd9d0cfSchristos.In libelf.h
389dd9d0cfSchristos.Ft "char *"
399dd9d0cfSchristos.Fn elf_strptr "Elf *elf" "size_t scndx" "size_t stroffset"
409dd9d0cfSchristos.Sh DESCRIPTION
419dd9d0cfSchristosFunction
429dd9d0cfSchristos.Fn elf_strptr
439dd9d0cfSchristosallows an application to convert a string table offset to a string
449dd9d0cfSchristospointer, correctly translating the offset in the presence
459dd9d0cfSchristosof multiple
469dd9d0cfSchristos.Vt Elf_Data
479dd9d0cfSchristosdescriptors covering the contents of the section.
489dd9d0cfSchristos.Pp
499dd9d0cfSchristosArgument
503f622274Sjkoshy.Fa elf
519dd9d0cfSchristosis a descriptor for an ELF object.
529dd9d0cfSchristosArgument
533f622274Sjkoshy.Fa scndx
549dd9d0cfSchristosis the section index for an ELF string table.
559dd9d0cfSchristosArgument
563f622274Sjkoshy.Fa stroffset
579dd9d0cfSchristosis the index of the desired string in the string
589dd9d0cfSchristostable.
599dd9d0cfSchristos.Sh RETURN VALUES
609dd9d0cfSchristosFunction
619dd9d0cfSchristos.Fn elf_strptr
62c5261b83Sjkoshyreturns a valid pointer on success or
63c5261b83Sjkoshy.Dv NULL
64c5261b83Sjkoshyin case an error was encountered.
659dd9d0cfSchristos.Sh ERRORS
669dd9d0cfSchristos.Bl -tag -width "[ELF_E_RESOURCE]"
679dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
689dd9d0cfSchristosArgument
693f622274Sjkoshy.Fa elf
70c5261b83Sjkoshywas
71c5261b83Sjkoshy.Dv NULL .
729dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
739dd9d0cfSchristosArgument
743f622274Sjkoshy.Fa elf
759dd9d0cfSchristoswas not a descriptor for an ELF object.
769dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
779dd9d0cfSchristosArgument
783f622274Sjkoshy.Fa scndx
799dd9d0cfSchristoswas not the section index for a string table.
809dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
819dd9d0cfSchristosArgument
823f622274Sjkoshy.Fa stroffset
839dd9d0cfSchristosexceeded the size of the string table.
849dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
859dd9d0cfSchristosArgument
863f622274Sjkoshy.Fa stroffset
879dd9d0cfSchristosindex an unallocated region of the string table.
889dd9d0cfSchristos.It Bq Er ELF_E_DATA
899dd9d0cfSchristosOffset
903f622274Sjkoshy.Fa stroffset
919dd9d0cfSchristosindexed a region that was not covered by any Elf_Data
929dd9d0cfSchristosdescriptor.
939dd9d0cfSchristos.It Bq Er ELF_E_DATA
949dd9d0cfSchristosAn erroneous
959dd9d0cfSchristos.Vt Elf_Data
969dd9d0cfSchristosdescriptor was part of the section specified by argument
973f622274Sjkoshy.Fa scndx .
989dd9d0cfSchristos.It Bq Er ELF_E_HEADER
999dd9d0cfSchristosELF descriptor
1003f622274Sjkoshy.Fa elf
1019dd9d0cfSchristoscontained an invalid section header.
1029dd9d0cfSchristos.It Bq Er ELF_E_RESOURCE
1039dd9d0cfSchristosAn out of memory condition was detected.
1049dd9d0cfSchristos.It Bq Er ELF_E_SECTION
1059dd9d0cfSchristosSection
1063f622274Sjkoshy.Fa scndx
1079dd9d0cfSchristoscontained a malformed section header.
1089dd9d0cfSchristos.It Bq Er ELF_E_SECTION
1099dd9d0cfSchristosThe ELF descriptor in argument
1103f622274Sjkoshy.Fa elf
1119dd9d0cfSchristosdid not adhere to the conventions used for extended numbering.
1129dd9d0cfSchristos.El
1139dd9d0cfSchristos.Sh SEE ALSO
1149dd9d0cfSchristos.Xr elf 3 ,
1159dd9d0cfSchristos.Xr elf32_getshdr 3 ,
1169dd9d0cfSchristos.Xr elf64_getshdr 3 ,
1179dd9d0cfSchristos.Xr elf_getdata 3 ,
1189dd9d0cfSchristos.Xr elf_rawdata 3 ,
1199dd9d0cfSchristos.Xr gelf 3 ,
1209dd9d0cfSchristos.Xr gelf_getshdr 3
121