Page MenuHomePhabricator
Feed Advanced Search

Dec 10 2021

samitolvanen committed rG9a74c753fe3f: [ThinLTO][MC] Use conditional assignments for promotion aliases (authored by samitolvanen).
[ThinLTO][MC] Use conditional assignments for promotion aliases
Dec 10 2021, 12:34 PM
samitolvanen closed D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.
Dec 10 2021, 12:33 PM · Restricted Project
samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Applied pcc's changes.

Dec 10 2021, 9:07 AM · Restricted Project

Dec 9 2021

samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Based on more offline feedback from pcc, moved the conditional assignment handling from MCStreamer to MCObjectStreamer. This allows us to drop the emittedSymbols set as MCAssembler already keeps track of the symbols. As MCAsmStreamer now passes through the .lto_set_conditional directives, changed the tests to look at the generated objects instead.

Dec 9 2021, 3:23 PM · Restricted Project

Dec 3 2021

samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Changed the key of the pendingAssignments map to const MCSymbol * and switched from StringMap/Set to DenseMap/Set based on feedback from pcc.

Dec 3 2021, 6:35 PM · Restricted Project

Dec 1 2021

samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Addressed comments.

Dec 1 2021, 4:05 PM · Restricted Project

Nov 29 2021

samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Use standard l-value conversions, and add a test case for constexpr.

Nov 29 2021, 4:23 PM · Restricted Project

Nov 24 2021

samitolvanen planned changes to D108479: [Clang] Add __builtin_addressof_nocfi.

Your builtin is using custom type-checking (t), which suppresses all the normal conversions that happen on expressions. Specifically, it skips lvalue-to-rvalue conversion, so in this example the argument ends up being an l-value reference to a variable rather than an r-value loaded from that variable.

Nov 24 2021, 10:07 AM · Restricted Project

Nov 23 2021

samitolvanen added inline comments to D108479: [Clang] Add __builtin_addressof_nocfi.
Nov 23 2021, 3:54 PM · Restricted Project
samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Changed the code to evaluate the argument as a constant expression.

Nov 23 2021, 3:54 PM · Restricted Project
samitolvanen planned changes to D108479: [Clang] Add __builtin_addressof_nocfi.

I worked around this for now by explicitly allowing __builtin_function_start in CheckLValueConstantExpression, but this seems terribly hacky. What would be the correct way to solve this issue?

Try to generalize what we do for __builtin___CFStringMakeConstantString.

Nov 23 2021, 10:33 AM · Restricted Project
samitolvanen added a comment to D108479: [Clang] Add __builtin_addressof_nocfi.

Sure, I can take a look at how that would work. Basically, in PointerExprEvaluator::VisitBuiltinCallExpr we should not evaluate the l-value and just leave it at Result.set(E)?

Yes, exactly. Since the builtin already requires a constant operand in non-dependent contexts, that should be enough.

Nov 23 2021, 9:51 AM · Restricted Project
samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Refactored to avoid evaluating the expression into an l-value.

Nov 23 2021, 9:51 AM · Restricted Project

Nov 19 2021

samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Renamed to .lto_set_conditional.

Nov 19 2021, 11:50 AM · Restricted Project
samitolvanen added inline comments to D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.
Nov 19 2021, 8:54 AM · Restricted Project
samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Updated tests to use # and reordered the CHECKs for clarity.

Nov 19 2021, 8:52 AM · Restricted Project

Nov 18 2021

samitolvanen planned changes to D108479: [Clang] Add __builtin_addressof_nocfi.

If we do need to support constant expressions of this

Yes, we need this also in constant expressions.

Okay. I assume just static initializers, and not things like template arguments?

Nov 18 2021, 12:50 PM · Restricted Project
samitolvanen updated the diff for D108478: [llvm][IR] Add no_cfi constant.

Rebased.

Nov 18 2021, 9:55 AM · Restricted Project
samitolvanen added a comment to D108479: [Clang] Add __builtin_addressof_nocfi.

If we do need to support constant expressions of this

Nov 18 2021, 9:52 AM · Restricted Project
samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Renamed to __builtin_function_start, allowed only FunctionDecls as a parameter, added support for C++ member functions, and disallowed comparisons in integral constant expressions.

Nov 18 2021, 9:27 AM · Restricted Project

Nov 17 2021

samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Added a MachO test to ensure we emit .no_dead_strip correctly.

Nov 17 2021, 9:37 AM · Restricted Project

Nov 16 2021

samitolvanen added inline comments to D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.
Nov 16 2021, 4:51 PM · Restricted Project
samitolvanen added inline comments to D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.
Nov 16 2021, 3:15 PM · Restricted Project
samitolvanen updated the diff for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.

Addressed Nick's comments: Switched to StringSet, preserved MCSA_NoDeadStrip, made the code more DRY.

Nov 16 2021, 2:41 PM · Restricted Project
samitolvanen added a reviewer for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases: MaskRay.
Nov 16 2021, 11:33 AM · Restricted Project

Nov 10 2021

samitolvanen added reviewers for D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases: pcc, tejohnson, nickdesaulniers.

Here's an alternative solution to the code bloat problem caused by promotion aliases, based on pcc's suggestion. This works with the kernel and nacl_helper size is back to normal in Chrome. Please let me know if you see issues with this approach.

Nov 10 2021, 2:17 PM · Restricted Project
samitolvanen requested review of D113613: [ThinLTO][MC] Use conditional assignments for promotion aliases.
Nov 10 2021, 2:12 PM · Restricted Project

Nov 5 2021

samitolvanen planned changes to D108479: [Clang] Add __builtin_addressof_nocfi.

You could also make this Just Work for things like C++ member functions rather than producing a member function pointer.

Nov 5 2021, 3:59 PM · Restricted Project

Nov 4 2021

samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Keep a void * return type for the nocfi variant.

Nov 4 2021, 4:00 PM · Restricted Project
samitolvanen updated the diff for D108478: [llvm][IR] Add no_cfi constant.

Rebased.

Nov 4 2021, 3:57 PM · Restricted Project

Oct 29 2021

samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Missed a comment.

Oct 29 2021, 3:41 PM · Restricted Project
samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Addressed comments.

Oct 29 2021, 3:24 PM · Restricted Project
samitolvanen updated the diff for D108478: [llvm][IR] Add no_cfi constant.

Addressed pcc's comments.

Oct 29 2021, 3:21 PM · Restricted Project

Oct 28 2021

samitolvanen added reviewers for D112761: cfi-icall: Add -fsanitize-cfi-promotion-aliases: nickdesaulniers, pcc, tejohnson.
Oct 28 2021, 3:10 PM · Restricted Project, Restricted Project
samitolvanen requested review of D112761: cfi-icall: Add -fsanitize-cfi-promotion-aliases.
Oct 28 2021, 3:08 PM · Restricted Project, Restricted Project

Oct 15 2021

samitolvanen added a comment to D107934: [LowerTypeTests] Emit cfi_jt aliases regardless of function export.

I tested the latest version with a CFI kernel build, and everything still looks good. I see the same number of .cfi_jt symbols with ThinLTO and full LTO.

Oct 15 2021, 12:25 PM · Restricted Project, Restricted Project

Oct 5 2021

samitolvanen updated the diff for D108478: [llvm][IR] Add no_cfi constant.

Fixed bitcast handling in NoCFIValue::handleOperandChangeImpl.

Oct 5 2021, 3:23 PM · Restricted Project

Sep 9 2021

samitolvanen added a comment to D107934: [LowerTypeTests] Emit cfi_jt aliases regardless of function export.

causes confusing stack traces in applications

Sep 9 2021, 2:32 PM · Restricted Project, Restricted Project

Aug 31 2021

samitolvanen added inline comments to D108479: [Clang] Add __builtin_addressof_nocfi.
Aug 31 2021, 2:02 PM · Restricted Project
samitolvanen updated the diff for D108479: [Clang] Add __builtin_addressof_nocfi.

Fixed clang-tidy warnings, dropped an unnecessary auto.

Aug 31 2021, 2:02 PM · Restricted Project
samitolvanen added a comment to D108478: [llvm][IR] Add no_cfi constant.

I think you might want to update the syntax files for the various text editors. See:

  • llvm/utils/vim/syntax/llvm.vim
  • llvm/utils/emacs/llvm-mode.el
  • llvm/utils/kate/llvm.xml
  • llvm/utils/vscode/llvm/syntaxes/ll.tmLanguage.yaml
Aug 31 2021, 2:01 PM · Restricted Project
samitolvanen updated the diff for D108478: [llvm][IR] Add no_cfi constant.

Fixed clang-tidy warnings, cleaned up tests.

Aug 31 2021, 2:00 PM · Restricted Project

Aug 20 2021

samitolvanen added reviewers for D108479: [Clang] Add __builtin_addressof_nocfi: nickdesaulniers, pcc.

Here's a PoC of the built-in function that returns the address of the function body with CFI. Based on D108478.

Aug 20 2021, 12:03 PM · Restricted Project
samitolvanen added reviewers for D108478: [llvm][IR] Add no_cfi constant: nickdesaulniers, pcc.

Here's a PoC of the "no cfi" constant type suggested by Peter. PTAL.

Aug 20 2021, 12:02 PM · Restricted Project
samitolvanen requested review of D108479: [Clang] Add __builtin_addressof_nocfi.
Aug 20 2021, 12:00 PM · Restricted Project
samitolvanen requested review of D108478: [llvm][IR] Add no_cfi constant.
Aug 20 2021, 11:58 AM · Restricted Project

Aug 18 2021

samitolvanen added a comment to D105265: [X86] AVX512FP16 instructions enabling 3/6.
Aug 18 2021, 10:59 AM · Restricted Project, Restricted Project

Aug 12 2021

samitolvanen added a comment to D107934: [LowerTypeTests] Emit cfi_jt aliases regardless of function export.

Thanks, Nick. I tested a kernel build with both ThinLTO and regular LTO + CFI, and can confirm that with this patch vmlinux has the previously missing .cfi_jt symbols again.

Aug 12 2021, 9:40 AM · Restricted Project, Restricted Project

Aug 3 2021

samitolvanen committed rG7ce1c4da7726: ThinLTO: Fix inline assembly references to static functions with CFI (authored by samitolvanen).
ThinLTO: Fix inline assembly references to static functions with CFI
Aug 3 2021, 11:48 AM
samitolvanen closed D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Aug 3 2021, 11:48 AM · Restricted Project, Restricted Project

Jul 30 2021

samitolvanen added inline comments to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 30 2021, 12:20 PM · Restricted Project, Restricted Project
samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Also skip functions with names incompatible with XCOFF.

Jul 30 2021, 11:39 AM · Restricted Project, Restricted Project
samitolvanen added inline comments to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 30 2021, 11:21 AM · Restricted Project, Restricted Project

Jul 21 2021

samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

As we only care about fixing inline assembly references, mangled names are
not that important in the first place. This version skips any functions
that have unusual characters in their names that would otherwise require
quotes, which includes any functions with MSVC compatible name mangling.

Jul 21 2021, 3:17 PM · Restricted Project, Restricted Project

Jul 20 2021

samitolvanen planned changes to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 20 2021, 4:59 PM · Restricted Project, Restricted Project
samitolvanen added inline comments to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 20 2021, 4:32 PM · Restricted Project, Restricted Project
samitolvanen added inline comments to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 20 2021, 3:41 PM · Restricted Project, Restricted Project
samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Folded in D106392.

Jul 20 2021, 2:08 PM · Restricted Project, Restricted Project
samitolvanen reopened D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 20 2021, 2:07 PM · Restricted Project, Restricted Project
samitolvanen abandoned D106392: ThinLTO: Fix promotion aliases with -msvc targets.

Nick suggested reverting until we figure out if this is the ideal fix here. I'll fold this to the original patch.

