How did you achieve gs thread locals?

Hello, I’m just a noob trying to create my own little kernel to learn as much as I can.
I kind of figured out how to support SMP but I have a problem with #[thread_local] vars, without any special configuration the final binary tries to load them from fs, but I would like to use gs (so i can swap it easily). I see that redox kernel uses gs too (src/arch/x86_64/gdt.rs the kpcr is loaded in gs while fs reamains at 0) so that must mean that in some way you use gs-based thread locals.
How did you do that? have you forked llvm to achieve it? I tried making my target almost the same but it does not seem to matter.
Anyways I must say that you have the best kernel I’ve ever seen, the code is pure art and I learned so much from it, thank you so much.

Here’s an really good blog for creating a simple Kernel where anything gets explained with code examples: https://os.phil-opp.com/
If u want to go further to userspace, this basically is an “contiuation” of the blog to get to the userspace: https://nfil.dev/kernel/rust/coding/rust-kernel-to-userspace-and-back/

Thanks, I did follow the phil-opp blog and I’m building my kernel upon that (but I didn’t know the userspace blog). My question was on how to use normal variable access to read/write thread local storage using gs instead of fs (normally used in userspace).
After some research I came across this https://gitlab.redox-os.org/redox-os/binutils-gdb/-/merge_requests/5 (a custom fork of the compilation stack that enables just this).
Is it possible to make a pull request upstream so all of the rust community (and beyond) could use that feature?