[all-commits] [llvm/llvm-project] 6ab892: [RISCV] Support clang -fpatchable-function-entry &...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Mar 16 10:02:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ab8927931851bb42b2c93a00801dc499d7d9b1e
      https://github.com/llvm/llvm-project/commit/6ab8927931851bb42b2c93a00801dc499d7d9b1e
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-03-16 (Tue, 16 Mar 2021)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/fpatchable-function-entry.c
    M clang/test/Sema/patchable-function-entry-attr.cpp
    M llvm/lib/Target/RISCV/RISCV.h
    M llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.h
    M llvm/lib/Target/RISCV/RISCVMCInstLower.cpp
    A llvm/test/CodeGen/RISCV/patchable-function-entry.ll

  Log Message:
  -----------
  [RISCV] Support clang -fpatchable-function-entry && GNU function attribute 'patchable_function_entry'

Similar to D72215 (AArch64) and D72220 (x86).

```
% clang -target riscv32 -march=rv64g -c -fpatchable-function-entry=2 a.c && llvm-objdump -dr a.o
...
0000000000000000 <main>:
       0: 13 00 00 00   nop
       4: 13 00 00 00   nop

% clang -target riscv32 -march=rv64gc -c -fpatchable-function-entry=2 a.c && llvm-objdump -dr a.o
...
00000002 <main>:
       2: 01 00         nop
       4: 01 00         nop
```

Recently the mainline kernel started to use -fpatchable-function-entry=8 for riscv (https://git.kernel.org/linus/afc76b8b80112189b6f11e67e19cf58301944814).

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




More information about the All-commits mailing list