From owner-svn-src-projects@freebsd.org Sun Jun 18 12:59:44 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FC89D90F7A for ; Sun, 18 Jun 2017 12:59:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 107596F267; Sun, 18 Jun 2017 12:59:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5ICxhga046160; Sun, 18 Jun 2017 12:59:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5ICxhla046159; Sun, 18 Jun 2017 12:59:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706181259.v5ICxhla046159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Jun 2017 12:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r320071 - projects/clang500-import/contrib/llvm/tools/lld/ELF X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jun 2017 12:59:44 -0000 Author: dim Date: Sun Jun 18 12:59:43 2017 New Revision: 320071 URL: https://svnweb.freebsd.org/changeset/base/320071 Log: Revert changes in r312891 and go back to stock lld code for rounding the PT_GNU_RELRO p_memsz. This should now work properly for FreeBSD. Modified: projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp Modified: projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp Sun Jun 18 12:28:43 2017 (r320070) +++ projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp Sun Jun 18 12:59:43 2017 (r320071) @@ -1644,8 +1644,13 @@ template void Writer::setPhdrs() { } if (P.p_type == PT_LOAD) P.p_align = Config->MaxPageSize; - else if (P.p_type == PT_GNU_RELRO) + else if (P.p_type == PT_GNU_RELRO) { P.p_align = 1; + // The glibc dynamic loader rounds the size down, so we need to round up + // to protect the last page. This is a no-op on FreeBSD which always + // rounds up. + P.p_memsz = alignTo(P.p_memsz, Target->PageSize); + } // The TLS pointer goes after PT_TLS. At least glibc will align it, // so round up the size to make sure the offsets are correct.