Bug 217013 - 4.14.304 regression: error building with arch/x86/kernel/fpu/init.c due to missing _Alignof support in GCC < 4.7
Summary: 4.14.304 regression: error building with arch/x86/kernel/fpu/init.c due to mi...
Status: NEW
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: x86-64 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: gregkh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-08 10:24 UTC by it
Modified: 2023-02-10 08:12 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.14.304
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments

Description it 2023-02-08 10:24:07 UTC
Kernel 4.14.304 and newer can not be built.
I get the following error while compiling:

arch/x86/kernel/fpu/init.c: In function 'fpu__init_task_struct_size':
arch/x86/kernel/fpu/init.c:177: error: implicit declaration of function '_Alignof'
arch/x86/kernel/fpu/init.c:177: error: expected expression before 'struct'
arch/x86/kernel/fpu/init.c:177: error: expected expression before 'struct'
arch/x86/kernel/fpu/init.c:178: error: expected expression before 'struct'
arch/x86/kernel/fpu/init.c:178: error: expected expression before 'struct'
arch/x86/kernel/fpu/init.c:179: error: expected expression before 'struct'
arch/x86/kernel/fpu/init.c:179: error: expected expression before 'struct'

Kernel 4.14.303 is compiling/running without errors - so it must be this commit:

commit 67c6d79777cf5d3165d6d2e2d7c5e37333d1a76e
Author: YingChi Long <me@inclyc.cn>
Date:   Fri Nov 18 08:55:35 2022 +0800

    x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN
Comment 1 Borislav Petkov 2023-02-08 10:42:01 UTC
Does it build fine if you revert this commit ontop?

What toolchain are you using to build?
Comment 2 it 2023-02-08 11:08:40 UTC
It builds fine without this commit, yes.
I'm using standard (debian) tools for compiling (make) - but older versions because the OS is not up2date (and can not be updated).
Comment 3 Borislav Petkov 2023-02-08 11:49:47 UTC
What does

gcc --version

say?
Comment 4 it 2023-02-08 12:13:41 UTC
gcc (Debian 4.4.5-8) 4.4.5
Comment 5 Borislav Petkov 2023-02-08 12:59:15 UTC
Looks like _Alignof came with gcc 4.7: https://gcc.gnu.org/gcc-4.7/changes.html

According to Documentation/Changes, min gcc version for building 4.14 is 3.2 so I guess this patch needs to be reverted from stable.

Assigning to Greg.
Comment 6 Greg Kroah-Hartman 2023-02-08 14:16:09 UTC
Ick, yeah, that's not good.

Using old compilers usually isn't a good idea, but for this one we should probably revert it.  Can you send email to stable@vger.kernel.org and we can take it from there.
Comment 7 Greg Kroah-Hartman 2023-02-08 14:17:30 UTC
If this showed up in 4.7, we'll need to also handle this for 4.19 if someone complains as the "minimum" gcc for that is 4.6 right now.

Note You need to log in before you can comment on or make changes to this bug.