<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 - [AArch64] .note.gnu.property always generated for object file without code"
   href="https://bugs.llvm.org/show_bug.cgi?id=46480">46480</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] .note.gnu.property always generated for object file without code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>keescook@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The .note.gnu.property is generated even when -mbranch-protection=none is used,
on a source file that only has data (no code).


$ cat foo.c
int global = 5;
$ clang --target=aarch64-linux-gnu -c -o foo.o foo.c
$ readelf -n foo.o

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI, PAC
$ clang --target=aarch64-linux-gnu -mbranch-protection=none -c -o foo.o foo.c
$ readelf -n foo.o

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI, PAC
$ aarch64-linux-gnu-gcc -c -o foo.o foo.c
$ readelf -n foo.o
$ aarch64-linux-gnu-gcc -mbranch-protection=bti -c -o foo.o foo.c
$ readelf -n foo.o

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI



$ cat bar.c
int code(void) { return 5; }
$ clang --target=aarch64-linux-gnu -c -o bar.o bar.c
$ readelf -n bar.o
$ clang --target=aarch64-linux-gnu -mbranch-protection=bti -c -o bar.o bar.c
$ readelf -n bar.o

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI</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>