diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-18 12:59:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-18 12:59:43 +0000 |
commit | 4dd7e4366252d8a36840d999bb040a288ec8b299 (patch) | |
tree | f7e616211333f93e9e15658eba440b2209db6013 /contrib | |
parent | f32b3b5783908ddbf1f7d1690106d22328a74758 (diff) | |
download | src-4dd7e4366252d8a36840d999bb040a288ec8b299.tar.gz src-4dd7e4366252d8a36840d999bb040a288ec8b299.zip |
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.
Notes
Notes:
svn path=/projects/clang500-import/; revision=320071
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/llvm/tools/lld/ELF/Writer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/llvm/tools/lld/ELF/Writer.cpp b/contrib/llvm/tools/lld/ELF/Writer.cpp index 4e0479ddf2b9..4ff06388ec78 100644 --- a/contrib/llvm/tools/lld/ELF/Writer.cpp +++ b/contrib/llvm/tools/lld/ELF/Writer.cpp @@ -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. |