asm play - clion ubuntu

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(Test)
enable_language(ASM_NASM)

set(CMAKE_C_STANDARD 99)

set(ASM_SOURCES
     test.asm
)

set (SOURCES
     main.c 
     ${ASM_SOURCES}
)

set_source_files_properties(${ASM_SOURCES} PROPERTIES LANGUAGE ASM_NASM)

add_executable(program  ${SOURCES})

main.c

#include <stdio.h>

extern long test(long);

int main()
{
    printf("%ld", test(5));
    printf("Hello, World!\n");
    return 0;
}

test.asm

section text

global test

test:
    mov rax, 111
    ret

ref: *

asm play - clion ubuntu

上一篇:Linux 程序安装目录 /opt 和 /usr/local 的区别


下一篇:由kill 和 kill -9 引发的Linux signal 学习