Gentoo Archives: gentoo-user

From: Hans <linux@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Kernel upgrade from 4.1.12 to 4.4.6 hangs without writing logs.
Date: Mon, 09 May 2016 00:57:33
Message-Id: ngon99$b4r$1@ger.gmane.org
In Reply to: Re: [gentoo-user] Re: Kernel upgrade from 4.1.12 to 4.4.6 hangs without writing logs. by Michael Mol
1 On 02/05/16 22:59, Michael Mol wrote:
2 > On Saturday, April 30, 2016 01:32:54 AM Hans wrote:
3 >> On 30/04/16 00:28, Michael Mol wrote:
4 >>> On Friday, April 29, 2016 10:56:28 PM Hans wrote:
5 >>>> On 28/04/16 22:22, Hans wrote:
6 >>>> Kernel 4.4.6 as a bug. x11-drivers/xf86-video-virtualbox does not
7 >>>> compile.
8 >>>> Reason:
9 >>>> /usr/src/linux-4.4.6-gentoo/include/linux/string.h
10 >>>> 'char *strreplace(char *s, char old, char new);' causes compile failure.
11 >>>> "new" is a C++ keyword.
12 >>>> Changing tp 'char *strreplace(char *s, char oldstr, char newstr);' fixes
13 >>>> the problem.
14 >>>
15 >>> That's not a bug in the kernel per se, that's a bug in using that kernel
16 >>> header (written in C) in a compiler expecting C++ code. Which would make
17 >>> it a bug in xf86-video-virtualbox for not linking against a C-compiled
18 >>> object file.
19 >>>
20 >>> Granted, it'd be a heck of a lot more convenient if the kernel header
21 >>> files
22 >>> didn't use C++ keywords...but it *is* fundamentally a problem with
23 >>> compiling a source file using the wrong language. Like trying to read
24 >>> something in Portugese, except it was written in Spanish. It might work
25 >>> some of the time, but it'll catch you out eventually.
26 >>
27 >> The Virtualbox internal runtime compiler, assembler and gcc compiler to
28 >> build executables such as app-emulation/virtualbox-guest-additions, etc.
29 >> use some of the kernel sources and headers.
30 >
31 > Assuming those components are using this string.h header file, that just means
32 > that those components are correctly treating treating these header files as C
33 > header files, and not C++ header files.
34 >
35 >>
36 >> Kernel 4.1.12 string.h and earlier did not have this silly problem.
37 >
38 > That just means that Kernel 4.1.12 string.h and earlier weren't exposing a bug
39 > in xf86-video-virtualbox.
40 >
41 > The Linux kernel is written in C with a smattering of platform-specific
42 > assembler, and some other used languages at build time. The header files for
43 > Linux are written in C. It's built with a C compiler. It's expected to be
44 > consumed by things expecting to be consuming C.
45 >
46 > xf86-video-virtualbox is trying to build C code in a C++ environment, and
47 > that's not guaranteed to work. In fact, it's semantically broken, as C isn't
48 > simply a subset of C++, nor is C++ simply a superset of C. They're two
49 > distinct languages that can be made to work reliably together if you pay
50 > attention, and the VirtualBox developers...didn't. Linux promises a stable ABI
51 > for existing API calls, but the symbol name for an *argument* of an API call
52 > isn't part of the ABI; functions' arguments' names aren't preserved at compile
53 > time. Similarly, adding new API calls doesn't disrupt existing API calls or
54 > the ABI, so adding a new API call with an argument named 'new' doesn't violate
55 > that ABI promise.
56 >
57 > Now, an argument can be made that the kernel developers working in C shouldn't
58 > use C++ keywords, but that's a dangerous slippery slope; there are a *lot* of
59 > languages out there that are superficially syntactically (and even
60 > semantically) similar to C, but *aren't*. What makes C++ special enough that
61 > the kernel should respect it, but not every other language? No...userland is
62 > built around the kernel, not the other way around--that's what makes it the
63 > kernel. The kernel has a fairly well-defined set of rules in that it's written
64 > in a supremely common standardized language, and there exist good practices
65 > for interfacing code written in that language with code written in other
66 > languages.
67 >
68 > I get that it's frustrating. Just trying to help you understand what's going
69 > on a a lower level, and why.
70 >
71
72 Just checked Kernel-4.1.12 string.h.
73 The function declaration 'char *strreplace(char *s, char old, char
74 new);' does not exist at all.
75
76 The style of functions declarations used is
77 'char * strcpy(char *,const char *);'
78 except for 'char *strreplace(char *s, char old, char new);'