Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the differences between -m32, -m64, and nothing in gcc's options?

gcc -m32 main.cpp

gcc -m64 main.cpp

gcc main.cpp

What's the differences between -m32, -m64, and nothing in gcc's options?

like image 788
xmllmx Avatar asked Nov 15 '16 14:11

xmllmx


People also ask

What is difference between G ++ and GCC?

DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.

What is fPIC option in GCC?

fPIC option in GCC enables the address of shared libraries to be relative so that the executable is independent of the position of libraries. This enables one to share built library which has dependencies on other shared libraries. fPIC stands for "force Position Independent Code".

What is G ++ used for?

g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file.

What is no pie?

-no-pie. Don't produce a dynamically linked position independent executable. -static-pie. Produce a static position independent executable on targets that support it. A static position independent executable is similar to a static executable, but can be loaded at any address without a dynamic linker.


1 Answers

Refer to gcc Manual Page [here], it indicates

-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. 
For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options. 
like image 86
Sean83 Avatar answered Nov 17 '22 02:11

Sean83