<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 - Sets execute permissions but GNU objcopy does not"
   href="https://bugs.llvm.org/show_bug.cgi?id=42082">42082</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Sets execute permissions but GNU objcopy does not
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llvm-objcopy/strip
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alexbrachetmialot@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>alexander.v.shaposhnikov@gmail.com, jake.h.ehrlich@gmail.com, jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org, rupprecht@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>llvm-objcopy writes files with all 3 execute bits set. This is not what GNU
objcopy does. Is this intended? This happens on line 39 of Buffer.cpp where we
create the FileOutputBuffer, if we just remove the F_executable flag we will
have the same behaviour as GNU objcopy. 

$ llvm-objcopy --strip-symbol=func test.o no_func_llvm.o
$ objcopy --strip-symbol=func test.o no_func_gnu.o
$ ls -l
-rw-rw-r-- 1 abrachet abrachet 1648 May 30 22:38 no_func_gnu.o
-rwxrwxr-x 1 abrachet abrachet 1648 May 30 22:38 no_func_llvm.o

For reference:
$ objcopy --version
GNU objcopy (GNU Binutils for Ubuntu) 2.30

$ llvm-objcopy --version
llvm-objcopy, compatible with GNU objcopy
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
  LLVM version 9.0.0svn
  DEBUG build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake

$ file test.o
test.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped</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>