Skip to content

[RISCV] Clang-16 regressing build of inline assembly with Unsupported relocation type #61412

@kraj

Description

@kraj

The example below has worked fine with Clang 15 and also with Clang 16 branch of a week ago.

#define XREF_NOTE                                                              \
        ""                                                                 "\n"\
        "       .type _frr_xref_note,@object"                              "\n"\
        "       .pushsection .note.FRR,\"a\",@note"                        "\n"\
        "       .p2align 2"                                                "\n"\
        "_frr_xref_note:"                                                  "\n"\
        "       .long   9"                                                 "\n"\
        "       .long   16"                                                "\n"\
        "       .ascii  \"XREF\""                                          "\n"\
        "       .ascii  \"FRRouting\\0\\0\\0\""                            "\n"\
        "       .quad   __start_xref_array-."                              "\n"\
        "       .quad   __stop_xref_array-."                               "\n"\
        "       .size _frr_xref_note, .-_frr_xref_note"                    "\n"\
        "       .popsection"                                               "\n"\
        ""                                                                 "\n"\

void foo(void) {
  asm(XREF_NOTE);
}
$ clang -target riscv64-yoe-linux -mlittle-endian b.c -c
b.c:18:7: error: Unsupported relocation type
  asm(XREF_NOTE);
      ^
b.c:11:3: note: expanded from macro 'XREF_NOTE'
        "       .quad   __start_xref_array-."                              "\n"\
         ^
<inline asm>:10:8: note: instantiated into assembly here
        .quad   __start_xref_array-.
                ^
b.c:18:7: error: Unsupported relocation type
  asm(XREF_NOTE);
      ^
b.c:12:3: note: expanded from macro 'XREF_NOTE'
        "       .quad   __stop_xref_array-."                               "\n"\
         ^
<inline asm>:11:8: note: instantiated into assembly here
        .quad   __stop_xref_array-.
                ^
2 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions