什么时候应该使用 gcc 的 -m32 选项?

发布于 2024-08-24 18:14:23 字数 202 浏览 5 评论 0原文

我正在编写一个程序,如果我在 Suse 10 32 位系统上编译而不添加 -m32 选项并在 Suse 10 64 位上执行它,它可以正常工作。

这样的话我是不是就不需要加上-m32选项了?

我们能否直接在 64 位系统上执行基于 32 位系统构建的程序,而不会产生任何副作用?或者是否需要任何更新或更改?

I am writing a program which if I compile on a Suse 10 32-bit system without adding the -m32 option and execute it on Suse 10 64-bit, it works fine.

In this case, is it not required for me to add the -m32 option?

Can we execute programs built on 32-bit systems directly on their 64-bit counterparts without any side-effects? Or are there any updates or changes required?

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

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

发布评论

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

评论(2

凉栀 2024-08-31 18:14:23

在 64 位操作系统上运行 32 位可执行文件没有问题(只要存在并找到 32 位动态库)。

-m32 用于在默认配置为编译 64 位对象的编译器上编译 32 位对象。

There is no problems in running 32 bits executables on 64 bit OS (as long as 32 bit dynamic libraries are present and found).

-m32 is there to compile 32 bits objects on a compiler configured to compile 64 bits objects by default.

小霸王臭丫头 2024-08-31 18:14:23

只要操作系统在 64 位操作系统上同时支持 32 位和 64 位程序(提示:并非所有程序都支持,例如 OpenBSD),那么只要您拥有它的所有 32 位依赖项,就不应该遇到任何问题。 。

As long as the OS supports both 32bit and 64bit programs (hint: not all do, such as OpenBSD) on a 64bit OS, then you shouldn't have any kind of problems as long as you have all of the 32bit dependencies for it..

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