On 6 September 2013 10:35, eles <e...@eles.com> wrote: > I am starting a new thread, since I am afraid that the other one will become > too cluttered with issues... > > It is about this OS kernel: > > http://wiki.osdev.org/D_Bare_Bones > > I tried to duplicate the steps. However, on my x86_64 machine, the actual > commands that I had to use are: > > $nasm -f elf -o start.o start.asm > $gdc -m32 -nostdlib -nodefaultlibs -g -c -o kernel.main.o kernel.main.d > $LDEMULATION="elf_i386" ld -T linker.ld -o kernel.bin start.o kernel.main.o > > (in order to emulate the 32-bits architecture). > > The first command went just fine, the second command emitted warnings: > > kernel.main.d:13: Deprecation: volatile statements deprecated; use > synchronized statements instead > kernel.main.d:16: Deprecation: volatile statements deprecated; use > synchronized statements instead > kernel.main.d:18: Deprecation: volatile statements deprecated; use > synchronized statements instead > > while the third one was merciless: > > kernel.main.o: In function `main': > /home/user/bootloader/kernel.main.d:12: undefined reference to > `_d_criticalenter' > /home/user/bootloader/kernel.main.d:12: undefined reference to > `_d_criticalexit' > /home/user/bootloader/kernel.main.d:15: undefined reference to > `_d_criticalenter' > /home/user/bootloader/kernel.main.d:15: undefined reference to > `_d_criticalexit' > /home/user/bootloader/kernel.main.d:16: undefined reference to > `_d_criticalenter' > /home/user/bootloader/kernel.main.d:16: undefined reference to > `_d_criticalexit' > kernel.main.o: In function `kernel.main._D6kernel4main9__modinitFZv': > /home/user/bootloader/kernel.main.d:18: undefined reference to > `_Dmodule_ref' > /home/user/bootloader/kernel.main.d:18: undefined reference to > `_Dmodule_ref' > > Any clues? It is because of the deprecated volatile statements?
Yep - this is probably the big problem with deprecating volatile statements (actually, volatile is no longer in the compiler). You are removing a low level feature and forcing users to use a high level user-land feature instead. The key thing you must know if you intend to do some low level pokery is that you must ditch druntime and phobos and re-implement druntime from scratch in the most minimalistic way possible (and so that it doesn't depend on libc). There is a minimal druntime kicking about I think that an exokernel written in D1 uses... you could perhaps recycle that. Back to volatile.... the only (faintly close) alternative is 'shared'. But there's no equivalent to volatile statements other than implementing your own low level thread library for use in kernel-land to allow synchronized to work properly. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';