Skip to content
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

Add function signature based labeling scheme for landing pad #434

Draft
wants to merge 42 commits into
base: cfi-prop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a902324
Add large code model information.
Jun 6, 2023
c9e7740
Fix comment for large code model.
Feb 6, 2024
af3126c
Fix the asm indent and 64-bit diretives.
Feb 6, 2024
5396750
Avoid implying code and literal to be adjacent.
Apr 22, 2024
46fd42e
Add note for range extension thunk.
May 22, 2024
3ee91c2
PIC medany: Fix parameters of load instruction
cmuellner Jul 17, 2024
9fec608
Merge pull request #446 from cmuellner/picm-asm
kito-cheng Jul 18, 2024
f90df2d
Strengthen atomic_compare_exchange seq_cst failure mapping
patrick-rivos Jul 15, 2024
17038f1
Merge pull request #445 from patrick-rivos/patrick/cas-seq-cst-failur…
kito-cheng Jul 23, 2024
e6332b9
Add VENDOR reloc for vendor-specific relocations
MaelCravero Jan 31, 2024
170103b
Merge pull request #428 from riscv-non-isa/prog-prop
kito-cheng Aug 2, 2024
79fbbc8
Merge pull request #388 from kuanlinchentw/master
kito-cheng Aug 9, 2024
456834e
Merge pull request #423 from embecosm/vendor-relocs
kito-cheng Aug 12, 2024
ff4a006
riscv-atomic.adoc: Typo fix
opsiff Aug 29, 2024
13bfa9f
Merge pull request #448 from opsiff/patch-1
jrtc27 Aug 29, 2024
ff50b91
Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows
dependabot[bot] Sep 3, 2024
1ce7269
Merge pull request #449 from riscv-non-isa/dependabot/github_actions/…
kito-cheng Sep 4, 2024
bd45bb8
Fix spelling aupic -> auipc
topperc Sep 6, 2024
f2d324f
Merge pull request #450 from topperc/patch-1
kito-cheng Sep 6, 2024
bda7e90
fix riscv-abi.adoc format
XYenChi Sep 24, 2024
3799de4
Merge pull request #451 from XYenChi/patch-1
kito-cheng Oct 9, 2024
d97a525
Add program property for CFI extension
kito-cheng Feb 26, 2024
2bf3f52
Tweak table layout
kito-cheng Feb 26, 2024
f1aa41b
Update simple labeling scheme to use 0
kito-cheng Feb 26, 2024
1670d15
Add simple landing pad PLT
kito-cheng Feb 26, 2024
ecb303d
Drop DT_RISCV_SIMPLE_LP_PLT
kito-cheng Apr 12, 2024
8f1ecdd
Add one more nop for alignment
kito-cheng Apr 12, 2024
f5e04a4
Minor revision
kito-cheng Jul 17, 2024
963c04c
Add complex labeling scheme for landing pad
kito-cheng Feb 26, 2024
64dcab8
Serveral udpate for the function signature based labeling scheme
kito-cheng May 10, 2024
f28c642
Revise rule
kito-cheng Jun 14, 2024
f71e57e
Minor tweak
kito-cheng Jun 14, 2024
cd1ecc1
Tweak return type rule
kito-cheng Jun 14, 2024
e63a64f
Apply for all member function
kito-cheng Jul 3, 2024
c27694c
Update according mylai-mtk's comment
kito-cheng Jul 15, 2024
4ae0d0f
Update example and minor tweak for the rule
kito-cheng Jul 15, 2024
c552b14
Minor word tweaking
kito-cheng Jul 16, 2024
99db00e
Minor tweak for covariant return type
kito-cheng Jul 18, 2024
ea9e2c4
Add rule if result is zero
kito-cheng Sep 25, 2024
9058aca
Tweak rule for member funciton and covariant type
kito-cheng Sep 26, 2024
b1a2dde
Update rule for the label value for handling zero value
kito-cheng Sep 26, 2024
b523e16
Update rule for the label value for handling zero value
kito-cheng Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4.1.7
with:
name: riscv-abi.pdf
path: ./
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4.1.7
with:
name: riscv-abi.pdf
path: ./
Expand Down
1 change: 1 addition & 0 deletions riscv-abi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include::prelude.adoc[]
endif::[]

include::introduction.adoc[]

include::riscv-cc.adoc[]

include::riscv-elf.adoc[]
Expand Down
51 changes: 33 additions & 18 deletions riscv-atomic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ the `lr` and `sc` instructions.

|`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}.aqrl` |4

|`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}.aqrl` |4
|`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}.aqrl` |4, 5

|===

Expand Down Expand Up @@ -135,7 +135,7 @@ the `lr` and `sc` instructions.

