diff options
author | kaiw <kaiw@FreeBSD.org> | 2010-07-21 08:54:46 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2010-07-21 08:54:46 +0000 |
commit | 19ba81c75ab61e11e242da176f498a77890674fe (patch) | |
tree | 9f252b8a2b18f7aca5a209ccd3e4417297b74185 /lib/libelf/elf_getdata.3 | |
parent | 6a464b6e13572e62258c8ed48f1dd4235782d6be (diff) | |
download | FreeBSD-src-19ba81c75ab61e11e242da176f498a77890674fe.zip FreeBSD-src-19ba81c75ab61e11e242da176f498a77890674fe.tar.gz |
- Correctly handle sections of type SHT_NOBITS. For these sections:
- elf_getdata() and elf_rawdata() should return an "Elf_Data" structure
that has its "d_buf" member set to NULL and "d_size" member set to
the nominal 'size' of the section. [1]
- Update the manual page for these functions.
- Fix a memory leak in an error handling path inside elf_getdata().
- Use _libelf_allocate_data() in elf_newdata() for consistency.
Obtained from: elftoolchain
MFC after: 1 month
Diffstat (limited to 'lib/libelf/elf_getdata.3')
-rw-r--r-- | lib/libelf/elf_getdata.3 | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/libelf/elf_getdata.3 b/lib/libelf/elf_getdata.3 index 10f3763..565c77c 100644 --- a/lib/libelf/elf_getdata.3 +++ b/lib/libelf/elf_getdata.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -142,6 +142,32 @@ always returns .Vt Elf_Data structures of type .Dv ELF_T_BYTE . +.Ss Special handling of SHT_NOBITS sections +For sections of type +.Dv SHT_NOBITS , +the functions +.Fn elf_getdata +and +.Fn elf_rawdata +return a pointer to a valid +.Vt Elf_Data +structure that has its +.Va d_buf +member set to NULL and its +.Va d_size +member set to the size of the section. +.Pp +If an application wishes to create a section of type +.Dv SHT_NOBITS , +it should add a data buffer to the section using function +.Fn elf_newdata . +It should then set the +.Va d_buf +and +.Va d_size +members of the returned +.Vt Elf_Data +structure to NULL and the desired size of the section respectively. .Sh RETURN VALUES These functions return a valid pointer to a data descriptor if successful, or NULL if an error occurs. |