November 06

I corss to ARM(contex A7) ,the static this and static ~this does nit work.
Whether the system compiles parameters or what happens, I have no idea.
我使用LDC交叉编译到 armv7l linux上,“static this”不能执行。可能出现什么情况不调用?会不会是我编译系统参数有影响。

the Code(代码如下):

import std.stdio;
// import core.thread;
import core.runtime;

shared static this(){
writeln("run shared static this");
}

static this(){
writeln("run static this");
}

shared static ~this(){
writeln("run shared static ~this");
}

static ~this(){
writeln("run static ~this");
}


void main()
{
	writeln("run main");
	writeln("exit main");

}

when I use linux on X86-64(在主机 linux运行效果(Opensuse):):

dub run -f
    Starting Performing "debug" build using /home/duyu/bin/ldc2-1.34.0-linux-x86_64/bin/ldc2 for x86_64.
    Building dtest ~master: building configuration [application]
     Linking dtest
     Running dtest
run shared static this
run static this
run main
exit main
run static ~this
run shared static ~this

But I corss to ARM(contex A7) ,the static this and static ~this does nit work.
Whether the system compiles parameters or what happens, I have no idea.
In the borad Arm (在ARM linux 上)。

# chmod +x ./dtest
# uname -a
Linux PQ-A40i 3.10.65 #13 SMP PREEMPT Sun Oct 22 11:29:35 CST 2023 armv7l GNU/Linux
# ./dtest
run main
exit main
#
November 07

On Monday, 6 November 2023 at 03:23:08 UTC, Dsby wrote:

>

I corss to ARM(contex A7) ,the static this and static ~this does nit work.
Whether the system compiles parameters or what happens, I have no idea.
我使用LDC交叉编译到 armv7l linux上,“static this”不能执行。可能出现什么情况不调用?会不会是我编译系统参数有影响。

the Code(代码如下):

import std.stdio;
// import core.thread;
import core.runtime;

shared static this(){
writeln("run shared static this");
}

static this(){
writeln("run static this");
}

shared static ~this(){
writeln("run shared static ~this");
}

static ~this(){
writeln("run static ~this");
}


void main()
{
	writeln("run main");
	writeln("exit main");

}

when I use linux on X86-64(在主机 linux运行效果(Opensuse):):

dub run -f
    Starting Performing "debug" build using /home/duyu/bin/ldc2-1.34.0-linux-x86_64/bin/ldc2 for x86_64.
    Building dtest ~master: building configuration [application]
     Linking dtest
     Running dtest
run shared static this
run static this
run main
exit main
run static ~this
run shared static ~this

But I corss to ARM(contex A7) ,the static this and static ~this does nit work.
Whether the system compiles parameters or what happens, I have no idea.
In the borad Arm (在ARM linux 上)。

# chmod +x ./dtest
# uname -a
Linux PQ-A40i 3.10.65 #13 SMP PREEMPT Sun Oct 22 11:29:35 CST 2023 armv7l GNU/Linux
# ./dtest
run main
exit main
#

我看了下 ldd, 在 arm linux 上没有 “linux-vdso.so.1 ” ,可能这就是原因把。我差了下代码,runtime 使用 DSOs 加载的 static this 。

I looked at ldd and there is no "linux-vdso.so.1" on arm linux, maybe that's why. I messed up the code. runtime uses DSOs to load static this.

IN amd64 :

export LD_TRACE_LOADED_OBJECTS=1
> ./dtest
        linux-vdso.so.1 (0x00007ffdf5ffd000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fb20b851000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb20b82c000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fb20b600000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb20b95d000)

In ARMV7:

# export LD_TRACE_LOADED_OBJECTS=1
# ./dtest
        librt.so.1 => /lib/librt.so.1 (0xb6f66000)
        libdl.so.2 => /lib/libdl.so.2 (0xb6f53000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb6f3f000)
        libm.so.6 => /lib/libm.so.6 (0xb6eca000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6ea1000)
        libc.so.6 => /lib/libc.so.6 (0xb6db4000)
        /lib/ld-linux-armhf.so.3 (0xb6f7c000)
#