digitalmars.D.learn - is the runtime implemented in betterC?
- dangbinghoo (10/10) Nov 08 2019 hi,
- Adam D. Ruppe (5/10) Nov 08 2019 There's ARM/Linux druntime builds... but the real question is the
- kinke (8/14) Nov 08 2019 druntime is not compiled as `-betterC`, because the entire point
- dangbinghoo (9/14) Nov 08 2019 hmm, if runtime is implemented in regular D, how could the
- Adam D. Ruppe (13/16) Nov 08 2019 Think of a file like this:
- Jacob Carlborg (5/11) Nov 09 2019 One needs to be a bit careful. For example, to not use the garbage
- kinke (17/30) Nov 09 2019 This is getting confusing. You definitely don't need a prebuilt
- dangbinghoo (9/11) Nov 09 2019 thank you all first! I just made a basic mistake and didn't
hi, is the runtime d code implemented purely with betterC? i was thinking that what's happening when we building ARM dlang compiler, when the dlang compiler ready in the first, there's no ARM version of the runtime lib and phobos, so, it's likely we are using bare metal D and trying to build the runtime. is this true? thanks! --- binghoo
Nov 08 2019
On Friday, 8 November 2019 at 10:40:15 UTC, dangbinghoo wrote:is the runtime d code implemented purely with betterC?It is actually implemented in regular D!i was thinking that what's happening when we building ARM dlang compiler, when the dlang compiler ready in the first, there's no ARM version of the runtime lib and phobos, so, it's likely we are using bare metal D and trying to build the runtime.There's ARM/Linux druntime builds... but the real question is the operating system because the druntime heavily relies on an underlying OS.
Nov 08 2019
On Friday, 8 November 2019 at 10:40:15 UTC, dangbinghoo wrote:hi, is the runtime d code implemented purely with betterC? i was thinking that what's happening when we building ARM dlang compiler, when the dlang compiler ready in the first, there's no ARM version of the runtime lib and phobos, so, it's likely we are using bare metal D and trying to build the runtime.druntime is not compiled as `-betterC`, because the entire point of `-betterC` is to prevent a dependency on druntime, at least at link-time [so C forward declarations and some templates can be used by code compiled as `-betterC`]. I'm not sure what you are trying to achieve; you can easily cross-compile druntime & Phobos with LDC, see https://wiki.dlang.org/Building_LDC_runtime_libraries.
Nov 08 2019
On Friday, 8 November 2019 at 13:52:18 UTC, kinke wrote:On Friday, 8 November 2019 at 10:40:15 UTC, dangbinghoo wrote:hmm, if runtime is implemented in regular D, how could the regular D code depends on regular D runtime be compiled when we doesn't have a D runtime even exists? thinking thant we just have xtensa-llvm, and building ldc for xtensa CPU, the runtime will simply just not compiled. it's an egg-chicken problem? -- thanks!hi,I'm not sure what you are trying to achieve; you can easily cross-compile druntime & Phobos with LDC, see https://wiki.dlang.org/Building_LDC_runtime_libraries.
Nov 08 2019
On Friday, 8 November 2019 at 15:25:40 UTC, dangbinghoo wrote:hmm, if runtime is implemented in regular D, how could the regular D code depends on regular D runtime be compiled when we doesn't have a D runtime even exists?Think of a file like this: // test.d void foo() { } void bar() { foo(); } The code in that file depends on code in that file... but of course it works since it is all there. The D runtime is similar. All it really is is a list of bunch of functions that might be called. If you define those functions in your build when you use them, it works as a unit. But like I said in my other message, the hard part is sometimes cpu arch but most the coupling is to an existing operating system...
Nov 08 2019
On 2019-11-08 16:25, dangbinghoo wrote:hmm, if runtime is implemented in regular D, how could the regular D code depends on regular D runtime be compiled when we doesn't have a D runtime even exists? thinking thant we just have xtensa-llvm, and building ldc for xtensa CPU, the runtime will simply just not compiled. it's an egg-chicken problem?One needs to be a bit careful. For example, to not use the garbage collector before it's initialized. -- /Jacob Carlborg
Nov 09 2019
On Friday, 8 November 2019 at 15:25:40 UTC, dangbinghoo wrote:On Friday, 8 November 2019 at 13:52:18 UTC, kinke wrote:This is getting confusing. You definitely don't need a prebuilt druntime to build the static druntime library, the dependency is at link-time, and then druntime just depends on other parts of itself. No chicken-egg problem. It's still not clear to me what you are actually trying to achieve. If you are working on an x64 machine, have built a special xtensa-LLVM and built an LDC linked against that LLVM, you can cross-compile to that CPU. You can use the mentioned ldc-build-runtime tool to try to cross-compile druntime and Phobos (and optionally the testrunners). Then it's all about fixing the resulting compile errors (and link errors for the testrunners); most of the adaptations are in druntime, but you'll also have to slightly adapt the compiler (at least adding a new predefined version for the new CPU architecture). druntime depends on OS, architecture and coupled C runtime - what OS are you going to target?On Friday, 8 November 2019 at 10:40:15 UTC, dangbinghoo wrote:hmm, if runtime is implemented in regular D, how could the regular D code depends on regular D runtime be compiled when we doesn't have a D runtime even exists? thinking thant we just have xtensa-llvm, and building ldc for xtensa CPU, the runtime will simply just not compiled. it's an egg-chicken problem?hi,I'm not sure what you are trying to achieve; you can easily cross-compile druntime & Phobos with LDC, see https://wiki.dlang.org/Building_LDC_runtime_libraries.
Nov 09 2019
On Saturday, 9 November 2019 at 22:46:16 UTC, kinke wrote:druntime depends on OS, architecture and coupled C runtime - what OS are you going to target?thank you all first! I just made a basic mistake and didn't realized that druntime is just libraries and onlymatter when linking the final executebals. and for xtensa cpu, most used chip is the esp32 mcu, it only has support of freeRTOS, and implemented just few posix api for stdio and threads. so, basically i can only use betterC set of normal D. thanks!
Nov 09 2019