共享库术语

发布于 2024-07-14 18:59:02 字数 671 浏览 6 评论 0原文

“共享库文本”和“共享库数据”有什么区别? 另外,共享库数据“预重定位”意味着什么? 这个问题涉及到涉及共享库的几个特定于 AIX 的功能。

What is the difference between "shared library text" and "shared library data"? Also, what does it mean for shared library data to be "pre-relocated"? This question is in reference to a couple of AIX-specific features involving shared libraries.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半夏半凉 2024-07-21 18:59:02

啊,这是一个棘手的问题。

好吧,要回答这个问题,您必须知道可执行文件有两个*段:“文本”部分和“数据”部分。

“数据”段包含“不会被执行的东西”。 例如,程序中的字符串(例如,字符串“Command not find”将位于 /bin/sh 二进制文件的数据段中)。

“文本”段包含“将被执行的内容”——机器指令。

而且,“预先重新定位”......这里有一个相当好的解释为什么需要重新定位:http://people.redhat.com/drepper/textrelocs.html 以及此处涉及的内容:http://en.wikipedia.org/wiki/Relocation_(computer_science)

这有帮助吗?

*:吹毛求疵的注意:它有两个以上,但现在这并不重要

Ah, that's a tricky question.

Alright, so to answer it, you've got to know that an executable file has two* segments: a "text" section and a "data" section.

The "data" segment contains "stuff that won't get executed". For example, strings in the program (for example, the string "Command not found" would be in the data segment of the /bin/sh binary).

The "text" segment contains "stuff that will get executed" -- the machine instructions.

And, the "pre-relocated"... There is a fairly good explanation of why relocation is needed here: http://people.redhat.com/drepper/textrelocs.html and what is involved here: http://en.wikipedia.org/wiki/Relocation_(computer_science).

Does that help?

*: nitpicker note: it's got more than two, but that's not important right now

攒眉千度 2024-07-21 18:59:02

内存分为4段——代码段、数据段、堆栈段和内存段。 堆。

“共享库文本”是共享库的代码部分——实现库中功能的实际指令。

“共享库数据”是共享库的数据部分——全局变量、常量、静态内容等,在加载库时立即分配。

至于“预迁移”库,概念如下。 当共享库被加载时,它被映射到共享地址空间。 “预重定位”库是通过“提示”构建的,告诉操作系统应该将其加载到共享地址空间中的哪个位置。 由于我无法理解的原因,这应该会提高性能。

Memory is divided into 4 segments - code, data, stack & heap.

The "shared library text" is the code part of the shared library - the actual instructions that implement the functionality in the library.

The "shared library data" is the data part of the shared library - global variables, constants, static stuff, etc. that is allocated immediately when the library is loaded.

As for "pre-relocated" libraries, here's the concept. When a shared library is loaded, it is mapped into a shared address space. A "pre-relocated" library is built with a "hint" telling the OS where in that shared address space it should be loaded. For reasons beyond my understanding, that is supposed to improve performance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文