-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RFC: Add OsUnknown as a target operating system #7
Conversation
Can you format lines to a maximum of 80 characters in width? |
Teach me to think I could do the whole thing in Github; only has soft-wrap and no-wrap (without 78/80 char indicator). |
Having an unknown OS seems like something that shouldn't be a new thing. Has this been explored before in other compilers/languages? I'm concerned that if LLVM doesn't understand an unknown OS that the codegen will be difficult to get right. As you mentioned in the unresolved questions section, this does indeed sound a lot like a clone of linux not built on libc but rather built on another library, specifically Just for reference, here's a list of OS-specific things which we do today which I can think of:
One thing I'm really worried about is the segmented stack prologue generated by LLVM. There's really no way to generate it unless you're targeting a specific OS |
I'll have to do the 80 char thing later tonight. I was doing it in Github but realised that it wasn't even using a monospace font. I chose 'unknown' because it is the LLVM standard for... well... unknown. To tackle the list above
The segmented-stack is related to rust-lang/llvm#4. Thumb arch support was added, but this was done in an OS agnostic way. The implementation is required to provide the STACK_LIMIT symbol, and then provide compatible rt/arch/X/record_sp.S functions that set/get using this. So really the target is Edit: Looking through os, major areas are filesystem (CWD, HOME, etc. mandatory if used), environment (covered by newlib), call args (optional otherwise empty), and memory map. |
@alexcrichton you can target no-OS by using, for example |
(I think) |
Not specifying an OS to LLVM (or specifying an unimplemented OS) drops to the default OS |
If someone wants to give a "thumbs up" that this is the right way to go for handling embedded/portability targets I'll continue to see how much of the above list "just works". If I'm going down the totally wrong track let me know. Based on the naming from rust-lang/rust#11828, I'm aiming for features from prim, libc and anything else that just works. A possible alternative is to be able to build libstd but explicitly disable dynamic linking. So hide the crate-type=dylib and change the rtdeps to not include libdl. |
This is currently in TLS, we may put this in one of a few locations though.
This is not just pthreads TLS, but also the
I fear that this is getting brushed off too easily. LLVM fundamentally cannot generate code for segmented stacks with an "unknown os". The prologue is highly dependent on the platform that it's running on. For example, LLVM currently fails with the target This RFC doesn't seem to mention what would happen with segmented stacks on an unknown OS (this includes runtime support for unknown OSes). This also ties in with my concern about the stack bounds. This isn't just a problem of "implement two functions and that's it", the two functions just can't be implemented for triples where you don't know the OS because you don't know what's available to you. In general, it sounds like an "unknown os" is a concept in a target triple, so I'm ok supporting generating code for it, but I don't feel that this RFC has been fleshed out enough. Without disabling segmented stacks (which this RFC does not mention), I'm having trouble seeing the path forward. |
Thanks. As I said, at the moment the only sane arch for unknown is thumb I'll flesh the RFC out some more by trying to get an idea of what features
|
I've fallen behind on this rfc, most of my spare time has been working out what changes are needed to build well. With #40 landing I think it's best to wait to see if this is still necessary (may still be wanting someway to disable building dylibs). |
I agree, it sounds like we should wait for the dust to settle with libcore before moving forward with this RFC. I'm going to close this for now, but we can reopen if the time is ripe later on. |
Transmit AddSource errors and handle schedule()
Update prepublish RFC with [augment]
Updaet motivation for `::` semantics
cc: rust-lang/rust#12841