smc149
October 22, 2019, 2:34pm
1
Hi, I want to use "Memory references off the GS segment" in Rust.
Below is an example of it in clang.
#define GS_RELATIVE __attribute__((address_space(256)))
int foo(int GS_RELATIVE *P) {
return *P;
}
Which compiles to (on X86-32):
_foo:
movl 4(%esp), %eax
movl %gs:(%eax), %eax
ret
Check https://buildmedia.readthedocs.org/media/pdf/clang/release_37/clang.pdf on page 128
vmedea
October 23, 2019, 8:25am
2
i don't think this is currently possible without using (inline) assembly
for AMDGCN (GPU) there has been some work on supporting address spaces: Tracking issue for targeting AMDGPU devices · Issue #51575 · rust-lang/rust · GitHub , but this was never merged not even unstable
proposals to make it easier to 'punch through' LLVM attributes tend to be rejected because of not wanting to tie the language too closely to LLVM: Make it easy to attach LLVM attributes to Rust functions · Issue #15180 · rust-lang/rust · GitHub
H2CO3
October 23, 2019, 8:49am
3
FYI, supporting the Atmel AVR family of µCs is also blocked on the need for properly supporting address spaces.
1 Like
system
Closed
January 21, 2020, 8:49am
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.