Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

New world的glibc符号问题 #73

Open
RevySR opened this issue Nov 9, 2022 · 4 comments
Open

New world的glibc符号问题 #73

RevySR opened this issue Nov 9, 2022 · 4 comments

Comments

@RevySR
Copy link
Author

RevySR commented Nov 9, 2022

测试代码

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char * argv[]){
    char *a = malloc(sizeof(char) *(2+1));
    a[0] = 'H';
    a[1] = 'i';
    a[2] = 0;
    char b[] = "Ho";
    memcpy(a, b, 2);
    printf("%s\n", a);
    return 0;
}

在gentoo 上编译的结果 符号

0000000000007e30 a _DYNAMIC
0000000000008040 a _GLOBAL_OFFSET_TABLE_
0000000000000958 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
00000000000006b0 a _PROCEDURE_LINKAGE_TABLE_
000000000000095c r __GNU_EH_FRAME_HDR
0000000000008040 d __TMC_END__
0000000000008088 B __bss_start
                 w __cxa_finalize@GLIBC_2.36
0000000000008080 d __dso_handle
                 U __libc_start_main@GLIBC_2.36
                 U __stack_chk_fail@GLIBC_2.36
                 U __stack_chk_guard@GLIBC_2.36
0000000000008088 D _edata
0000000000008090 B _end
0000000000000730 T _start
                 U abort@GLIBC_2.36
000000000000089c T main
                 U malloc@GLIBC_2.36
                 U puts@GLIBC_2.36

使用euler发行版运行结果

./a.out: /lib64/ld-linux-loongarch-lp64d.so.1: version `GLIBC_2.36' not found (required by ./a.out)

查看euler发行版libc符号

nm /lib64/libc.so.6 | grep 2.34

......
000000000008165c T timer_create@@GLIBC_2.34
00000000000818b4 T timer_delete@@GLIBC_2.34
00000000000819bc T timer_getoverrun@@GLIBC_2.34
0000000000081a00 T timer_gettime@@GLIBC_2.34
0000000000081a44 T timer_settime@@GLIBC_2.34
000000000004d798 T tmpfile@@GLIBC_2.34
000000000007f254 T tss_create@@GLIBC_2.34
000000000007f2b8 T tss_delete@@GLIBC_2.34
000000000007f2bc T tss_get@@GLIBC_2.34
000000000007f2c0 T tss_set@@GLIBC_2.34

@jiegec
Copy link

jiegec commented Nov 9, 2022

这是因为 glibc 版本不同,正常现象。

@RevySR
Copy link
Author

RevySR commented Nov 9, 2022

这是因为 glibc 版本不同,正常现象。

实际上euler降低之后 失去互操作性 看起来直接改shlib-versions到 GLIBC_2.36 然后重新编译可能就行

@xry111
Copy link
Contributor

xry111 commented Feb 5, 2023

上游不可能同意把符号版本改成 2.34 (我记得最早的一批 patch 因为这事遭到了批判),所以只能动 openEuler,建议在他们那边开 issue。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants