Relevance of libc.so.6 in Linux kernel [closed]

白昼怎懂夜的黑 提交于 2019-12-01 03:33:40

问题


My question is whether Linux kernel contains libc.so.6? After googling and going through different links, we found that libc.so.6, is not a part of Linux kernel, as the kernel has same libraries implemented for its own use in kernel space. libc.so.6 is a userspace library. But, still, the question was left, if the libc.so.6 is removed from "/lib", it crashes, as all the basic applications of Linux crashes.

So, the basic questions were left on:

  1. Can Linux run without libc.so.6? If yes, where such implementation is used?
  2. Who provides libc.so.6? Is it provided by Linux distributions only?
  3. Does Linux internally supports threading or not?

回答1:


  1. Yes. For example, I could write an application in assembly that did not use libc. Here are some examples: https://stackoverflow.com/questions/284797/hello-world-in-less-than-20-bytes
  2. On Linux, glibc is a common implementation of libc: https://www.gnu.org/software/libc/
  3. Yes. The threading options that glibc provides are a shim layer over a kernel interface.



回答2:


Can Linux run without libc.so.6? If yes, where is this the case?

Compiling the code with option -nostdlib won't use standard libraries,

man GCC tells,

-nostdlib Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify will be passed to the linker. The compiler may generate calls to memcmp, memset, memcpy and memmove. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified.

Check webpage for good glibc free implementation.



来源:https://stackoverflow.com/questions/19682782/relevance-of-libc-so-6-in-linux-kernel

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