aarch64: don't emit bti j after NOTE_INSN_DELETED_LABEL [PR94748]
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 24 Apr 2020 16:36:02 +0000 (17:36 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 30 Apr 2020 12:08:13 +0000 (13:08 +0100)
commit6ac83d350604c3e934d5e8a455ba7ec1c1c0240b
tree8b9427647583160e8ccb026c6a5e718a070aa25a
parent852c4b04520d19d5a75e7f9ec5a5d980d5d1acc8
aarch64: don't emit bti j after NOTE_INSN_DELETED_LABEL [PR94748]

It was previously discussed that indirect branches cannot go to
NOTE_INSN_DELETED_LABEL so inserting a landing pad is unnecessary.
See https://gcc.gnu.org/pipermail/gcc-patches/2019-May/522625.html

Before the patch a bti j was inserted after the label in

  __attribute__((target("branch-protection=bti")))
  int foo (void)
  {
  label:
    return 0;
  }

This is not necessary and weakens the security protection.

gcc/ChangeLog:

PR target/94748
* config/aarch64/aarch64-bti-insert.c (rest_of_insert_bti): Remove
the check for NOTE_INSN_DELETED_LABEL.

gcc/testsuite/ChangeLog:

PR target/94748
* gcc.target/aarch64/pr94748.c: New test.
gcc/ChangeLog
gcc/config/aarch64/aarch64-bti-insert.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr94748.c [new file with mode: 0644]