lkml.org 
[lkml]   [2019]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v6 02/27] x86: Use symbol name in jump table for PIE support
On Thu, Feb 7, 2019 at 4:17 AM Borislav Petkov <bp@alien8.de> wrote:
>
> On Thu, Jan 31, 2019 at 11:24:09AM -0800, Thomas Garnier wrote:
> > Replace the %c constraint with %P. The %c is incompatible with PIE
> > because it implies an immediate value whereas %P reference a symbol.
>
> How so?
>
> AFAIK, %c requires a constant operand and if %P is used to print a
> constant, it simply drops syntax-specific prefixes and does a bare
> constant.
>
> I guess that here
>
> https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers
>
> is not entirely correct as it should not say "If used for a constant"
> for %P but say "symbol or constant".
>
> But before/after asm doesn't show any difference. So what gives?

I assume that's an optimisation done by gcc later. The P modifier in
the documentation does state that it is used to generate PIC code.

>
> before:
> # 39 "./arch/x86/include/asm/jump_label.h" 1
> 1:
> .byte 0xe9
> .long .L241 - 2f #
> 2:
> .pushsection __jump_table, "aw"
> .balign 8
> .long 1b - ., .L241 - . #
> .quad __use_tsc + 1 - . #,
> .popsection
>
> after:
> # 39 "./arch/x86/include/asm/jump_label.h" 1
> 1:
> .byte 0xe9
> .long .L241 - 2f #
> 2:
> .pushsection __jump_table, "aw"
> .balign 8
> .long 1b - ., .L241 - . #
> .quad __use_tsc+1 - . #
> .popsection
>
> --
> Regards/Gruss,
> Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.

\
 
 \ /
  Last update: 2019-02-07 18:05    [W:0.151 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site