简体   繁体   English

GCC M68K PC相对

[英]GCC m68k pc-relative

I was using a Microtek toolchain to generate an executable binary with relocatable code (pc-relative) and data from a fixed address (Absolute data). 我正在使用Microtek工具链生成具有可重定位代码(相对于pc)和来自固定地址的数据(绝对数据)的可执行二进制文件。 Today, this toolchain does not work on Windows 7 64 bits. 如今,此工具链无法在Windows 7 64位上运行。 The idea is to replace Microtek toolchain for 68000 with the GNU toolchain (GCC 4.8.0). 这个想法是用GNU工具链(GCC 4.8.0)代替68000的Microtek工具链。

But I can not find the same options on the gcc compiler: 但是我在gcc编译器上找不到相同的选项:

Microtec compiler "MCC68K" with: "-Mcp": Directs the compiler to use PC-relative addressing for all code references. Microtec编译器“ MCC68K”,带有:“ -Mcp”:指示编译器对所有代码引用使用PC相对寻址。 "-Mda": Directs the compiler to use absolute addressing for all data references. “ -Mda”:指示编译器对所有数据引用使用绝对寻址。

Gcc (m68k-elf-gcc) with: -mpcrel GCC(m68k-elf-gcc)具有:-mpcrel

Unable to build with gcc relocatable code with no relocatable data as the Microteck compiler. 无法像Microteck编译器那样使用没有可重定位数据的gcc可重定位代码进行构建。 With "-mpcrel", all is relocatable (code and data). 使用“ -mpcrel”,所有内容均可重定位(代码和数据)。

do you have an idea? 你有想法吗?

Sorry for my bad english. 对不起,我的英语不好。

Thanks. 谢谢。

As far as I know, there is no way to achieve the same result with the GNU m68k toolchain. 据我所知,使用GNU m68k工具链无法获得相同的结果。

  • -mpcrel will generate fully position-independent code with pc-relative adressing for code as well as for data, resulting in a limited program/data size (pc-relative offsets cannot exceed 16 bits). -mpcrel将生成完全独立于位置的代码,并且对代码和数据使用pc相对地址,从而导致程序/数据大小受限(pc相对偏移不能超过16位)。
  • -fpic and -fPIC will generate position independent code with relocatable binaries but will require a special loader that does the in-place relocation -fpic-fPIC将生成具有可重定位二进制文​​件的与位置无关的代码,但将需要特殊的加载程序来进行就地重定位

From gcc docs 来自gcc文档

-fpic Generate position-independent code (PIC) suitable for use in a shared library,... -fpic生成适合在共享库中使用的位置无关代码(PIC),...

-fPIC If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. -fPIC如果目标计算机支持,则发出与位置无关的代码,适合动态链接并避免对全局偏移表的大小进行任何限制。

Also try to search 也尝试搜寻

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

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