From owner-svn-src-all@FreeBSD.ORG Wed Jul 21 10:39:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAB50106567D; Wed, 21 Jul 2010 10:39:29 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F08D8FC08; Wed, 21 Jul 2010 10:39:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6LAdTZR091324; Wed, 21 Jul 2010 10:39:29 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6LAdTxY091319; Wed, 21 Jul 2010 10:39:29 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201007211039.o6LAdTxY091319@svn.freebsd.org> From: Kai Wang Date: Wed, 21 Jul 2010 10:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210340 - head/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2010 10:39:29 -0000 Author: kaiw Date: Wed Jul 21 10:39:29 2010 New Revision: 210340 URL: http://svn.freebsd.org/changeset/base/210340 Log: - 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 Modified: head/lib/libelf/gelf_fsize.3 head/lib/libelf/libelf.h head/lib/libelf/libelf_data.c head/lib/libelf/libelf_fsize.m4 Modified: head/lib/libelf/gelf_fsize.3 ============================================================================== --- head/lib/libelf/gelf_fsize.3 Wed Jul 21 10:36:27 2010 (r210339) +++ head/lib/libelf/gelf_fsize.3 Wed Jul 21 10:39:29 2010 (r210340) @@ -47,9 +47,8 @@ These functions return the size in bytes .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 Modified: head/lib/libelf/libelf.h ============================================================================== --- head/lib/libelf/libelf.h Wed Jul 21 10:36:27 2010 (r210339) +++ head/lib/libelf/libelf.h Wed Jul 21 10:39:29 2010 (r210340) @@ -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 { Modified: head/lib/libelf/libelf_data.c ============================================================================== --- head/lib/libelf/libelf_data.c Wed Jul 21 10:36:27 2010 (r210339) +++ head/lib/libelf/libelf_data.c Wed Jul 21 10:39:29 2010 (r210340) @@ -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: Modified: head/lib/libelf/libelf_fsize.m4 ============================================================================== --- head/lib/libelf/libelf_fsize.m4 Wed Jul 21 10:36:27 2010 (r210339) +++ head/lib/libelf/libelf_fsize.m4 Wed Jul 21 10:39:29 2010 (r210340) @@ -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, unsign 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;