=== Meaning of notes in table

1) Depends on a load instruction with an RCsc aquire annotation,
1) Depends on a load instruction with an RCsc acquire annotation,
or a store instruction with an RCsc release annotation. These are currently
under discussion, but the specification has not yet been approved.

Expand All @@ -148,6 +148,11 @@ mappings with code generated by a compiler using those older mappings.

4) Currently only directly possible for 32- and 64-bit operands.

5) atomic_compare_exchange operations with a memory_order_seq_cst failure
ordering are considered to have a note 3 annotation.
To remove the note 3 annotation the amocas operation must be prepended with a
leading fence (`fence rw,rw; amocas.{w\|d}.aqrl`).

== Ztso atomics mappings

This specifies additional mappings of C and {Cpp} atomic operations to RISC-V
Expand All @@ -157,7 +162,8 @@ For each construct, we provide a mapping that assumes only the A and Ztso
extension.

All mappings interoperate correctly with the RVWMO mappings, and with the
original "Table A.6" mappings.
original "Table A.6" mappings, _except_ that mappings marked with note 3 do not
interoperate with the original "Table A.6" mappings.

We present the mappings as a table in 3 sections, as above.

Expand All @@ -167,32 +173,32 @@ We present the mappings as a table in 3 sections, as above.
|===
|C/{Cpp} Construct |Ztso Mapping |Notes

|`atomic_load(memory_order_acquire)` |`l{b\|h\|w\|d}` | 5
|`atomic_load(memory_order_acquire)` |`l{b\|h\|w\|d}` | 6

|`atomic_load(memory_order_seq_cst)` |`fence rw,rw; l{b\|h\|w\|d}` | 5
|`atomic_load(memory_order_seq_cst)` |`fence rw,rw; l{b\|h\|w\|d}` | 6

|`atomic_store(memory_order_release)` |`s{b\|h\|w\|d}` | 5
|`atomic_store(memory_order_release)` |`s{b\|h\|w\|d}` | 6

|`atomic_store(memory_order_seq_cst)` |`s{b\|h\|w\|d}; fence rw, rw` | 5
|`atomic_store(memory_order_seq_cst)` |`s{b\|h\|w\|d}; fence rw, rw` | 6

|`atomic_thread_fence(memory_order_acquire)` |`nop` | 5
|`atomic_thread_fence(memory_order_acquire)` |`nop` | 6

|`atomic_thread_fence(memory_order_release)` |`nop` | 5
|`atomic_thread_fence(memory_order_release)` |`nop` | 6

|`atomic_thread_fence(memory_order_acq_rel)` |`nop` | 5
|`atomic_thread_fence(memory_order_acq_rel)` |`nop` | 6
|===

[cols="<20,<20,<4",options="header",]
|===
|C/{Cpp} Construct |Ztso AMO Mapping |Notes

|`atomic_<op>(memory_order_acquire)` |`amo<op>.{w\|d}` |4, 5
|`atomic_<op>(memory_order_acquire)` |`amo<op>.{w\|d}` |4, 6

|`atomic_<op>(memory_order_release)` |`amo<op>.{w\|d}` |4, 5
|`atomic_<op>(memory_order_release)` |`amo<op>.{w\|d}` |4, 6

|`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}` |4, 5
|`atomic_<op>(memory_order_acq_rel)` |`amo<op>.{w\|d}` |4, 6

|`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}` |4, 5
|`atomic_<op>(memory_order_seq_cst)` |`amo<op>.{w\|d}` |4, 5, 6

|===

Expand All @@ -201,21 +207,30 @@ We present the mappings as a table in 3 sections, as above.
|C/{Cpp} Construct |Ztso LR/SC Mapping |Notes

|`atomic_<op>(memory_order_acquire)`
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6

|`atomic_<op>(memory_order_release)`
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6

|`atomic_<op>(memory_order_acq_rel)`
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 5
|`loop:lr.{w\|d}; <op>; sc.{w\|d}; bnez loop` |4, 6

|===

=== Meaning of notes in table

3) Incompatible with the original "Table A.6" mapping. Do not combine these
mappings with code generated by a compiler using those older mappings.
(This was mostly used by the initial LLVM implementations for RISC-V.)

4) Currently only directly possible for 32- and 64-bit operands.

5) Requires the Ztso extension.
5) atomic_compare_exchange operations with a memory_order_seq_cst failure
ordering are considered to have a note 3 annotation.
To remove the note 3 annotation the amocas operation must be prepended with a
leading fence (`fence rw,rw; amocas.{w\|d}`).

6) Requires the Ztso extension.

== Other conventions

Expand Down
Loading