[all-commits] [llvm/llvm-project] cbd481: [AArch64] -fpatchable-function-entry=N, 0: place pa...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Feb 3 05:00:32 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: cbd4815dec165fc4190f30cd6f409334c7e59063
      https://github.com/llvm/llvm-project/commit/cbd4815dec165fc4190f30cd6f409334c7e59063
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-02-03 (Mon, 03 Feb 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/AsmPrinter.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/test/CodeGen/AArch64/patchable-function-entry-bti.ll

  Log Message:
  -----------
  [AArch64] -fpatchable-function-entry=N,0: place patch label after BTI

Summary:
For -fpatchable-function-entry=N,0 -mbranch-protection=bti, after
9a24488cb67a90f889529987275c5e411ce01dda, we place the NOP sled after
the initial BTI.

```
.Lfunc_begin0:
bti c
nop
nop

.section __patchable_function_entries,"awo", at progbits,f,unique,0
.p2align 3
.xword .Lfunc_begin0
```

This patch adds a label after the initial BTI and changes the __patchable_function_entries entry to reference the label:

```
.Lfunc_begin0:
bti c
.Lpatch0:
nop
nop

.section __patchable_function_entries,"awo", at progbits,f,unique,0
.p2align 3
.xword .Lpatch0
```

This placement is compatible with the resolution in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92424 .

A local linkage function whose address is not taken does not need a BTI.
Placing the patch label after BTI has the advantage that code does not
need to differentiate whether the function has an initial BTI.

Reviewers: mrutland, nickdesaulniers, nsz, ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73680

(cherry picked from commit 06b8e32d4fd3f634f793e3bc0bc4fdb885e7a3ac)




More information about the All-commits mailing list