Re: [PATCH linux-next] tools: compiler-gcc.h: Keep compatible with older GCC versions

From: xu xin
Date: Thu Jan 06 2022 - 01:25:14 EST


> GNU C 5.1

> This applies to both HOSTCC and CC.

> > Undefined __has_attribute as we built the whole kernel and tools.
> >
> > To solve this, this patch is given to keep the compatibility with older
> > GCC versions.

Yes, but I think this error is a little unfriendly to users using a
lower version of host GCC when cross compiling.

Perhaps "#if gcc_version > = 51000" could be added to avoid the error
'Undefined __has_attribute'

or we can add `#error "hostcc don't support _has_attribute` to remind
the user of the cause of the error.

Or just use my previous patch.

I hope we can do something here to promote the situation as Nathan talked
before:

https://lore.kernel.org/all/91B93D4D-BEC8-4ACD-B71F-27C54D8B1B78@xxxxxxxxxx/