llvm with tablegen backend for capstone disassembler
Go to file
Rafael Espindola b70824c1b8 Revert r318924 Skip over empty sections when checking for contiguous relro
PR35478 https://bugs.llvm.org/show_bug.cgi?id=35478 points out a flaw
in the implementation of r318924 from D40364. The implementation
depends on the Size field being set or the SyntheticSection::empty()
being accurate. These functions are not reliable as some linker script
commands that have yet to be processed may affect the results, causing
some non-zero size sections to be reported as zero size.

I think the first step is to revert r318924 and come up with a better
solution for the underlying problem rather than trying to layer more
heuristics onto the zero sized output section.

Chances are I'll be out of office by the time anyone sees this so feel
free to commit the revert if you agree with me.

Fixes PR35478

Current thoughts on the underlying problem:

Revisiting the motivation for adding the zero size check in the first
place; it was to prevent 0 sized SyntheticSections that a user does
not have full control over from needlessly breaking the PT_GNU_RELRO,
rather than trying to accommodate arbitrarily complex linker
scripts. Looking at the code, it looks like
removeUnusedSyntheticSections() should remove zero sized synthetic
sections. It does, but it doesn't set the Parent to nullptr, this has
the side effect that Sec == InX::BssRelRo->getParent() will make the
parent OutputSection of InX::BssRelRo RelRo even if there is no
InX::BssRelRo.

I tried a quick experiment with setting the Parent to nullptr and this
flushed out a few interesting test failures, it feels like playing
Jenga with every change:

    In the isRelroSection() we have to consider the case where there
    is no .plt and .plt.got but there is a ifunc plt with accompanying
    (ifunc .got or .plt.got)

    The PPC64 has PltHeaderSize == 0. Unfortunately HeaderSize == 0 is
    used to choose between the ifunc plt or normal plt. We seem to get
    away with this at the moment, but tests start to fail when Parent
    is set to nullptr for the .got.plt.

    The InX::BssRelRo and InX::Bss never get their sizes set and they
    are always removed by removeUnusedSyntheticSections(), their
    purpose seems to be as some kind of proxy for add .bss or
    .bss.relro InputSections into their parent OutputSections, they
    therefore don't behave like other SyntheticSections anyway.

My thinking is that some work is needed to make sure that the Sec ==
SyntheticSection->getParent() does a bit more checking before
returning true, particularly for InX::BssRelRo as that has special
behaviour. I'll hope to post something for review as soon as possible.

Patch by Peter Smith!

llvm-svn: 319563
2017-12-01 18:14:14 +00:00
clang [OPENMP] Do not allow variables to be first|last-privates in 2017-12-01 17:40:15 +00:00
clang-tools-extra [clangd] Fuzzy match scorer 2017-12-01 17:08:02 +00:00
compiler-rt Add missing signal.h header: 2017-12-01 11:12:58 +00:00
debuginfo-tests Re-revert "Refactor debuginfo-tests." 2017-11-21 01:20:28 +00:00
libclc configure.py: Add gfx900 (Vega, Raven) 2017-11-27 11:14:06 +00:00
libcxx [libcxx] Support getentropy as a source of randomness for std::random_device 2017-12-01 06:34:33 +00:00
libcxxabi [libc++abi] Add install-cxxabi-stripped target 2017-11-30 23:25:51 +00:00
libunwind [libunwind] Switch to add_llvm_install_targets 2017-11-30 23:24:08 +00:00
lld Revert r318924 Skip over empty sections when checking for contiguous relro 2017-12-01 18:14:14 +00:00
lldb Kill struct IOVEC 2017-12-01 12:05:00 +00:00
llgo irgen: Create functions instead of global variables for builtin hash and equal algorithms. 2017-06-04 22:11:28 +00:00
llvm Revert "[opt-remarks] If hotness threshold is set, ignore remarks without hotness" 2017-12-01 18:12:29 +00:00
openmp [CMake] Detect information about test compiler 2017-11-30 17:08:31 +00:00
parallel-libs
polly [NFC] In GPGPU testcases, replace numeric registers in CHECK directives. 2017-12-01 14:16:39 +00:00
README.md Add an svn project to contain the files that appear at the root of the 2017-10-19 21:09:49 +00:00

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.