码迷,mamicode.com
首页 > 系统相关 > 详细

asm play - clion ubuntu

时间:2020-12-30 10:27:07      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:sse   stack   txt   cmake   ble   pre   make   exe   minimum   

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: stackoverflow

asm play - clion ubuntu

标签:sse   stack   txt   cmake   ble   pre   make   exe   minimum   

原文地址:https://www.cnblogs.com/Searchor/p/14183612.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!