1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/utils/vscode/llvm
Nick Desaulniers e95a065d26 [IR] add fn attr for no_stack_protector; prevent inlining on mismatch
It's currently ambiguous in IR whether the source language explicitly
did not want a stack a stack protector (in C, via function attribute
no_stack_protector) or doesn't care for any given function.

It's common for code that manipulates the stack via inline assembly or
that has to set up its own stack canary (such as the Linux kernel) would
like to avoid stack protectors in certain functions. In this case, we've
been bitten by numerous bugs where a callee with a stack protector is
inlined into an __attribute__((__no_stack_protector__)) caller, which
generally breaks the caller's assumptions about not having a stack
protector. LTO exacerbates the issue.

While developers can avoid this by putting all no_stack_protector
functions in one translation unit together and compiling those with
-fno-stack-protector, it's generally not very ergonomic or as
ergonomic as a function attribute, and still doesn't work for LTO. See also:
https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/
https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u

Typically, when inlining a callee into a caller, the caller will be
upgraded in its level of stack protection (see adjustCallerSSPLevel()).
By adding an explicit attribute in the IR when the function attribute is
used in the source language, we can now identify such cases and prevent
inlining.  Block inlining when the callee and caller differ in the case that one
contains `nossp` when the other has `ssp`, `sspstrong`, or `sspreq`.

Fixes pr/47479.

Reviewed By: void

Differential Revision: https://reviews.llvm.org/D87956
2020-10-23 11:55:39 -07:00
..
src
syntaxes
.gitignore
.vscodeignore
CHANGELOG.md
language-configuration-tablegen.json
language-configuration.json
package-lock.json
package.json
README.md
tsconfig.json
vsc-extension-quickstart.md

VS Code Extension For LLVM Dev

Features

  • LLVM IR files (.ll) syntax highlighting. (manually translated from llvm/utils/vim/syntax/llvm.vim)
  • TableGen files (.td) syntax highlighting. (translated from llvm/utils/textmate)
  • PatternMatchers for LIT test output. ($llvm-lit, $llvm-filecheck)
  • Tasks to run LIT on current selected file. (Terminal -> Run Task -> llvm-lit)

Installation

sudo apt-get install nodejs-dev node-gyp npm
sudo npm install -g typescript npx vsce

Install From Source

cd <extensions-installation-folder>
cp -r llvm/utils/vscode/llvm .
cd llvm
npm install
npm run vscode:prepublish

<extensions-installation-folder> is OS dependent.

Please refer to https://code.visualstudio.com/docs/editor/extension-gallery#_where-are-extensions-installed

Install From Package (.vsix)

First package the extension according to https://code.visualstudio.com/api/working-with-extensions/publishing-extension#usage.

Then install the package according to https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix.

Setup

Set cmake.buildDirectory to your build directory.

https://code.visualstudio.com/docs/getstarted/settings

https://vector-of-bool.github.io/docs/vscode-cmake-tools/settings.html#cmake-builddirectory