Skip to content

x86: inline asm: make %a compatible with gcc #139001

@hpax

Description

@hpax

On x86, the %a assembly modifier behaves differently between gcc and clang:

When used with an "i" input operand, on gcc it produces a %rip-relative address reference when compiling for 64 bits, whereas on clang, it does not.

The gcc people have stated that that is the preferred way to get a memory reference with (%rip) on x86-64 and a plain memory reference on i386, without having to put explicit hacks in the assembly code. This would be useful for cleaning up code in the Linux kernel.

The gcc documentation is, as usual, weak on the exact semantics of its inline assembly, but see the following gcc bugzilla:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102266

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions