gcc/ld - create a new libc.so with __isoc99_sscanf@@GLIBC_2.7 symbol from glibc.2.6

吃可爱长大的小学妹 提交于 2019-11-29 00:14:50

I found @felipecs answer very helpful. In addition our application had to do some dynamic linking using ocaml, and we found that the given script doesn't work for this scenario, since it makes the application only export the __isoc99_sscanf symbol as a global.

GLIBC_2.7 {
 global: *;
};

the above script resolves this issue and allows ocaml's dynamic linker to work properly. using the -D_GNU_SOURCE option alone wasn't enough to avoid this issue since the dependency on GLIBC_2.7 came from a prebuilt binary we were statically linking with.

Your second version works with this script:

GLIBC_2.7 {
 global: __isoc99_sscanf;
 local: *;
};

Using -Wl,--version-script=script.txt, however, I don't know how to access the original sscanf@GLIBC_2.4.

Anyway, perhaps you would want to use -D_GNU_SOURCE instead; to avoid __isoc99_sscanf altogether.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!