Jul 20 2021, 2:03 PM · Restricted Project
samitolvanen added a reverting change for D104058: ThinLTO: Fix inline assembly references to static functions with CFI: rGe901e581ef45: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jul 20 2021, 2:00 PM · Restricted Project, Restricted Project
samitolvanen added a reverting change for rG700d07f8ce6f: ThinLTO: Fix inline assembly references to static functions with CFI: rGe901e581ef45: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jul 20 2021, 2:00 PM
samitolvanen committed rGe901e581ef45: Revert "ThinLTO: Fix inline assembly references to static functions with CFI" (authored by samitolvanen).
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"
Jul 20 2021, 2:00 PM
samitolvanen retitled D106392: ThinLTO: Fix promotion aliases with -msvc targets from ThinLTO: Fix promotion aliases with MSVC name mangling to ThinLTO: Fix promotion aliases with -msvc targets.
Jul 20 2021, 1:45 PM · Restricted Project
samitolvanen added a comment to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

This patch broke the sanitizer-windows bot: https://lab.llvm.org/buildbot/#/builders/127/builds/14257

Failed Tests (4):
  cfi-devirt-lld-thinlto-x86_64 :: anon-namespace.cpp
  cfi-devirt-lld-thinlto-x86_64 :: simple-pass.cpp
  cfi-standalone-lld-thinlto-x86_64 :: anon-namespace.cpp
  cfi-standalone-lld-thinlto-x86_64 :: simple-pass.cpp

Please revert or fix.

Jul 20 2021, 1:40 PM · Restricted Project, Restricted Project
samitolvanen added reviewers for D106392: ThinLTO: Fix promotion aliases with -msvc targets: nickdesaulniers, pcc.
Jul 20 2021, 1:13 PM · Restricted Project
samitolvanen requested review of D106392: ThinLTO: Fix promotion aliases with -msvc targets.
Jul 20 2021, 1:12 PM · Restricted Project
samitolvanen committed rG700d07f8ce6f: ThinLTO: Fix inline assembly references to static functions with CFI (authored by samitolvanen).
ThinLTO: Fix inline assembly references to static functions with CFI
Jul 20 2021, 10:30 AM
samitolvanen closed D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 20 2021, 10:30 AM · Restricted Project, Restricted Project

Jul 16 2021

samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Added REQUIRES: x86-registered-target to tests.

Jul 16 2021, 3:27 PM · Restricted Project, Restricted Project
samitolvanen reopened D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

The tests that now specify a target triple also need ; REQUIRES: x86-registered-target or they will obviously fail. I'll upload another revision.

Jul 16 2021, 2:55 PM · Restricted Project, Restricted Project
samitolvanen added a reverting change for rG8e3b5cb39eef: ThinLTO: Fix inline assembly references to static functions with CFI: rG0ad1d9fdf22d: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jul 16 2021, 2:48 PM
samitolvanen committed rG0ad1d9fdf22d: Revert "ThinLTO: Fix inline assembly references to static functions with CFI" (authored by samitolvanen).
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"
Jul 16 2021, 2:48 PM
samitolvanen added a reverting change for D104058: ThinLTO: Fix inline assembly references to static functions with CFI: rG0ad1d9fdf22d: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jul 16 2021, 2:48 PM · Restricted Project, Restricted Project
samitolvanen committed rG8e3b5cb39eef: ThinLTO: Fix inline assembly references to static functions with CFI (authored by samitolvanen).
ThinLTO: Fix inline assembly references to static functions with CFI
Jul 16 2021, 2:34 PM
samitolvanen closed D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 16 2021, 2:34 PM · Restricted Project, Restricted Project
samitolvanen added a comment to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Change LGTM, but I don't understand why the following tests are modified:

  • llvm/test/ThinLTO/X86/devirt2.ll

This is needed to fix two missing symbol resolution errors that are caused by the aliases we added.

I'm curious if this will lead to breakages with LTO in general? I suppose not, since it's llvm-lto2 that needs the explicit list of symbols that can be linked against.

Jul 16 2021, 10:59 AM · Restricted Project, Restricted Project

Jul 14 2021

samitolvanen added a comment to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Change LGTM, but I don't understand why the following tests are modified:

  • llvm/test/ThinLTO/X86/devirt2.ll
Jul 14 2021, 1:18 PM · Restricted Project, Restricted Project

Jul 13 2021

samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Moved the alias creation to module level inline assembly to avoid issues with LowerTypeTestsModule, based on pcc's suggestion.

