[RFC PATCH] i386: Do not emit segment overrides for %p and %P [PR100936]

Uros Bizjak ubizjak@gmail.com
Wed Jun 9 07:47:29 GMT 2021


On Tue, Jun 8, 2021 at 5:46 PM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> Using %p to move the address of a symbol using LEA:
>
>   asm ("lea %p1, %0" : "=r"(addr) : "m"(var));
>
> emits assembler warning when VAR is declared in a non-generic address space:
>
>   Warning: segment override on `lea' is ineffectual
>
> The problem is with %p operand modifier, which should emit raw symbol name:
>
>   p -- print raw symbol name.
>
> Similar problem exists with %P modifier, trying to CALL or JMP to an
> overridden symbol,e.g:
>
>         call %gs:zzz
>         jmp %gs:zzz
>
> emits assembler warning:
>
>   Warning: skipping prefixes on `call'
>   Warning: skipping prefixes on `jmp'
>
> Ensure that %p and %P never emit segment overrides.
>
> 2021-06-08  Uroš Bizjak  <ubizjak@gmail.com>
>
> gcc/
>     PR target/100936
>     * config/i386/i386.c (print_operand_address_as): Rename "no_rip"
>     argument to "raw".  Do not emit segment overrides when "raw" is true.
>
> gcc/testsuite/
>
>     PR target/100936
>     * gcc.target/i386/pr100936.c: New test.
>
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Now pushed to master.

Uros.


More information about the Gcc-patches mailing list