简体   繁体   English

更改glibc,但没有任何反应

[英]Changing glibc but nothing happens

I want to modify glibc. 我想修改glibc。 So I have downloaded a version of it and made some changes in the code. 因此,我下载了它的一个版本,并对代码进行了一些更改。 For example I've made changes to memset . 例如,我对memset进行了更改。 However, I don't see any difference if I use the .so file produced by the compilation (using LD_PRELOAD) as compared to when I don't do any LD_PRELOAD. 但是,与不执行任何LD_PRELOAD相比,如果使用编译生成的.so文件(使用LD_PRELOAD),则看不到任何区别。 memset behaves like it does. memset的行为类似于它。 Why is that so? 为什么会这样? Is that maybe the compiler is inlining memset and not using anything from the shared object? 难道编译器会内联memset而不使用共享库中的任何内容? I don't understand this. 我不明白 I even made changes to printf, but still nothing. 我什至对printf进行了更改,但仍然一无所获。 Why is that so. 为什么会这样。 How can I modify glibc (for testing purposes), so that I do see a change? 如何修改glibc(出于测试目的),以便看到更改?

Moreover, when I tried to change pthread_create (and ofcourse LD_PRELOAded libpthread.so) by introducing printf( "pthread_create") in the beginning of that function, I just get a segmentation fault. 此外,当我尝试通过在该函数的开头引入printf( "pthread_create")来更改pthread_create(当然还有LD_PRELOAded libpthread.so)时,我只会遇到分段错误。 What is going on here? 这里发生了什么? Also if I check the difference in the libc.so after making changes in glibc source, I see no difference in the produced versions. 另外,如果我在glibc源代码中进行更改后检查libc.so中的差异,则看不到生产版本中的差异。 What is happening here. 这里发生了什么。 This is driving me nuts! 这真让我发疯!

GCC provides built-in versions of several functions , including memset() and printf() . GCC提供了几个函数的内置版本,包括memset()printf() It does not link to glibc's implementation of these functions. 它没有链接到glibc的这些功能的实现。

Try passing the -fno-builtin compiler option to inhibit this behavior. 尝试传递-fno-builtin编译器选项以禁止此行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM