-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[LFI] Introduce AArch64 LFI Target #167061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zyedidia
wants to merge
12
commits into
llvm:main
Choose a base branch
from
lfi-project:lfi-patchset/aarch64-pr-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9ca2065
[LFI] Add aarch64_lfi subtarget
zyedidia 2b46bc0
[LFI] Reserve LFI registers
zyedidia fcc1594
[LFI] Add Clang driver toolchain for LFI
zyedidia 812b812
[LFI] Update compiler-rt cmake for LFI
zyedidia f47d136
[LFI] Add LFI.rst documentation
zyedidia 5037609
[LFI] Apply clang-format to Driver.cpp
zyedidia ad90c25
[LFI] Fix title underline in docs/LFI.rst
zyedidia 94c11b8
[LFI] Mention LFI backend in CodeGenerator.rst
zyedidia b52a5d7
[LFI] Add LFI to UserGuides toctree
zyedidia 69065e2
Merge branch 'main' into lfi-patchset/aarch64-pr-1
zyedidia 6db5591
[LFI] Adjust LFI toolchain definition
zyedidia 5506213
[LFI] Update LFI.rst documentation
zyedidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| //===-- LFILinux.cpp - LFI ToolChain Implementations ------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "LFILinux.h" | ||
| #include "clang/Driver/Driver.h" | ||
|
|
||
| using namespace clang::driver; | ||
| using namespace clang::driver::toolchains; | ||
| using namespace llvm::opt; | ||
|
|
||
| ToolChain::CXXStdlibType LFILinuxToolChain::GetDefaultCXXStdlibType() const { | ||
| return ToolChain::CST_Libstdcxx; | ||
| } | ||
|
|
||
| void LFILinuxToolChain::AddCXXStdlibLibArgs(const ArgList &Args, | ||
| ArgStringList &CmdArgs) const { | ||
| ToolChain::AddCXXStdlibLibArgs(Args, CmdArgs); | ||
| CmdArgs.push_back("-lc++abi"); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| //===--- LFILinux.h - LFI ToolChain Implementations -------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LFI_LINUX_H | ||
| #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LFI_LINUX_H | ||
|
|
||
| #include "Linux.h" | ||
|
|
||
| namespace clang { | ||
| namespace driver { | ||
| namespace toolchains { | ||
|
|
||
| class LLVM_LIBRARY_VISIBILITY LFILinuxToolChain : public Linux { | ||
| public: | ||
| LFILinuxToolChain(const Driver &D, const llvm::Triple &Triple, | ||
| const llvm::opt::ArgList &Args) | ||
| : Linux(D, Triple, Args) { | ||
| ExtraOpts.push_back("-z"); | ||
| ExtraOpts.push_back("separate-code"); | ||
| } | ||
|
|
||
| CXXStdlibType GetDefaultCXXStdlibType() const override; | ||
|
|
||
| void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, | ||
| llvm::opt::ArgStringList &CmdArgs) const override; | ||
| }; | ||
|
|
||
| } // end namespace toolchains | ||
| } // end namespace driver | ||
| } // end namespace clang | ||
|
|
||
| #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LFI_LINUX_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2492,3 +2492,10 @@ The AMDGPU backend | |
| The AMDGPU code generator lives in the ``lib/Target/AMDGPU`` | ||
| directory. This code generator is capable of targeting a variety of | ||
| AMD GPU processors. Refer to :doc:`AMDGPUUsage` for more information. | ||
|
|
||
| The Lightweight Fault Isolation (LFI) backend | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is not expected to be a LFI backend, right? In the llvm sense of backend==target, a new llvm/Target/LFI. It is a modification to the existing backends that support it. |
||
| --------------------------------------------- | ||
|
|
||
| LFI is a backend that allows programs compiled for the target to run in a | ||
| sandboxed environment that is within the same address space as host code. Refer | ||
| to :doc:`LFI` for more information about the LFI backend. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't spot a significant difference between this and
ToolChain::AddCXXStdlibLibArgsare you able to call the Base class implementation here?If there's going to be changes in a later patch, would be good to leave a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base implementation doesn't add
-lc++abi, but I have updated the code to call the base implementation and then add-lc++abifor some additional code reuse.