https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92808

            Bug ID: 92808
           Summary: GCC sets BTI flag in .note.gnu.property section even
                    though not all functions are compiled with BTI
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: momchil.velikov at gmail dot com
  Target Milestone: ---

When GCC compiles the following source
```
__attribute__((target("branch-protection=pac-ret"))) int f() { return 0; }
__attribute__((target("branch-protection=bti"))) int g() { return 0; }
```

with

  aarch64-none-linux-gnu-gcc -c x7.c

the `.note.gnu.property` section has the BTI flag set:

```
$ llvm-readelf --notes x7.o
Displaying notes found at file offset 0x00000090 with length 0x00000020:
  Owner                Data size     Description
  GNU                  0x00000010    NT_GNU_PROPERTY_TYPE_0 (property note)
    Properties:    aarch64 feature: BTI

```

IMHO, the flag should be clear, since not all of the functions are compiled
with BTI.

Reply via email to