This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Retpolines and CFI
- From: Jeff Law <law at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, Florian Weimer <fweimer at redhat dot com>
- Cc: "gcc at gnu dot org" <gcc at gnu dot org>
- Date: Thu, 25 Jan 2018 09:30:52 -0700
- Subject: Re: Retpolines and CFI
- Authentication-results: sourceware.org; auth=none
- References: <8d6faaaf-fd14-a5ad-71ca-6f6f98d0d214@redhat.com> <CAMe9rOrDXxq+S0WK4FPSOBODKav7WkOZpGX8zOkX9=RXt1DJTg@mail.gmail.com>
On 01/25/2018 06:38 AM, H.J. Lu wrote:
> On Mon, Jan 22, 2018 at 4:21 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> I tried this:
>>
>> struct C {
>> virtual ~C();
>> virtual void f();
>> };
>>
>> void
>> f (C *p)
>> {
>> p->f();
>> p->f();
>> }
>>
>> with r256939 and -mindirect-branch=thunk -O2 on x86-64 GNU/Linux, and got
>> this:
>>
>> _Z1fP1C:
>> .LFB0:
>> .cfi_startproc
>> pushq %rbx
>> .cfi_def_cfa_offset 16
>> .cfi_offset 3, -16
>> movq (%rdi), %rax
>> movq %rdi, %rbx
>> jmp .LIND1
>> .LIND0:
>> pushq 16(%rax)
>> jmp __x86_indirect_thunk
>> .LIND1:
>> call .LIND0
>> movq (%rbx), %rax
>> movq %rbx, %rdi
>> popq %rbx
>> .cfi_def_cfa_offset 8
>> movq 16(%rax), %rax
>> jmp __x86_indirect_thunk_rax
>> .cfi_endproc
>>
>> This doesn't look quite right. x86-64 is supposed to have asynchronous
>> unwind tables by default, but there is nothing that reflects the change in
>> the (relative) frame address after .LIND0. I think that region really has
>> to be moved outside of the .cfi_startproc/.cfi_endproc bracket.
>
> I'd like to remove __x86_indirect_thunk since it can't be made compatible
> with CET:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83970
User code should be built with CET, not retpolines. So I don't see
that removing x86_indirect_thunk is that important because we won't be
using them together.
jeff