summaryrefslogtreecommitdiffstats
path: root/lib/libelf
diff options
context:
space:
mode:
authorkaiw <kaiw@FreeBSD.org>2010-07-21 10:08:25 +0000
committerkaiw <kaiw@FreeBSD.org>2010-07-21 10:08:25 +0000
commita9edf336a0b10a5fb2a96b2cfa58c735873e536b (patch)
tree25f10654073da8ffd634d7e37f037685b72092d1 /lib/libelf
parentc3ada57ad603e9afae392445c172bef1d84cb6ee (diff)
downloadFreeBSD-src-a9edf336a0b10a5fb2a96b2cfa58c735873e536b.zip
FreeBSD-src-a9edf336a0b10a5fb2a96b2cfa58c735873e536b.tar.gz
- Return zero for file sizes of ELF types that have a variable size.
- Neaten a few comments. Obtained from: elftoolchain MFC after: 1 month
Diffstat (limited to 'lib/libelf')
-rw-r--r--lib/libelf/libelf_fsize.m415
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libelf/libelf_fsize.m4 b/lib/libelf/libelf_fsize.m4
index 83d6cbd..58d1d94 100644
--- a/lib/libelf/libelf_fsize.m4
+++ b/lib/libelf/libelf_fsize.m4
@@ -43,16 +43,18 @@ include(SRCDIR`/elf_types.m4')
* representations.
*/
-/* `Basic' types */
+/* `Basic' types. */
define(`BYTE_SIZE', 1)
-define(`GNUHASH_SIZE', 1) /* Elf_GNU_Hash_Header structures vary in length. */
define(`IDENT_SIZE', `EI_NIDENT')
-define(`NOTE_SIZE', 1) /* Elf_Note structures have variable length. */
-/* Currently unimplemented types */
+/* Types that have variable length. */
+define(`GNUHASH_SIZE', 0) /* Elf_GNU_Hash_Header structures vary in length. */
+define(`NOTE_SIZE', 0) /* Elf_Note structures have variable length. */
+
+/* Currently unimplemented types. */
define(`MOVEP_SIZE', 0)
-/* Overrides for 32 bit types that do not exist */
+/* Overrides for 32 bit types that do not exist. */
define(`XWORD_SIZE32', 0)
define(`SXWORD_SIZE32', 0)
@@ -143,7 +145,8 @@ _libelf_fsize(Elf_Type t, int ec, unsigned int v, size_t c)
sz = 0;
if (v != EV_CURRENT)
LIBELF_SET_ERROR(VERSION, 0);
- else if ((int) t < ELF_T_FIRST || t > ELF_T_LAST)
+ else if ((int) t < ELF_T_FIRST || t > ELF_T_LAST ||
+ t == ELF_T_NOTE || t == ELF_T_GNUHASH)
LIBELF_SET_ERROR(ARGUMENT, 0);
else {
sz = ec == ELFCLASS64 ? fsize[t].fsz64 : fsize[t].fsz32;
OpenPOWER on IntegriCloud