aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKai Wang <kaiw@FreeBSD.org>2010-07-21 10:39:29 +0000
committerKai Wang <kaiw@FreeBSD.org>2010-07-21 10:39:29 +0000
commitfff07a4233ac0166070431a563ed3b644a091885 (patch)
tree9e3351c461c35ef9a25f30454c83f6e09b0a3ccc /lib
parentf0f10541db7240f5b549bd2590c1eec9f3d17e4e (diff)
downloadsrc-fff07a4233ac0166070431a563ed3b644a091885.tar.gz
src-fff07a4233ac0166070431a563ed3b644a091885.zip
- Document that the *fsize() functions return a size of 1 for Elf
types that don't have a fixed size. - The *fsize() functions should return a size of 1, for variable length types. - Redefine symbol ELF_T_LAST to match the current end of the list. Obtained from: elftoolchain MFC after: 1 month
Notes
Notes: svn path=/head/; revision=210340
Diffstat (limited to 'lib')
-rw-r--r--lib/libelf/gelf_fsize.39
-rw-r--r--lib/libelf/libelf.h2
-rw-r--r--lib/libelf/libelf_data.c4
-rw-r--r--lib/libelf/libelf_fsize.m47
4 files changed, 10 insertions, 12 deletions
diff --git a/lib/libelf/gelf_fsize.3 b/lib/libelf/gelf_fsize.3
index 59fc5c2cf381..2f7036bb3263 100644
--- a/lib/libelf/gelf_fsize.3
+++ b/lib/libelf/gelf_fsize.3
@@ -47,9 +47,8 @@ These functions return the size in bytes of the file representation of
.Ar count
numbers of objects of ELF type
.Ar type .
-Argument
-.Ar type
-must be one that has a fixed size file representation.
+For ELF types that are of variable length, these functions return a
+size of one byte.
.Pp
Functions
.Fn elf32_fsize
@@ -83,10 +82,6 @@ had an unknown ELF class.
Argument
.Ar type
contained an illegal value.
-.It Bq Er ELF_E_ARGUMENT
-Argument
-.Ar type
-denoted an ELF type with variable size.
.It Bq Er ELF_E_UNIMPL
Support for ELF type
.Ar type
diff --git a/lib/libelf/libelf.h b/lib/libelf/libelf.h
index 7a707c30e547..ac4c04e26c70 100644
--- a/lib/libelf/libelf.h
+++ b/lib/libelf/libelf.h
@@ -80,7 +80,7 @@ typedef enum {
} Elf_Type;
#define ELF_T_FIRST ELF_T_ADDR
-#define ELF_T_LAST ELF_T_XWORD
+#define ELF_T_LAST ELF_T_GNUHASH
/* Commands */
typedef enum {
diff --git a/lib/libelf/libelf_data.c b/lib/libelf/libelf_data.c
index 77493005bc1f..8f88694573e0 100644
--- a/lib/libelf/libelf_data.c
+++ b/lib/libelf/libelf_data.c
@@ -42,6 +42,10 @@ _libelf_xlate_shtype(uint32_t sht)
return (ELF_T_SYM);
case SHT_FINI_ARRAY:
return (ELF_T_ADDR);
+#if __FreeBSD_version >= 800062
+ case SHT_GNU_HASH:
+ return (ELF_T_GNUHASH);
+#endif
case SHT_GROUP:
return (ELF_T_WORD);
case SHT_HASH:
diff --git a/lib/libelf/libelf_fsize.m4 b/lib/libelf/libelf_fsize.m4
index 53b97702bdc8..1cea99713a04 100644
--- a/lib/libelf/libelf_fsize.m4
+++ b/lib/libelf/libelf_fsize.m4
@@ -48,8 +48,8 @@ define(`BYTE_SIZE', 1)
define(`IDENT_SIZE', `EI_NIDENT')
/* Types that have variable length. */
-define(`GNUHASH_SIZE', 0)
-define(`NOTE_SIZE', 0)
+define(`GNUHASH_SIZE', 1)
+define(`NOTE_SIZE', 1)
/* Currently unimplemented types. */
define(`MOVEP_SIZE', 0)
@@ -145,8 +145,7 @@ _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 ||
- t == ELF_T_NOTE || t == ELF_T_GNUHASH)
+ else if ((int) t < ELF_T_FIRST || t > ELF_T_LAST)
LIBELF_SET_ERROR(ARGUMENT, 0);
else {
sz = ec == ELFCLASS64 ? fsize[t].fsz64 : fsize[t].fsz32;