Home » Language IDEs » C / C++ IDE (CDT) » How to create a makefile in Assembly in Eclipse CDT, without C file?('makefile' in gas (.S file) in CDT, without using C (.c file))
How to create a makefile in Assembly in Eclipse CDT, without C file? [message #1834532] |
Wed, 11 November 2020 18:51  |
Eclipse User |
|
|
|
Using Debian 10, x86-64 Architecture, and Eclipse CDT 2020-09.
Steps Followed:
(1) Create a Project
File > New > Project > C/C++ Project > C Project
Project name: HelloAsmMakefile
Project type: Makefile project > Empty Project, Linux GCC > Finish
(2) Create Source File
New > Source File Source File: hello.S
.text
.global main # must be declared for linker (ld)
.func main
main: # tells linker entry point
mov $len, %edx # message length
lea msg(%rip), %rsi # message to write (RIP relative addressing)
mov $1, %edi # file descriptor (stdout)
mov %edi, %eax # system call number (sys_write)
syscall
ret
.data
msg: .ascii "Hello, world!\n"
len = . - msg # length of the msg string
(3) Create a makefile
New > File > Filename: 'makefile' > Finish
Issue:
Most of the solutions are either using (1) C and AS files together, (2) 32-bit, (3) NASM, or (4) .asm file extension.
How do I create a makefile exclusively for gas (without C file), for CDT?
[Updated on: Wed, 11 November 2020 18:53] by Moderator
|
|
| | | | |
Re: How to create a makefile in Assembly in Eclipse CDT, without C file? [message #1835082 is a reply to message #1834532] |
Tue, 24 November 2020 08:05   |
Eclipse User |
|
|
|
luna grover wrote on Tue, 24 November 2020 03:21Most of the solutions are either using (1) C and AS files together, (2) 32-bit, (3) NASM, or (4) .asm file extension.
If you respond to my solutions:
(1) There is no C with embedded assembly,
(2) The solutions are for both 32 bit and 64 bit systems,
(3) There is no NASM, but GNU as instead,
(4) There is no .asm extension, but .S and .s
|
|
| |
Goto Forum:
Current Time: Thu Feb 27 20:49:34 EST 2025
Powered by FUDForum. Page generated in 0.03830 seconds
|