- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
关于AT (...)
ld
的指令, this source状态:AT ( ldadr )
The expression ldadr that follows the AT keyword specifies the load address of the section. The default (if you do not use the AT keyword) is to make the load address the same as the relocation address. This feature is designed to make it easy to build a ROM image.
我一直在搜索,但没有找到“加载地址”和“重定位地址”的明确定义。
我知道当目标文件链接在一起时,代码在跳转地址中被“重新定位”,等等被重写以指向组合机器代码中的正确偏移量。那么,“重定位地址”是一个部分开始的结果目标代码中的偏移量吗?如果是这样,一个部分的“加载地址”怎么可能有所不同?
如果这两个地址不同,链接器的输出将如何受到影响?
最佳答案
差异至关重要。重定位地址添加到节中的所有重定位。因此,如果它与加载地址不同,则在此部分中什么都不会真正起作用 - 部分内的所有 reloc 都将被解析为错误的值。
那么为什么我们需要这样的技术呢?应用程序不多,但假设 ( from here ) 您的架构上确实有 0x1000 的极快内存
那么你可以取两个部分来获得重定位地址 0x1000:
.text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
__load_start_text0 = LOADADDR (.text0);
__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0);
.text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
__load_start_text1 = LOADADDR (.text1);
__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1);
. = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
extern char __load_start_text1, __load_stop_text1;
memcpy ((char *) 0x1000, &__load_start_text1,
&__load_stop_text1 - &__load_start_text1);
关于gcc - "load address"和 "relocation address"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29271886/
我正在编译 linux-4.19(gcc-8.2 bintutils-2.31),但是它总是失败并出现如下错误: aarch64-oe-linux-ld.bfd: drivers/platform/g
我在 Macbook Pro 上的 VirtualBox 上运行 Ubuntu 14.04 64 位 MAC。我在 hello_kernel.c 中有以下内容,我想运行它。 #include #in
这是我在 AArch64 上遇到的问题的简化版本: 我有一个宏,可以不断地将一些数据转储到一个部分中。 #define GEN_DATA(_type) \ .pushsection .mydat
我们已经将我们的 subversion 存储库移到了不同的服务器上。我跑了svn swtich --relocate将我的开发工作站存储库更改为新位置。 问题是它看起来像它工作,因为没有报告错误消
这是一个与u-boot相关的基本问题。 为什么 u-boot 代码会自行重定位? 好的,如果 u-boot 是从 NOR-flash 或引导 ROM 空间执行是有道理的,但如果它已经从 SDRAM 运
我们的 svn 存储库的位置已更改为不同的 url,此外主干、分支和标签的相对路径也移动了一点。现在,当我尝试 svn relocate 时,我收到此消息。 无效的重定位目标:'https://my-
当有人这样做时 svn switch ,我知道它将工作目录切换到目标路径。 我想了解 --relocate 的用途。我认为这仅在存储库的 url 发生更改并且想要更新工作副本 url 以指向新的
我正在尝试将工作副本文件夹从旧的专用 svn 服务器移动到新的 svn 服务器,其中包含子文件夹。使用以下重定位命令: svn switch --relocate https://oldserver/
我想用 gfortran 创建一个共享库,出于可移植性的原因将它与静态版本的 libgfortran 链接起来。不幸的是,我没有设法适本地链接不同的对象。我已经找到一些解决类似问题的帖子,但我不知道如
我的应用旨在在 android 6 上运行,据我所知,它不允许加载共享库。 有没有人遇到过这个问题并且能够成功解决? java.lang.UnsatisfiedLinkError: dlopen fa
在我的 Debian x86 32 位中,当我执行 readelf -r/usr/lib/libstdc++.so.6 | grep pthread,我得到这个输出: 000eceac 000062
我想知道为什么某些 Windows 可执行文件确实有重定位。与 DLL 不同,当可执行文件始终可以加载到任何虚拟地址时,为什么需要它? 最佳答案 是的,EXE 中的重定位是可选的,可以去除。但如果我们
我无法在我的 linux 电脑上编译任何东西。我不知道为什么,可能是我安装了一些软件包并弄得一团糟。我已经卸载并重新安装了 gcc 和其他软件包,但没有好消息.. 仍然是这个问题。 这是消息: /us
我正在 Nexus 5 上测试 Android 6.0,我正在使用 Metaio(我知道该服务将于 12 月 15 日结束,但在那一天我们将转移到另一个 AR 平台)。问题是当我启动 ARActivi
我正在尝试将静态库链接到共享库,但出现以下错误 /usr/bin/ld: ../../../libraries/log4cplus/liblog4cplus.a(fileappender.o): re
如果你做 dumpbin/header 它会给你所有 7 个部分的数据转储。 。数据 .idata .rdata .reloc .rsrc 。文本 .textbss 其中 .rsrc 和 .idata
这个问题的变体已被问过很多次,但没有一个答案阐明我感兴趣的内容: 我想(显然...:) 将我的本地工作副本与两个不同服务器上的两个存储库同步。如果我将 svn switch 与 --relocate
我正在尝试为ATmega328 micro编译一些代码,并且我想使用Arduino的库和核心。我正在使用CMake。我已经编译了核心库和代码的所有对象以及Arduino的库。但是,当链接时,它们向我显
我是这个社区的新手,因为我以前从未创建过帐户并提出过问题,但我一直使用这个网站来解决我的编程难题。所以谢谢!不过这一次,我找不到另一个符合我确切需求的问题。如果重复,我深表歉意。 我使用的是 elem
鉴于我已经编译了一些 unix 程序,我可能需要做些什么来将它重新定位到不同的目录并让它继续正常运行。 我正在考虑 Perl,但对其他系统(如 Apache)感兴趣,这些系统在完成后似乎也会失败。为了
我是一名优秀的程序员,十分优秀!