How can I get Dev-C++ to generate intel assembly from c code? - c

I understand that compilers convert c source code to assembly and then to machine code. I searched through every compiler setting I could find, and their website but I can't get it to generate assembly. Also, the website states that Dev-C++ uses AT&T assembly, can I also convert from that to Intel?

Dev-C++ seems to use GCC.
You can try this option: gcc -S -masm=intel as answered in this question: How do you use gcc to generate assembly code in Intel syntax?
I do not know how to set command line options on Dev-C++ but guides can be easily found.

C:\Program Files (x86)\Dev-Cpp\MinGW32\bin>gcc -S -masm=intel try.cpp
Type this in command prompt(location of gcc depends on where you have install dev-C++),it will generate assembly file,in my case try.s

Related

Converting C source to ARM assembly

I am trying to convert .c files for ARM (ARMv7l for Raspberry Pi2) but I could not find any online converter or understand how it works. Previously these .c files were executable in Windows platform and thus unable to execute on Pi's arm architecture. Does anybody can assist me in this?
Any c compiler can generate assembly code from C code, if your objective is specifically to generate assembly code for arm then you'll need a cross compiler such as the GNU arm embedded toolchain.
For gcc on particular you just need to use the -S option when compiling, so the line looks something like:
gcc -S -source.c -o output.s
Of course you'll need to include any headers and include directories for it to compile.
if you simply want to cross compile it, then simply do the full compilation assemblage and linking process. Depending on how low level the c code is it's actually possible for it not to work on the pi 2 (but it will compile)

Set Up Compiler for C for Sublime Text 3

I just started to learn C programming at University. Unfortunately I need a specific compiler in order to meet their requirements.
My C Compiler needs to compile with following settings:
gcc -Wall -o2
Can anyone help me by programming a compiler for me, or tell my what to do?
Thank you for you help
Greetings
Alex
You can install gcc in cygwin:
http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/
Edit your code in Sublime Text 3 and compile it with gcc
Well I don't know what OS or hardware you are using but gcc can be installed on all Linux systems, and OSX has clang which is compatible with gcc, and calling gcc on OSX simply invokes clang because it's hard linked. If you are on Windows install cygwin.
Please see this answer on how to compile and link C programs in sublime rather than using a shell.

Compile a C program gives "can't find compiler executable in your search path (GNU GCC compiler)" in Codeblocks

I have installed codeblocks in windows 7 first time and try to run a simple C program but I get this error?
can't find compiler executable in your search path (GNU GCC compiler)
I tried many things to solve it but unable to compile.
Have you installed the Mingw compiler or any other simiar compiler? If not install that first. After you have done so, you need to set codeblocks to use that compiler. You can do that by going to the settings>compiler settings and set the necessary options there. You may need to refer the place where you have installed Mingw or other compiler. Note the compiler executable is gcc for C and g++ for C++ and the linker is ld i guess. Debugger is gdb. You need to tell codeblocks where are these located.
I also received that error. I fixed it using Settings -> Compiler -> Global compiler settings -> Toolchain executables -> Auto detect.

How to Self-Host Clang?

Can anyone tell me how to compile the Clang compiler into LLVM bytecode (that is, self-host Clang)? The reason I want to do this is so that I can take the resulting LLVM bytecode and then use Emscripten to produce a C to Javascript compiler.
You can get clang to output into LLVM bytecode by using the -emit-llvm command-line flag, along with the -c flag. (If you use the -S flag instead of -c, you get a textual representation of the LLVM bytecode.) You don't need to compile clang into LLVM bytecode for that to work.
If you want to try to run clang itself inside a browser, then you will need to compile all of clang into LLVM bytecode, and then link the object files together using llvm-link. Then you'll need to figure out how to give the compiled compiler access to the system header files it needs. I don't know if there is a build option for all that, but I haven't ever seen anything in the ./configure options for that, so I suspect not. But it's possible that it exists.

How do I use a buildtool with clang?

I'm starting out with Linux programming, and I don't want to learn the gcc.
What buildtools can I use to compile large nested source directories with ease with clang? And cross platform? Cmake looks nice, but there is no mention of how to specify a different compiler.
edit: I'd like to use it with vim.
To use clang with cmake, you simply set the CC variable:
CC=clang cmake ...
There's also CXX for the C++ compiler, ie CXX=clang++.
CC/CXX are standard variables and should work with any build system.

Resources