Skip to content

Using reserved keywords as label names break LLVM based back end #40

@dvanhorn

Description

@dvanhorn

The old nasm printer used $ to preface label names so that reserved words could serve as label names without breaking things, e.g.

        default rel
        section .text
        global $entry
$entry:
        mov rax, 42
$rax:
        sub rax, 1
        cmp rax, 0
        jne $rax
        ret

But the move to clang/LLVM dropped this feature which means you get:

        .intel_syntax noprefix
        .text
        .global entry
entry:
        mov rax, 42
rax:
        sub rax, 1
        cmp rax, 0
        jne rax
        ret

and jne rax is not a valid instruction. There is a failing test case in the repo that catches this regression.

(Note that this test won't fail on Macs because the _ prefix that gets inserted saves it from being a malformed instruction.)

The clang assembler let's you use double quotes for label names, so the example could be jne "rax".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions