From owner-svn-src-all@FreeBSD.ORG Mon Dec 15 18:18:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58A912A0; Mon, 15 Dec 2014 18:18:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 449EC239; Mon, 15 Dec 2014 18:18:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBFIIwoS023000; Mon, 15 Dec 2014 18:18:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBFIIwYM022999; Mon, 15 Dec 2014 18:18:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201412151818.sBFIIwYM022999@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 15 Dec 2014 18:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275810 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Mon, 15 Dec 2014 18:18:58 -0000 Author: emaste Date: Mon Dec 15 18:18:57 2014 New Revision: 275810 URL: https://svnweb.freebsd.org/changeset/base/275810 Log: Correct elftoolchain strip(1) memory size calculation Calculate the segment's memory size (p_memsz) using the virtual addresses, not the file offsets. Otherwise padding preceeding SHT_NOBITS sections may be excluded from the calculation, resulting in a segment that is too small. PR: 195653 Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/elfcopy/segments.c Modified: head/contrib/elftoolchain/elfcopy/segments.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 15 18:13:03 2014 (r275809) +++ head/contrib/elftoolchain/elfcopy/segments.c Mon Dec 15 18:18:57 2014 (r275810) @@ -439,7 +439,7 @@ copy_phdr(struct elfcopy *ecp) seg->fsz = seg->msz = 0; for (i = 0; i < seg->nsec; i++) { s = seg->v_sec[i]; - seg->msz = s->off + s->sz - seg->off; + seg->msz = s->vma + s->sz - seg->addr; if (s->type != SHT_NOBITS) seg->fsz = seg->msz; }