Add percore attribute macro feature - #37
Conversation
de389be to
aae4ffb
Compare
| // This project is dual-licensed under Apache 2.0 and MIT terms. | ||
| // See LICENSE-APACHE and LICENSE-MIT for details. | ||
|
|
||
| #[cfg(all(target_arch = "aarch64", target_os = "none"))] |
There was a problem hiding this comment.
Is target_os = "none" actually required? What stops this from running under an OS?
There was a problem hiding this comment.
This prevents including these parts when building for AArch64 based Macs. The Mach-O format handles sections differently and this causes a build failure in dependent projects like RF-A when running cargo test.
Per-core tests don't work on aarch64-apple-darwin to begin with, but that's a separate issue.
There was a problem hiding this comment.
I looked into this and this is the error on Mac when running cargo test in the RF-A repo:
rustc-LLVM ERROR: Global variable '_ZN9rf_a_bl318services3ffa4spmd15SPMD_CORE_LOCAL17h1940126bd1185568E' has an invalid section specifier '.percore': mach-o section specifier requires a segment and section separated by a comma.
error: could not compile rf-a-bl31 (lib test)
If I use __DATA,.percore, it works.
The rest of the #[cfg(all(target_arch = "aarch64", target_os = "none"))] guarded parts would fail in Mac because it uses a different relocation model and it doesn't work with adrp and add ... :lo12:....
Add a new `derive` feature backed by the `percore-derive` proc-macro crate. The `#[percore::percore]` attribute places statics in the `.percore` section, generates a wrapper type, and exposes per-core access through the runtime offset hook. Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: I6acca7a5d5b835b92592174aeed303bc5e57dcb4
* Documentation fixes * Added PerCoreWrapper * percore_local_offset_hook -> PercoreLocalOffsetImpl * Require using ExceptionLock * Fixed BTI use case Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: I7bf8fa841f152e87d3a7b8a18e7d1d00dd9b19d3
a1bb1f2 to
0d59fcb
Compare
* Merged the variable and it's wrapper * Renamed PerCoreWrapper to LinkedPerCore * Added documentation Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: Ibcca7429e64cb84629acd3f96e733e0b80606cc9
Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: I862dd933a36083ebcbd542773283cb002e6ca714
Add a new
derivefeature backed by thepercore-deriveproc-macro crate. The#[percore::percore]attribute places statics in the.percoresection, generates a wrapper type, and exposes per-core access through the runtime offset hook.