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

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Thomas Garnier from comment #16)
> Yes, I think you can't just default to the non-PIE mode.
> 
> Clang does it well though:
> 
> 0000000000000000 <phy_modes>:
>    0:   83 ff 16                cmp    $0x16,%edi
>    3:   77 0f                   ja     14 <phy_modes+0x14>
>    5:   48 63 c7                movslq %edi,%rax
>    8:   48 8d 0d 00 00 00 00    lea    0x0(%rip),%rcx        # f
> <phy_modes+0xf>
>                         b: R_X86_64_PC32        .data.rel.ro-0x4
>    f:   48 8b 04 c1             mov    (%rcx,%rax,8),%rax
>   13:   c3                      retq   
>   14:   48 8d 05 00 00 00 00    lea    0x0(%rip),%rax        # 1b
> <phy_modes+0x1b>
>                         17: R_X86_64_PC32       .L.str.23-0x4
>   1b:   c3                      retq

Please open a separate bug report to improve switch codegen for PIC.

Reply via email to