-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[aarch64][x86][win] Add compiler support for MSVC's /funcoverride flag (Windows kernel loader replaceable functions) #125320
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
Merged
Merged
Changes from all commits
Commits
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
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,17 @@ | ||
// RUN: %clang_cc1 -triple=x86_64-pc-windows-msvc -loader-replaceable-function=override_me -loader-replaceable-function="?override_me_cpp@@YAXXZ" -emit-llvm -o - %s | FileCheck %s | ||
|
||
// CHECK: define dso_local void @override_me() #0 | ||
extern "C" void override_me() {} | ||
|
||
// CHECK: define dso_local void @"?override_me_cpp@@YAXXZ"() #0 | ||
void override_me_cpp() {} | ||
|
||
// CHECK: define dso_local void @dont_override_me() #1 | ||
extern "C" void dont_override_me() {} | ||
|
||
// CHECK: attributes #0 = { | ||
// CHECK-SAME: loader-replaceable | ||
|
||
// CHECK: attributes #1 = { | ||
// CHECK-NOT: loader-replaceable | ||
// CHECK-SAME: } |
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
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
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
40 changes: 40 additions & 0 deletions
40
llvm/test/CodeGen/AArch64/win-loader-replaceable-function.ll
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,40 @@ | ||
; RUN: llc -mtriple=aarch64-pc-windows-msvc < %s | FileCheck %s | ||
|
||
define dso_local i32 @override_me1() "loader-replaceable" { | ||
entry: | ||
ret i32 1 | ||
} | ||
|
||
define dso_local i32 @override_me2() "loader-replaceable" { | ||
entry: | ||
ret i32 2 | ||
} | ||
|
||
define dso_local i32 @dont_override_me() { | ||
entry: | ||
ret i32 3 | ||
} | ||
|
||
; CHECK: .section .drectve,"yni" | ||
; CHECK-NEXT: .def override_me1_$fo$; | ||
; CHECK-NEXT: .scl 2; | ||
; CHECK-NEXT: .type 0; | ||
; CHECK-NEXT: .endef | ||
; CHECK-NEXT: .def override_me1_$fo_default$; | ||
; CHECK-NEXT: .scl 2; | ||
; CHECK-NEXT: .type 0; | ||
; CHECK-NEXT: .endef | ||
; CHECK-NEXT: .ascii " /ALTERNATENAME:override_me1_$fo$=override_me1_$fo_default$" | ||
; CHECK-NEXT: .def override_me2_$fo$; | ||
; CHECK-NEXT: .scl 2; | ||
; CHECK-NEXT: .type 0; | ||
; CHECK-NEXT: .endef | ||
; CHECK-NEXT: .def override_me2_$fo_default$; | ||
; CHECK-NEXT: .scl 2; | ||
; CHECK-NEXT: .type 0; | ||
; CHECK-NEXT: .endef | ||
; CHECK-NEXT: .ascii " /ALTERNATENAME:override_me2_$fo$=override_me2_$fo_default$" | ||
; CHECK-NEXT: .data | ||
; CHECK-NEXT: override_me1_$fo_default$: | ||
; CHECK-NEXT: override_me2_$fo_default$: | ||
; CHECK-NEXT: .zero 1 |
Oops, something went wrong.
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.
We could also add a clang driver option... but maybe not really necessary given the expected usage.
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.
We only expect to use this via clang-cl, so if someone wants a clang option they can add that later.