flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Assembly with clang:

Thread Post new topic Reply to topic

Joined: 21 Jul 2003
Posts: 3977
Location: vpcmipstrm
bitRAKE 30 Apr 2021, 23:11
So far I've found it very buggy - even for simple things:
.intel_syntax noprefix
.globl WinMainCRTStartup
        pop rax

        xor ecx,ecx
        lea rdx,[rip + _message]
        lea r8,[rip + _caption]
        mov r9,rcx
        call MessageBoxW

        xchg ecx,eax
        call ExitProcess

.macro wchars name:req foo:vararg
        .align 2,0
        \name :
        .irpc bar,"\foo"
        .ifnc \bar\bar,""
                .ascii "\bar"
                .byte 0
        .else # without this else cc1as generates incorrect output
                .print "\\bar"
        .byte 0,0

wchars _caption Win64 assembly program
wchars _message Hello World!

# commands for the linker
.section .drectve,"yn"
.ascii  " /DEFAULTLIB:kernel32.lib"
.ascii  " /DEFAULTLIB:user32.lib"    
Build with...
clang -cc1as -triple x86_64-pc-windows-msvc19.28.29910 -filetype obj -o thisfile.obj thisfile.s
lld-link -out:thisfile.exe thisfile.obj    
I'm kind of leery about trying anything more challenging. There doesn't appear to be a directive to output wide chars, or any UTF-8 support of any kind. All strings must be escapable ASCII - otherwise they are interpreted as symbols.

¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 30 Apr 2021, 23:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.