digitalmars.D.learn - Druntime undefined references
- Severin Teona (19/19) Nov 02 2020 Hi guys!
Hi guys! I build the druntime for an ARM Cortex-M based microcontroller and I trying to create an application and link it with the druntime. I am also using TockOS[1], which does not implement POSIX thread calls and other OS-dependent implementations. As I was looking through the errors I got, I found some functions and I don’t know what they do, or how should I solve the errors. The first one is: libdruntime-ldc.a(dwarfeh.o): in function `_d_eh_personality_common': dwarfeh.d:(.text._d_eh_personality_common[_d_eh_personality_common]+0x2c): undefined reference to `_d_eh_GetIPInfo' and the second one is: dl.d:(.text._D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCgQCeQByQBxQBx[_D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCg CeQByQBxQBx]+0x1a): undefined reference to `dl_iterate_phdr' (the druntime was build as a static library, because I can’t use dynamic libraries on a microcontroller) Does anyone know what these exactly do and how important/essential are they? Is there any way I could solve them? Thank a lot. [1]: https://www.tockos.org
Nov 02 2020
On 11/2/20 1:50 PM, Severin Teona wrote:Hi guys! I build the druntime for an ARM Cortex-M based microcontroller and I trying to create an application and link it with the druntime. I am also using TockOS[1], which does not implement POSIX thread calls and other OS-dependent implementations. As I was looking through the errors I got, I found some functions and I don’t know what they do, or how should I solve the errors. The first one is: libdruntime-ldc.a(dwarfeh.o): in function `_d_eh_personality_common': dwarfeh.d:(.text._d_eh_personality_common[_d_eh_personality_common]+0x2c): undefined reference to `_d_eh_GetIPInfo' and the second one is: dl.d:(.text._D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCgQCeQByQBxQBx[_D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCg CeQByQBxQBx]+0x1a): undefined reference to `dl_iterate_phdr' (the druntime was build as a static library, because I can’t use dynamic libraries on a microcontroller) Does anyone know what these exactly do and how important/essential are they? Is there any way I could solve them? Thank a lot. [1]: https://www.tockos.orgcant' help much but just in case - see https://github.com/ldc-developers/ldc/pull/2405#issuecomment-346187456, may be it helps also you can define this symbol yourself with assert(0) to check if it is called at all what about - quick glance at https://linux.die.net/man/3/dl_iterate_phdr says us that this symbol is used only with shared objects so you can try to define it yourself with assert(0) like this (not tested!!!): ```D extern(C): alias Callback = int function (void*, size_t, void*); int dl_iterate_phdr(Callback callback, void* data) { assert(0); } ``` this lets you to link druntime at least and if those symbols were called abort the execution
Nov 02 2020
On Monday, 2 November 2020 at 10:50:06 UTC, Severin Teona wrote:Hi guys! I build the druntime for an ARM Cortex-M based microcontroller and I trying to create an application and link it with the druntime. I am also using TockOS[1], which does not implement POSIX thread calls and other OS-dependent implementations. As I was looking through the errors I got, I found some functions and I don’t know what they do, or how should I solve the errors. The first one is: libdruntime-ldc.a(dwarfeh.o): in function `_d_eh_personality_common': dwarfeh.d:(.text._d_eh_personality_common[_d_eh_personality_common]+0x2c): undefined reference to `_d_eh_GetIPInfo' and the second one is: dl.d:(.text._D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCgQCeQByQBxQBx[_D4core8internal3elf2dl12SharedObject14thisExecutableFNbNiZSQCg CeQByQBxQBx]+0x1a): undefined reference to `dl_iterate_phdr' (the druntime was build as a static library, because I can’t use dynamic libraries on a microcontroller) Does anyone know what these exactly do and how important/essential are they? Is there any way I could solve them? Thank a lot. [1]: https://www.tockos.orghttps://man7.org/linux/man-pages/man3/dl_iterate_phdr.3.html dl_iterate_phdr is used to iterate over the elf program headers and is used to get a textual back trace among other things. These are typically calls found in Linux systems and if you don't have that, you have to replace them with your own calls or just remove the call all together. Much of the elf stuff can be removed. The only things that might be essential is that druntime needs to know where the TLS data is per thread for scanning.
Nov 02 2020