Skip to content

Clang as an x64 assembler - Masm x64 #99

Open
@UnlimitedChild

Description

@UnlimitedChild

Hello,

why Clang does not support the basic directive - "offset". This topic has been discussed many times
https://lists.llvm.org/pipermail/llvm-bugs/2017-April/054674.html
https://reviews.llvm.org/D37461
https://stackoverflow.com/questions/43223287/why-does-this-simple-assembly-program-work-in-att-syntax-but-not-intel-syntax
https://bugs.llvm.org/show_bug.cgi?id=22511

In general, Сlang does not support many assembler properties, for example, the ability to represent numbers is limited. Should we expect more complete support for assembler dialects in the future?

We can’t live without the offset directive ..

// 
// RUN: clang -mllvm --x86-asm-syntax=intel -c hello.asm
// RUN: clang hello.o -o hello.exe

//.intel_syntax
.intel_syntax noprefix

.data
#define Data_ADDR offset .ascii
Key:
    .ascii "Hello, world!\n"
    .set mylen, .-Key

.text
.global start
foo:
mov r15 , 555  
MOV r14 , 555
MOV r13 , 555  
MOV r12 , 555 
MOV r11 , 555 
MOV r10 , 555 
MOV r9 , 555 
MOV r8 , 555 
MOV rbp , 555  
MOV rax , 555 
MOV rdi , 555 
MOV rsi , 555  
MOV rdx , 555 
MOV rcx , 6555  
MOV rbx , 555  
MOV rax , 555  
nop
nop
nop
MOV rax , foo
MOV rax , [foo]
lea rax , foo
lea rax , [foo]
nop
MOV rax , .ascii
MOV rax , [.ascii]
lea rax , .ascii
lea rax , [.ascii]
nop
MOV rax , offset Key
mov rax , Data_ADDR

// MOV rax , offset foo
// MOV rax , offset [foo]
// lea rax , offset foo
// lea rax , offset [foo]
// MOV rax , addr foo
// MOV rax , addr [foo]
// lea rax , addr foo
// lea rax , addr [foo]

Thanks for the work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions