-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[RISCV] Support RISCV Atomics ABI attributes #84597
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
ilovepi
merged 14 commits into
main
from
users/ilovepi/spr/riscv-support-riscv-atomics-abi-attributes
Apr 25, 2024
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7147849
[𝘀𝗽𝗿] initial version
ilovepi 2b14f06
Fix formatting
ilovepi bc7196f
Remove code from SCS PR
ilovepi 87d6966
remove debugging statements
ilovepi d08e85d
Remove unrelated code
ilovepi 9a7fae0
Pass iterator instead of repeating lookup
ilovepi 1691a7c
Fix whitespace
ilovepi 838ebcd
Update tests and fix whitespace
ilovepi d25c54f
Add NEXT to CHECK lines in test
ilovepi a59de4d
Split out change of defaults into separate patch
ilovepi ab7a2b3
Improve testing
ilovepi 9097db9
update commit message
ilovepi 6cddfbe
Fix naming in test cases for consistency
ilovepi 9ac2d5b
clang-format
ilovepi 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,30 @@ | |
# RUN: not ld.lld a.o b.o c.o diff_stack_align.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=STACK_ALIGN --implicit-check-not=error: | ||
# STACK_ALIGN: error: diff_stack_align.o:(.riscv.attributes) has stack_align=32 but a.o:(.riscv.attributes) has stack_align=16 | ||
|
||
## merging atomic_abi values for A6C and A7 lead to an error. | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_A6C.s -o atomic_abi_A6C.o | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_A7.s -o atomic_abi_A7.o | ||
# RUN: not ld.lld atomic_abi_A6C.o atomic_abi_A7.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ATOMIC_ABI_ERROR --implicit-check-not=error: | ||
# ATOMIC_ABI_ERROR: error: atomic_abi_A6C.o:(.riscv.attributes) has atomic_abi=1 but atomic_abi_A7.o:(.riscv.attributes) has atomic_abi=3 | ||
|
||
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. We don't use double blank lines |
||
|
||
# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_A6S.s -o atomic_abi_A6S.o | ||
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. excess space |
||
# RUN: ld.lld atomic_abi_A6S.o atomic_abi_A6C.o -o atomic_abi_A6C_A6S | ||
# RUN: llvm-readobj -A atomic_abi_A6C_A6S | FileCheck %s --check-prefix=A6C_A6S | ||
|
||
# RUN: ld.lld atomic_abi_A6S.o atomic_abi_A7.o -o atomic_abi_A6S_A7 | ||
# RUN: llvm-readobj -A atomic_abi_A6S_A7 | FileCheck %s --check-prefix=A6S_A7 | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=riscv64 atomic_abi_unknown.s -o atomic_abi_unknown.o | ||
# RUN: ld.lld atomic_abi_unknown.o atomic_abi_A6C.o -o atomic_abi_A6C_unknown | ||
# RUN: llvm-readobj -A atomic_abi_A6C_unknown | FileCheck %s --check-prefixes=UNKNOWN_A6C | ||
|
||
# RUN: ld.lld atomic_abi_unknown.o atomic_abi_A6S.o -o atomic_abi_A6S_unknown | ||
# RUN: llvm-readobj -A atomic_abi_A6S_unknown | FileCheck %s --check-prefix=UNKNOWN_A6S | ||
|
||
# RUN: ld.lld atomic_abi_unknown.o atomic_abi_A7.o -o atomic_abi_A7_unknown | ||
# RUN: llvm-readobj -A atomic_abi_A7_unknown | FileCheck %s --check-prefix=UNKNOWN_A7 | ||
|
||
## The deprecated priv_spec is not handled as GNU ld does. | ||
## Differing priv_spec attributes lead to an absent attribute. | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 diff_priv_spec.s -o diff_priv_spec.o | ||
|
@@ -286,6 +310,108 @@ | |
.attribute priv_spec, 3 | ||
.attribute priv_spec_minor, 3 | ||
|
||
#--- atomic_abi_unknown.s | ||
.attribute atomic_abi, 0 | ||
|
||
#--- atomic_abi_A6C.s | ||
.attribute atomic_abi, 1 | ||
|
||
#--- atomic_abi_A6S.s | ||
.attribute atomic_abi, 2 | ||
|
||
#--- atomic_abi_A7.s | ||
.attribute atomic_abi, 3 | ||
|
||
# UNKNOWN_A6C: BuildAttributes { | ||
# UNKNOWN_A6C-NEXT: FormatVersion: 0x41 | ||
# UNKNOWN_A6C-NEXT: Section 1 { | ||
# UNKNOWN_A6C-NEXT: SectionLength: 17 | ||
# UNKNOWN_A6C-NEXT: Vendor: riscv | ||
# UNKNOWN_A6C-NEXT: Tag: Tag_File (0x1) | ||
# UNKNOWN_A6C-NEXT: Size: 7 | ||
# UNKNOWN_A6C-NEXT: FileAttributes { | ||
# UNKNOWN_A6C-NEXT: Attribute { | ||
# UNKNOWN_A6C-NEXT: Tag: 14 | ||
# UNKNOWN_A6C-NEXT: Value: 1 | ||
# UNKNOWN_A6C-NEXT: TagName: atomic_abi | ||
# UNKNOWN_A6C-NEXT: Description: Atomic ABI is 1 | ||
# UNKNOWN_A6C-NEXT: } | ||
# UNKNOWN_A6C-NEXT: } | ||
# UNKNOWN_A6C-NEXT: } | ||
# UNKNOWN_A6C-NEXT: } | ||
|
||
# UNKNOWN_A6S: BuildAttributes { | ||
# UNKNOWN_A6S-NEXT: FormatVersion: 0x41 | ||
# UNKNOWN_A6S-NEXT: Section 1 { | ||
# UNKNOWN_A6S-NEXT: SectionLength: 17 | ||
# UNKNOWN_A6S-NEXT: Vendor: riscv | ||
# UNKNOWN_A6S-NEXT: Tag: Tag_File (0x1) | ||
# UNKNOWN_A6S-NEXT: Size: 7 | ||
# UNKNOWN_A6S-NEXT: FileAttributes { | ||
# UNKNOWN_A6S-NEXT: Attribute { | ||
# UNKNOWN_A6S-NEXT: Tag: 14 | ||
# UNKNOWN_A6S-NEXT: Value: 2 | ||
# UNKNOWN_A6S-NEXT: TagName: atomic_abi | ||
# UNKNOWN_A6S-NEXT: Description: Atomic ABI is 2 | ||
# UNKNOWN_A6S-NEXT: } | ||
# UNKNOWN_A6S-NEXT: } | ||
# UNKNOWN_A6S-NEXT: } | ||
# UNKNOWN_A6S-NEXT: } | ||
|
||
# UNKNOWN_A7: BuildAttributes { | ||
# UNKNOWN_A7-NEXT: FormatVersion: 0x41 | ||
# UNKNOWN_A7-NEXT: Section 1 { | ||
# UNKNOWN_A7-NEXT: SectionLength: 17 | ||
# UNKNOWN_A7-NEXT: Vendor: riscv | ||
# UNKNOWN_A7-NEXT: Tag: Tag_File (0x1) | ||
# UNKNOWN_A7-NEXT: Size: 7 | ||
# UNKNOWN_A7-NEXT: FileAttributes { | ||
# UNKNOWN_A7-NEXT: Attribute { | ||
# UNKNOWN_A7-NEXT: Tag: 14 | ||
# UNKNOWN_A7-NEXT: Value: 3 | ||
# UNKNOWN_A7-NEXT: TagName: atomic_abi | ||
# UNKNOWN_A7-NEXT: Description: Atomic ABI is 3 | ||
# UNKNOWN_A7-NEXT: } | ||
# UNKNOWN_A7-NEXT: } | ||
# UNKNOWN_A7-NEXT: } | ||
# UNKNOWN_A7-NEXT: } | ||
|
||
# A6C_A6S: BuildAttributes { | ||
# A6C_A6S-NEXT: FormatVersion: 0x41 | ||
# A6C_A6S-NEXT: Section 1 { | ||
# A6C_A6S-NEXT: SectionLength: 17 | ||
# A6C_A6S-NEXT: Vendor: riscv | ||
# A6C_A6S-NEXT: Tag: Tag_File (0x1) | ||
# A6C_A6S-NEXT: Size: 7 | ||
# A6C_A6S-NEXT: FileAttributes { | ||
# A6C_A6S-NEXT: Attribute { | ||
# A6C_A6S-NEXT: Tag: 14 | ||
# A6C_A6S-NEXT: Value: 1 | ||
# A6C_A6S-NEXT: TagName: atomic_abi | ||
# A6C_A6S-NEXT: Description: Atomic ABI is 1 | ||
# A6C_A6S-NEXT: } | ||
# A6C_A6S-NEXT: } | ||
# A6C_A6S-NEXT: } | ||
# A6C_A6S-NEXT: } | ||
|
||
# A6S_A7: BuildAttributes { | ||
# A6S_A7-NEXT: FormatVersion: 0x41 | ||
# A6S_A7-NEXT: Section 1 { | ||
# A6S_A7-NEXT: SectionLength: 17 | ||
# A6S_A7-NEXT: Vendor: riscv | ||
# A6S_A7-NEXT: Tag: Tag_File (0x1) | ||
# A6S_A7-NEXT: Size: 7 | ||
# A6S_A7-NEXT: FileAttributes { | ||
# A6S_A7-NEXT: Attribute { | ||
# A6S_A7-NEXT: Tag: 14 | ||
# A6S_A7-NEXT: Value: 3 | ||
# A6S_A7-NEXT: TagName: atomic_abi | ||
# A6S_A7-NEXT: Description: Atomic ABI is 3 | ||
# A6S_A7-NEXT: } | ||
# A6S_A7-NEXT: } | ||
# A6S_A7-NEXT: } | ||
# A6S_A7-NEXT: } | ||
|
||
#--- unknown13.s | ||
.attribute 13, "0" | ||
#--- unknown13a.s | ||
|
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
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 |
---|---|---|
|
@@ -24,3 +24,6 @@ | |
|
||
.attribute priv_spec_revision, 0 | ||
# CHECK: attribute 12, 0 | ||
|
||
.attribute atomic_abi, 0 | ||
# CHECK: attribute 14, 0 |
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
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.
Mismatched
Upper case. And there is a better word than "merging"