Jul 13 2021, 11:21 AM · Restricted Project, Restricted Project
samitolvanen reopened D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jul 13 2021, 11:19 AM · Restricted Project, Restricted Project

Jun 23 2021

samitolvanen added a comment to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Thanks for the revert, I'll take a look.

Jun 23 2021, 8:12 PM · Restricted Project, Restricted Project
samitolvanen committed rGe3d24b45b8f8: ThinLTO: Fix inline assembly references to static functions with CFI (authored by samitolvanen).
ThinLTO: Fix inline assembly references to static functions with CFI
Jun 23 2021, 11:10 AM
samitolvanen closed D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jun 23 2021, 11:10 AM · Restricted Project, Restricted Project
samitolvanen added inline comments to D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jun 23 2021, 8:24 AM · Restricted Project, Restricted Project

Jun 22 2021

samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Fix a use-of-uninitialized-value error.

Jun 22 2021, 2:35 PM · Restricted Project, Restricted Project
samitolvanen reopened D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jun 22 2021, 2:34 PM · Restricted Project, Restricted Project
samitolvanen added a reverting change for rG4474958d3a97: ThinLTO: Fix inline assembly references to static functions with CFI: rG33c9438f1166: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jun 22 2021, 12:11 PM
samitolvanen committed rG33c9438f1166: Revert "ThinLTO: Fix inline assembly references to static functions with CFI" (authored by samitolvanen).
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"
Jun 22 2021, 12:11 PM
samitolvanen added a reverting change for D104058: ThinLTO: Fix inline assembly references to static functions with CFI: rG33c9438f1166: Revert "ThinLTO: Fix inline assembly references to static functions with CFI".
Jun 22 2021, 12:11 PM · Restricted Project, Restricted Project
samitolvanen committed rG4474958d3a97: ThinLTO: Fix inline assembly references to static functions with CFI (authored by samitolvanen).
ThinLTO: Fix inline assembly references to static functions with CFI
Jun 22 2021, 10:02 AM
samitolvanen closed D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jun 22 2021, 10:02 AM · Restricted Project, Restricted Project

Jun 17 2021

samitolvanen updated the diff for D104058: ThinLTO: Fix inline assembly references to static functions with CFI.

Moved the test to llvm/test/Transforms/ThinLTOBitcodeWriter.

Jun 17 2021, 12:49 PM · Restricted Project, Restricted Project

Jun 10 2021

samitolvanen added reviewers for D104058: ThinLTO: Fix inline assembly references to static functions with CFI: nickdesaulniers, pcc, tejohnson, kees, eugenis.
Jun 10 2021, 1:47 PM · Restricted Project, Restricted Project
samitolvanen requested review of D104058: ThinLTO: Fix inline assembly references to static functions with CFI.
Jun 10 2021, 1:44 PM · Restricted Project, Restricted Project
samitolvanen updated the diff for D104043: [IR] Value: Fix OpCode checks.

Changed the message to refer to CallBase instead of CallInst.

Jun 10 2021, 12:10 PM · Restricted Project
samitolvanen added a comment to D104043: [IR] Value: Fix OpCode checks.

Thanks, Nick. I don't have commit access, so would you mind committing the patch? I confirmed that check-all passes for me with the patch applied.

Jun 10 2021, 11:51 AM · Restricted Project
samitolvanen added reviewers for D104043: [IR] Value: Fix OpCode checks: nickdesaulniers, void.
Jun 10 2021, 9:29 AM · Restricted Project
samitolvanen requested review of D104043: [IR] Value: Fix OpCode checks.
Jun 10 2021, 9:29 AM · Restricted Project

Jun 8 2021

samitolvanen added a comment to D103120: LTO: Export functions referenced by non-canonical CFI jump tables.

Thanks, Peter. I don't have commit access, so Nick, would you mind committing this for me? The Windows build failure looks unrelated.

Jun 8 2021, 3:05 PM · Restricted Project

Jun 2 2021

samitolvanen added inline comments to D103120: LTO: Export functions referenced by non-canonical CFI jump tables.
Jun 2 2021, 8:14 AM · Restricted Project