今天稍微回头update一下musl这边的porting状况。
之前遇到message queue跟share memory的部份,後来去对了一下porting的状况,发现是qemu-riscv32这边相关的time_t还是使用32bit的:
struct target_shmid_ds {
struct target_ipc_perm shm_perm; /* operation permission struct */
abi_long shm_segsz; /* size of segment in bytes */
abi_ulong shm_atime; /* time of last shmat() */
#if TARGET_ABI_BITS == 32
abi_ulong __unused1;
#endif
abi_ulong shm_dtime; /* time of last shmdt() */
#if TARGET_ABI_BITS == 32
abi_ulong __unused2;
#endif
abi_ulong shm_ctime; /* time of last change by shmctl() */
#if TARGET_ABI_BITS == 32
abi_ulong __unused3;
#endif
abi_int shm_cpid; /* pid of creator */
abi_int shm_lpid; /* pid of last shmop */
abi_ulong shm_nattch; /* number of current attaches */
abi_ulong __unused4;
abi_ulong __unused5;
};
struct target_msqid_ds
{
struct target_ipc_perm msg_perm;
abi_ulong msg_stime;
#if TARGET_ABI_BITS == 32
abi_ulong __unused1;
#endif
abi_ulong msg_rtime;
#if TARGET_ABI_BITS == 32
abi_ulong __unused2;
#endif
abi_ulong msg_ctime;
#if TARGET_ABI_BITS == 32
abi_ulong __unused3;
#endif
abi_ulong __msg_cbytes;
abi_ulong msg_qnum;
abi_ulong msg_qbytes;
abi_ulong msg_lspid;
abi_ulong msg_lrpid;
abi_ulong __unused4;
abi_ulong __unused5;
};
abi_ulong
的意义是指:今天你target的sizeof(ulong)是什麽,他就是什麽,在ilp32上,unsigned long
是32bit宽。
老实说这点在kernel段也算是一个不打算修的漏网之鱼:
typedef __kernel_long_t __kernel_time_t;
......
#ifndef __kernel_long_t
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;
#endif
17 /* Obsolete, used only for backwards compatibility and libc5 compiles */
18 struct msqid_ds {
19 struct ipc_perm msg_perm;
20 struct msg *msg_first; /* first message on queue,unused */
21 struct msg *msg_last; /* last message in queue,unused */
22 __kernel_time_t msg_stime; /* last msgsnd time */
23 __kernel_time_t msg_rtime; /* last msgrcv time */
24 __kernel_time_t msg_ctime; /* last change time */
25 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
26 unsigned long msg_lqbytes; /* ditto */
27 unsigned short msg_cbytes; /* current number of bytes on queue */
28 unsigned short msg_qnum; /* number of messages in queue */
29 unsigned short msg_qbytes; /* max number of bytes on queue */
30 __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
31 __kernel_ipc_pid_t msg_lrpid; /* last receive pid */
32 };
目前kernel看起来是要直接deprecate掉这些票东西了,所以2038问题直接不想解的感觉XD
另外一个是我在bootstrap Alpine Linux 的 openssl
时,发现musl的dlsym变成undefined sysmbol,这点是因为musl libc再做dso的loading时,在32平台上要作time64的rebind :
hidden void *__dlsym_redir_time64(void *restrict p, const char *restrict s, void *restrict ra)
{
#if _REDIR_TIME64
const char *suffix, *suffix2 = "";
char redir[36];
/* Map the symbol name to a time64 version of itself according to the
* pattern used for naming the redirected time64 symbols. */
size_t l = strnlen(s, sizeof redir);
if (l<4 || l==sizeof redir) goto no_redir;
if (s[l-2]=='_' && s[l-1]=='r') {
l -= 2;
suffix2 = s+l;
}
if (l<4) goto no_redir;
if (!strcmp(s+l-4, "time")) suffix = "64";
else suffix = "_time64";
/* Use the presence of the remapped symbol name in libc to determine
* whether it's one that requires time64 redirection; replace if so. */
snprintf(redir, sizeof redir, "__%.*s%s%s", (int)l, s, suffix, suffix2);
if (find_sym(&ldso, redir, 1).sym) s = redir;
no_redir:
#endif
return __dlsym(p, s, ra);
}
为了这件事情,我们必须仿造其他平台新增档案 src/ldso/riscv32/dlsym_time64.S
:
#define __dlsym __dlsym_redir_time64
#define dlsym __dlsym_time64
#include "dlsym.s"
作为这件事情,重新rebuild & repack Alpine Linux的musl-*.apk
,就可以顺利打掉包含openssl等等package会build fail的问题了。
<<: Day8 Android - 切换页面(Intent)
内容发布到网路上,由於都是开放的,不管是你写的文章、拍摄的相片或是影片,有一定的机率会被转贴。有些人...
当年不懂事,看网路的教学就乱作一通,看看这可怕的凭证数量 以下解释关键的凭证申请与用途 01 登入 ...
在多文字档中搜寻关键字 第一层for回圈使用了os.walk()递回取得路径下的所有档案 第二层fo...
x-on x-on 可以简单的用从 DOM 中来触发事件,像是最常用的按钮: <button ...
IWebHostEnvironment用於在runtime期间判断目前在舍麽环境执行 预设产生的St...