[all-commits] [llvm/llvm-project] 4d1e23: [AArch64] Add function attribute "patchable-functi...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Jan 10 09:57:49 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 4d1e23e3b3cd7c72a8b24dc5acb7e13c58a8de37
https://github.com/llvm/llvm-project/commit/4d1e23e3b3cd7c72a8b24dc5acb7e13c58a8de37
Author: Fangrui Song <maskray at google.com>
Date: 2020-01-10 (Fri, 10 Jan 2020)
Changed paths:
M llvm/include/llvm/CodeGen/AsmPrinter.h
M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
M llvm/lib/CodeGen/PatchableFunction.cpp
M llvm/lib/IR/Verifier.cpp
M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
A llvm/test/CodeGen/AArch64/patchable-function-entry.ll
A llvm/test/Verifier/invalid-patchable-function-entry.ll
Log Message:
-----------
[AArch64] Add function attribute "patchable-function-entry" to add NOPs at function entry
The Linux kernel uses -fpatchable-function-entry to implement DYNAMIC_FTRACE_WITH_REGS
for arm64 and parisc. GCC 8 implemented
-fpatchable-function-entry, which can be seen as a generalized form of
-mnop-mcount. The N,M form (function entry points before the Mth NOP) is
currently only used by parisc.
This patch adds N,0 support to AArch64 codegen. N is represented as the
function attribute "patchable-function-entry". We will use a different
function attribute for M, if we decide to implement it.
The patch reuses the existing patchable-function pass, and
TargetOpcode::PATCHABLE_FUNCTION_ENTER which is currently used by XRay.
When the integrated assembler is used, __patchable_function_entries will
be created for each text section with the SHF_LINK_ORDER flag to prevent
--gc-sections (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93197) and
COMDAT (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93195) issues.
Retrospectively, __patchable_function_entries should use a PC-relative
relocation type to avoid the SHF_WRITE flag and dynamic relocations.
"patchable-function-entry"'s interaction with Branch Target
Identification is still unclear (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92424 for GCC discussions).
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D72215
Commit: a8fbdc576990653e92ce1d766659005678fd8514
https://github.com/llvm/llvm-project/commit/a8fbdc576990653e92ce1d766659005678fd8514
Author: Fangrui Song <maskray at google.com>
Date: 2020-01-10 (Fri, 10 Jan 2020)
Changed paths:
M llvm/lib/Target/X86/X86MCInstLower.cpp
A llvm/test/CodeGen/X86/patchable-function-entry.ll
Log Message:
-----------
[X86] Support function attribute "patchable-function-entry"
For x86-64, we diverge from GCC -fpatchable-function-entry in that we
emit multi-byte NOPs.
Differential Revision: https://reviews.llvm.org/D72220
Commit: a44c434b68e515ce9f2627367c83ff6b22328261
https://github.com/llvm/llvm-project/commit/a44c434b68e515ce9f2627367c83ff6b22328261
Author: Fangrui Song <maskray at google.com>
Date: 2020-01-10 (Fri, 10 Jan 2020)
Changed paths:
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Basic/AttrDocs.td
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Sema/SemaDeclAttr.cpp
A clang/test/CodeGen/patchable-function-entry.c
M clang/test/Misc/pragma-attribute-supported-attributes-list.test
A clang/test/Sema/patchable-function-entry-attr.c
A clang/test/Sema/patchable-function-entry-attr.cpp
Log Message:
-----------
Support function attribute patchable_function_entry
This feature is generic. Make it applicable for AArch64 and X86 because
the backend has only implemented NOP insertion for AArch64 and X86.
Reviewed By: nickdesaulniers, aaron.ballman
Differential Revision: https://reviews.llvm.org/D72221
Commit: f17ae668a96eeb69f0664f126cf672e1a05754d2
https://github.com/llvm/llvm-project/commit/f17ae668a96eeb69f0664f126cf672e1a05754d2
Author: Fangrui Song <maskray at google.com>
Date: 2020-01-10 (Fri, 10 Jan 2020)
Changed paths:
M clang/include/clang/Basic/CodeGenOptions.def
M clang/include/clang/Basic/DiagnosticDriverKinds.td
M clang/include/clang/Driver/Options.td
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Driver/XRayArgs.cpp
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/test/CodeGen/patchable-function-entry.c
A clang/test/Driver/fpatchable-function-entry.c
Log Message:
-----------
[Driver][CodeGen] Add -fpatchable-function-entry=N[,0]
In the backend, this feature is implemented with the function attribute
"patchable-function-entry". Both the attribute and XRay use
TargetOpcode::PATCHABLE_FUNCTION_ENTER, so the two features are
incompatible.
Reviewed By: ostannard, MaskRay
Differential Revision: https://reviews.llvm.org/D72222
Compare: https://github.com/llvm/llvm-project/compare/fd8ded99fe6e...f17ae668a96e
More information about the All-commits
mailing list