From owner-svn-src-all@FreeBSD.ORG Wed Jul 21 10:08:26 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 1D690106566C; Wed, 21 Jul 2010 10:08:26 +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 0CD7A8FC13; Wed, 21 Jul 2010 10:08:26 +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 o6LA8Pd7084181; Wed, 21 Jul 2010 10:08:25 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6LA8PgG084179; Wed, 21 Jul 2010 10:08:25 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201007211008.o6LA8PgG084179@svn.freebsd.org> From: Kai Wang Date: Wed, 21 Jul 2010 10:08:25 +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: r210335 - 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:08:26 -0000 Author: kaiw Date: Wed Jul 21 10:08:25 2010 New Revision: 210335 URL: http://svn.freebsd.org/changeset/base/210335 Log: - Return zero for file sizes of ELF types that have a variable size. - Neaten a few comments. Obtained from: elftoolchain MFC after: 1 month Modified: head/lib/libelf/libelf_fsize.m4 Modified: head/lib/libelf/libelf_fsize.m4 ============================================================================== --- head/lib/libelf/libelf_fsize.m4 Wed Jul 21 10:05:07 2010 (r210334) +++ head/lib/libelf/libelf_fsize.m4 Wed Jul 21 10:08:25 2010 (r210335) @@ -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, unsign 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;