tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: aarch64 gcc kernel compilation



>Gcc is now working on aarch64 but the kernel does not compile because of
>some idiomatic clang code that is not supported by gcc (at least gcc-6)
>
>To define constants, it uses:
>
>static const uintmax_t
>FOO = __BIT(9),
>BAR = FOO;
>
>While this is nice, specially for the debugger, it produces an error
>in gcc. While fixing these is easy, gcc also complains about using the
>constants as switch labels. Thus it is better to just nukem all and
>rewrite them as:
>
>#define FOO __BIT(9)
>#define BAR FOO
>
>Should I go ahead and do it, or there is a smarter solution?

Yes, please!
I tested with below script in my environment (clang), there seems to be no problem.


perl -i.old a64armreg_conv.pl aarch64/include/armreg.h

# a64armreg_conv.pl
while (<>) {
	if (m#^static\s+(const\s*)?uintmax_t\s*(//.*)?$#) {
	} elsif (m#^\s*(\w+)\s*=\s*(.*?)[,;]\s*//(.*)$#) {
		print "#define $1	$2	//$3\n";
	} elsif (m#^\s*(\w+)\s*=\s*(.*?)[,;]\s*$#) {
		print "#define $1	$2\n";
	} else {
		print;
	}
}

-- 
ryo shimizu


Home | Main Index | Thread Index | Old Index