Date: Sun, 18 Jun 2017 12:59:43 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r320071 - projects/clang500-import/contrib/llvm/tools/lld/ELF Message-ID: <201706181259.v5ICxhla046159@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <class ELFT> void Writer<ELFT>::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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706181259.v5ICxhla046159>