Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 791364 - >=sys-kernel/gentoo-sources-5.12.5: '__always_inline' cause build error on musl libc
Summary: >=sys-kernel/gentoo-sources-5.12.5: '__always_inline' cause build error on mu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://www.mail-archive.com/linux-ke...
Whiteboard:
Keywords: PATCH
: 799266 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-05-21 18:08 UTC by Moran Z.
Modified: 2021-07-27 20:19 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
a 3-liner musl libc compatibility patch [1/3] : include/uapi/linux/perf_event.h (linux-5_12-musl-part1.patch,242 bytes, patch)
2021-05-21 18:11 UTC, Moran Z.
Details | Diff
a 3-liner musl libc compatibility patch [2/3] : tools/include/uapi/linux/perf_event.h (linux-5_12-musl-part2.patch,254 bytes, patch)
2021-05-21 18:11 UTC, Moran Z.
Details | Diff
a 3-liner musl libc compatibility patch [3/3] : tools/objtool/arch/x86/decode.c (linux-5_12-musl-part3.patch,293 bytes, patch)
2021-05-21 18:12 UTC, Moran Z.
Details | Diff
uapi/linux/swab.h patch for musl (file_791364.txt,302 bytes, patch)
2021-05-23 01:51 UTC, Michael 'veremitz' Everitt
Details | Diff
patch (fix-swab.patch,641 bytes, patch)
2021-07-08 22:57 UTC, Marco Scardovi (scardracs)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Moran Z. 2021-05-21 18:08:00 UTC
Hi There :)

I've Stumbled Upon This Issue While Trying To Upgrade a 'musl-libc' Based System, From 'sys-kernel/gentoo-sources-5.11.22' To 'sys-kernel/gentoo-sources-5.12.5'.

Some Folks at 'Samsung' Seem To Have Stumbled Upon That Issue Too & They've Found/Proposed a Simple - 3-Liner - Fix on LKML, by 10/12/2020.

Reproducible: Always

Steps to Reproduce:
1. Do a Plain 'emerge -av =sys-kernel/gentoo-sources-5.12.5' .

Actual Results:  
/usr/src/linux # make modules_prepare
<...>
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/arch/x86/decode.o
In file included from /usr/include/linux/byteorder/little_endian.h:13,
                 from /usr/include/asm/byteorder.h:5,
                 from /usr/src/linux-5.12.5-gentoo/tools/arch/x86/include/asm/insn.h:10,
                 from arch/x86/decode.c:10:
/usr/include/linux/swab.h:136:23: error: expected ';' before 'unsigned'
  136 | static __always_inline unsigned long __swab(const unsigned long y)
      |                       ^~~~~~~~~
      |                       ;
/usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
  171 | static __always_inline __u16 __swab16p(const __u16 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/swab.h:171:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__swab16p'
  171 | static __always_inline __u16 __swab16p(const __u16 *p)
      |                              ^~~~~~~~~
/usr/include/linux/swab.h:184:8: error: unknown type name '__always_inline'
  184 | static __always_inline __u32 __swab32p(const __u32 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/swab.h:184:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__swab32p'
  184 | static __always_inline __u32 __swab32p(const __u32 *p)
      |                              ^~~~~~~~~
/usr/include/linux/swab.h:197:8: error: unknown type name '__always_inline'
  197 | static __always_inline __u64 __swab64p(const __u64 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/swab.h:197:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__swab64p'
  197 | static __always_inline __u64 __swab64p(const __u64 *p)
      |                              ^~~~~~~~~
/usr/include/linux/swab.h:252:23: error: expected ';' before 'void'
  252 | static __always_inline void __swab32s(__u32 *p)
      |                       ^~~~~
      |                       ;
/usr/include/linux/swab.h:265:23: error: expected ';' before 'void'
  265 | static __always_inline void __swab64s(__u64 *p)
      |                       ^~~~~
      |                       ;
In file included from /usr/include/asm/byteorder.h:5,
                 from /usr/src/linux-5.12.5-gentoo/tools/arch/x86/include/asm/insn.h:10,
                 from arch/x86/decode.c:10:
/usr/include/linux/byteorder/little_endian.h:44:8: error: unknown type name '__always_inline'
   44 | static __always_inline __le64 __cpu_to_le64p(const __u64 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:44:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_le64p'
   44 | static __always_inline __le64 __cpu_to_le64p(const __u64 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:48:8: error: unknown type name '__always_inline'
   48 | static __always_inline __u64 __le64_to_cpup(const __le64 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:48:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__le64_to_cpup'
   48 | static __always_inline __u64 __le64_to_cpup(const __le64 *p)
      |                              ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:52:8: error: unknown type name '__always_inline'
   52 | static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:52:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_le32p'
   52 | static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:56:8: error: unknown type name '__always_inline'
   56 | static __always_inline __u32 __le32_to_cpup(const __le32 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:56:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__le32_to_cpup'
   56 | static __always_inline __u32 __le32_to_cpup(const __le32 *p)
      |                              ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:60:8: error: unknown type name '__always_inline'
   60 | static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:60:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_le16p'
   60 | static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:64:8: error: unknown type name '__always_inline'
   64 | static __always_inline __u16 __le16_to_cpup(const __le16 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:64:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__le16_to_cpup'
   64 | static __always_inline __u16 __le16_to_cpup(const __le16 *p)
      |                              ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:68:8: error: unknown type name '__always_inline'
   68 | static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:68:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_be64p'
   68 | static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:72:8: error: unknown type name '__always_inline'
   72 | static __always_inline __u64 __be64_to_cpup(const __be64 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:72:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__be64_to_cpup'
   72 | static __always_inline __u64 __be64_to_cpup(const __be64 *p)
      |                              ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:76:8: error: unknown type name '__always_inline'
   76 | static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:76:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_be32p'
   76 | static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:80:8: error: unknown type name '__always_inline'
   80 | static __always_inline __u32 __be32_to_cpup(const __be32 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:80:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__be32_to_cpup'
   80 | static __always_inline __u32 __be32_to_cpup(const __be32 *p)
      |                              ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:84:8: error: unknown type name '__always_inline'
   84 | static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:84:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__cpu_to_be16p'
   84 | static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
      |                               ^~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:88:8: error: unknown type name '__always_inline'
   88 | static __always_inline __u16 __be16_to_cpup(const __be16 *p)
      |        ^~~~~~~~~~~~~~~
/usr/include/linux/byteorder/little_endian.h:88:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__be16_to_cpup'
   88 | static __always_inline __u16 __be16_to_cpup(const __be16 *p)
      |                              ^~~~~~~~~~~~~~
make[4]: *** [/usr/src/linux-5.12.5-gentoo/tools/build/Makefile.build:97: /usr/src/linux-5.12.5-gentoo/tools/objtool/arch/x86/decode.o] Error 1
make[3]: *** [/usr/src/linux-5.12.5-gentoo/tools/build/Makefile.build:139: arch/x86] Error 2
make[2]: *** [Makefile:56: /usr/src/linux-5.12.5-gentoo/tools/objtool/objtool-in.o] Error 2
make[1]: *** [Makefile:69: objtool] Error 2
make: *** [Makefile:1978: tools/objtool] Error 2


Expected Results:  
/usr/src/linux # make modules_prepare
<...>
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/arch/x86/decode.o
  LD       /usr/src/linux-5.12.5-gentoo/tools/objtool/arch/x86/objtool-in.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/weak.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/check.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/special.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/orc_gen.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/orc_dump.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/builtin-check.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/builtin-orc.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/elf.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/objtool.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/libstring.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/libctype.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/str_error_r.o
  CC       /usr/src/linux-5.12.5-gentoo/tools/objtool/librbtree.o
  LD       /usr/src/linux-5.12.5-gentoo/tools/objtool/objtool-in.o
  LINK     /usr/src/linux-5.12.5-gentoo/tools/objtool/objtool
  LDS     scripts/module.lds
Comment 1 Moran Z. 2021-05-21 18:11:11 UTC
Created attachment 710115 [details, diff]
a 3-liner musl libc compatibility patch [1/3] : include/uapi/linux/perf_event.h
Comment 2 Moran Z. 2021-05-21 18:11:57 UTC
Created attachment 710118 [details, diff]
a 3-liner musl libc compatibility patch [2/3] : tools/include/uapi/linux/perf_event.h
Comment 3 Moran Z. 2021-05-21 18:12:43 UTC
Created attachment 710121 [details, diff]
a 3-liner musl libc compatibility patch [3/3] : tools/objtool/arch/x86/decode.c
Comment 4 John Helmert III gentoo-dev Security 2021-05-23 01:33:50 UTC
Please don't randomly CC arches.
Comment 5 Michael 'veremitz' Everitt 2021-05-23 01:51:10 UTC
Created attachment 710361 [details, diff]
uapi/linux/swab.h patch for musl

What version of sys-kernel/linux-headers are you using?

I found the patch below worked for me when using sys-kernel/linux-headers-5.4 but may need updating for newer versions.

I will have a look-see as to what source I was using for this, but I suspect there were a few likely candidates. From memory something came up on the lkml iirc ..
Comment 6 Moran Z. 2021-05-23 07:25:03 UTC
@John Helmert III: An Honest Mistake, Pardon ! :)

@Michael 'veremitz' Everitt:

IMHO, Too, a Systemic Fix Is Better

& Here's The Relevant 'emerge --info' Output:

Portage 3.0.18 (python 3.9.5-final-0, default/linux/amd64/17.0/musl/hardened, gcc-10.3.0, musl-1.2.2-r2, 5.12.5-gentoo x86_64)
=================================================================
System uname: Linux-5.12.5-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-2673_v3_@_2.40GHz-with-libc
KiB Mem:    32752544 total,  29382148 free
KiB Swap:   33554428 total,  33554428 free
Timestamp of repository gentoo: Sun, 23 May 2021 07:00:01 +0000
Head commit of repository gentoo: f36dece66c6d47b46206aa7863a1dc7c8fd571e0
sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p3) 2.36.1
app-shells/bash:          5.1_p8::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          2.7.18_p7::gentoo, 3.8.10_p1::gentoo, 3.9.5_p1::gentoo
dev-lang/rust:            1.47.0-r1::smaeul
dev-util/cmake:           3.20.2::gentoo
sys-apps/baselayout:      2.7-r2::gentoo
sys-apps/openrc:          0.43.3::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.35.2::gentoo, 2.36.1-r1::gentoo
sys-devel/gcc:            9.3.0-r2::gentoo, 10.3.0::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.12::gentoo (virtual/os-headers)
sys-libs/musl:            1.2.2-r2::gentoo

+

eselect binutils list
 [1] x86_64-gentoo-linux-musl-2.35.2
 [2] x86_64-gentoo-linux-musl-2.36.1 *

---
Comment 7 Marco Scardovi (scardracs) 2021-07-08 22:57:08 UTC
Created attachment 722854 [details, diff]
patch

I've tried the patch on this bug but didn't work. @Anarchy provided to me a new one that I can confirm to work in kernel 5.12 and 5.13
Comment 8 Larry the Git Cow gentoo-dev 2021-07-08 23:08:36 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/musl.git/commit/?id=e9a03616c762b689a02860e17347eb484d14addf

commit e9a03616c762b689a02860e17347eb484d14addf
Author:     Jory Pratt <anarchy@gentoo.org>
AuthorDate: 2021-07-08 23:08:30 +0000
Commit:     Jory Pratt <anarchy@gentoo.org>
CommitDate: 2021-07-08 23:08:30 +0000

    sys-kernel/linux-headers: Fix headers for newer kernels with musl
    
    Closes: https://bugs.gentoo.org/791364
    Package-Manager: Portage-3.0.20, Repoman-3.0.2
    Signed-off-by: Jory Pratt <anarchy@gentoo.org>

 sys-kernel/linux-headers/Manifest                  |  2 +
 .../0001-Use-stddefs.h-instead-of-compiler.h.patch | 25 +++++++++++
 .../linux-headers/linux-headers-5.10-r1.ebuild     | 48 ++++++++++++++++++++++
 sys-kernel/linux-headers/metadata.xml              | 11 +++++
 4 files changed, 86 insertions(+)
Comment 9 ernsteiswuerfel archtester 2021-07-27 20:19:08 UTC
*** Bug 799266 has been marked as a duplicate of this bug. ***