From owner-cvs-src-old@FreeBSD.ORG Fri Jul 23 17:08:42 2010 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C22D106568A for ; Fri, 23 Jul 2010 17:08:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0A26B8FC15 for ; Fri, 23 Jul 2010 17:08:42 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o6NH8fWU093280 for ; Fri, 23 Jul 2010 17:08:41 GMT (envelope-from avg@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o6NH8fnf093279 for cvs-src-old@freebsd.org; Fri, 23 Jul 2010 17:08:41 GMT (envelope-from avg@repoman.freebsd.org) Message-Id: <201007231708.o6NH8fnf093279@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to avg@repoman.freebsd.org using -f From: Andriy Gapon Date: Fri, 23 Jul 2010 17:07:51 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/boot/common load_elf_obj.c src/sys/kern link_elf_obj.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 17:08:42 -0000 avg 2010-07-23 17:07:51 UTC FreeBSD src repository Modified files: sys/boot/common load_elf_obj.c sys/kern link_elf_obj.c Log: SVN rev 210423 on 2010-07-23 17:07:51Z by avg completely ignore zero-sized elf sections in modules of elf object type (amd64) Current code doesn't check size of elf sections and may perform needless actions of zero-sized memory allocation and similar. The bigger issue is that alignment requirement of a zero-sized section gets effectively applied to the next section if it has smaller alignment requirement. But other tools, like gdb and consequently kgdb, completely ignore zero-sized sections and thus may map symbols to addresses differently. Zero-sized sections are not typical in general. Their typical (only, even) cause in FreeBSD modules is inline assembly that creates custom sections which is found in pcpu.h and vnet.h. Mere inclusion of one of those header files produces a custom section in elf output. If there is no actual use for the section in a given module, then the section remains empty. Better solution is to avoid creating zero-sized sections altogether, which is in plans. Preloaded modules are handled in boot code (load_elf_obj.c), while dynamically loaded modules are handled by kernel (link_elf_obj.c). Based on code by: np MFC after: 3 weeks Revision Changes Path 1.3 +2 -0 src/sys/boot/common/load_elf_obj.c 1.113 +6 -0 src/sys/kern/link_elf_obj.c