lkml.org 
[lkml]   [2023]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [BUG Report] undefined reference to `convert_to_fxsr'
    On Tue, Jan 03, 2023 at 11:05:01AM +0800, Miaohe Lin wrote:
    > Yes, it still reproduces in my working server. It might be the problem of gcc
    > version.

    What is that compiler you're using? Where did you get the package from? Does it
    have some out-of-tree patches in it?

    > I think it's because convert_to_fxsr() is only defined when CONFIG_X86_32 or
    > CONFIG_IA32_EMULATION is enabled.

    No, convert_to_fxsr() is part of arch/x86/kernel/fpu/regset.c which is built-in
    unconditionally.

    What happens is this here:

    bool fpu__restore_sig(void __user *buf, int ia32_frame)

    ...

    } else {
    success = __fpu_restore_sig(buf, buf_fx, ia32_fxstate);
    }

    That ia32_fxstate is false because

    ia32_frame &= (IS_ENABLED(CONFIG_X86_32) ||
    IS_ENABLED(CONFIG_IA32_EMULATION));


    neither of those config items are set...

    /*
    * Only FXSR enabled systems need the FX state quirk.
    * FRSTOR does not need it and can use the fast path.
    */
    if (ia32_frame && use_fxsr()) {
    buf_fx = buf + sizeof(struct fregs_state);
    size += sizeof(struct fregs_state);
    ia32_fxstate = true;
    ^^^^^^^^^^^^^^^^^^^

    ... so this doesn't happen.

    }

    Then, in __fpu_restore_sig() you have:

    if (likely(!ia32_fxstate)) {
    /* Restore the FPU registers directly from user memory. */
    return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only,
    state_size);
    }

    and since ia32_fxstate is false, we return here, the compiler sees that
    everything behind that code is dead code and eliminates it.

    Your compiler doesn't, apparently.

    It does remove it from regset.c, though, as it sees it is an unused function,
    which leads to this undefined reference.

    So it looks like a funky compiler to me...

    --
    Regards/Gruss,
    Boris.

    https://people.kernel.org/tglx/notes-about-netiquette

    \
     
     \ /
      Last update: 2023-03-26 23:29    [W:2.651 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site