<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - compiler-rt: files contain writable and executable sections"
   href="https://bugs.llvm.org/show_bug.cgi?id=35739">35739</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>compiler-rt: files contain writable and executable sections
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>willwiemann@fake-box.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>My Linux system detected some writeable and executable sections in the files

usr/lib/clang/5.0.1/lib/linux/libclang_rt.builtins-x86_64.a:chkstk.S.o
usr/lib/clang/5.0.1/lib/linux/libclang_rt.builtins-x86_64.a:chkstk2.S.o
usr/lib/clang/5.0.1/lib/linux/libclang_rt.builtins-i386.a:chkstk.S.o
usr/lib/clang/5.0.1/lib/linux/libclang_rt.builtins-i386.a:chkstk2.S.o

I do not understand entirely why this is the case. However, I'm not alone with
this  (see related issues by other projects).

This is what I've found out so far.

The commit [1] fixed part of this but did not cover {i386,x86_64}/chkstk.S,
{i386,x86_64}/chkstk2.S. The reason might be that NO_EXEC_STACK_DIRECTIVE is a
NO-OP on Windows and according to the comments in the files chkstk.S and
chkstk2.S are windows only. This impression is supported by
lib/builtin/CMakeFiles.txt which explicitly includes these files as additional
x86_64_SOURCES (line 247).
However, these files are already included in x86_64_SOURCES (same for
i386_SOURCES). This was done by commit [2]. Looking at this commit more
closely, it  adds chkstk.S and chkstk2.S unconditionally even though they were
conditionally included. My guess is that these files were added accidentally by
[2] and should only be compiled on Windows.

[1]
git-sha: 4c71a477ac0bd7b19c72d7625861f1f18c15b278
git-svn-id: <a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk@273500">https://llvm.org/svn/llvm-project/compiler-rt/trunk@273500</a>
91177308-0d34-0410-b5e6-96231b3b80d8

[2]
git-sha: a405fc16c3227898f22422a045ee2e36bc605776
git-svn-id: <a href="https://llvm.org/svn/llvm-project/compiler-rt/trunk@252927">https://llvm.org/svn/llvm-project/compiler-rt/trunk@252927</a>
91177308-0d34-0410-b5e6-96231b3b80d8

Related issues by other projects:

rust: <a href="https://github.com/rust-lang-nursery/compiler-builtins/issues/183">https://github.com/rust-lang-nursery/compiler-builtins/issues/183</a>
gentoo: <a href="https://bugs.gentoo.org/show_bug.cgi?id=641026">https://bugs.gentoo.org/show_bug.cgi?id=641026</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>