什么是符号分辨率? [英] What is Symbol Resolution?

查看:720
本文介绍了什么是符号分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是每一个谈论的事情之一,但没有人定义...我似乎找不到任何有关这个话题的信息。什么是符号分辨率?这是我发现的最好的东西: http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter2-90421.html#chapter2-93321

This seems to be one of those things that every talks about but no one defines...I can't seem to find any information on this topic. What is symbol resolution? This is the best thing I've found: http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter2-90421.html#chapter2-93321

推荐答案

好吧,现在你提到了Unix的nm,我可以精确定位符号解析。

Well, now that you mention Unix's nm, I can pinpoint the symbol resolution.

可执行文件可以引用未在自身内部定义的实体。例如,共享库上的变量或过程。这些实体由外部符号标识。

Executable files can make reference to entities which are not defined inside themselves. For instance, variables or procedures on shared libraries. Those entities are identified by external symbols. The executable might as well have internal symbols that can be referenced by external files -- as is the case, of course of libraries.

在这种情况下,符号分辨率是一个字符串,它是一个可以被外部文件引用的内部符号。 ,一旦程序加载到内存中,为其引用的所有外部实体分配正确的地址。这意味着改变加载的程序中的每个位置,其中引用外部符号。

Symbol resolution, in this context, is, once a program has been loaded into memory, assigning proper addresses to all external entities it refers to. This means changing every position in the loaded program where a reference to an external symbol was made.

这些地址将取决于在内存中的代码与外部

These addresses will depend on where, in the memory, the code with the external symbols has been loaded.

在Unix中,程序的默认编译模式是使用系统共享库,而不是预先链接可执行文件中必要的一切。例如,当使用 gcc 编译程序时,如果希望静态编译它,则传递 -static

In Unix, the default compilation mode for programs is to use the systems shared library, instead of pre-linking everything necessary in the executable. When compiling a program with gcc, for instance, you pass the -static flag if you wish it to be statically compiled, instead of having unresolved symbolic references.

查找共享库以获取更多信息。

Look up "shared libraries" for further information.

这篇关于什么是符号分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