开发者

Can gcc on Ubuntu on a 64-bit machine generate an executable where long is 32-bits?

开发者 https://www.devze.com 2022-12-13 04:57 出处:网络
In other words is compilation with data-开发者_开发知识库model LLP64 possible in this environment? Please note that my pointers should be 64-bit.Looks like it\'s possible (at least for AMD)

In other words is compilation with data-开发者_开发知识库model LLP64 possible in this environment? Please note that my pointers should be 64-bit.


Looks like it's possible (at least for AMD)

-m32
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture.


Yes, you can use the -m32

http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options

EDIT: I wrote this answer before he mentioned pointers in the question. See my other answer


I don't think this is possible on Linux. See wikipedia for details.

0

精彩评论

暂无评论...
验证码 换一张
取 消