Re: [PATCH 1/4] arm64: vdso32: Introduce COMPAT_CC_IS_GCC

From: Vincenzo Frascino
Date: Thu Sep 26 2019 - 08:20:17 EST


On 9/26/19 11:56 AM, Vincenzo Frascino wrote:
> On 9/26/19 9:06 AM, Catalin Marinas wrote:
>> On Thu, Sep 26, 2019 at 07:03:50AM +0100, Vincenzo Frascino wrote:
>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>> index 37c610963eee..afe8c948b493 100644
>>> --- a/arch/arm64/Kconfig
>>> +++ b/arch/arm64/Kconfig
>>> @@ -110,7 +110,7 @@ config ARM64
>>> select GENERIC_STRNLEN_USER
>>> select GENERIC_TIME_VSYSCALL
>>> select GENERIC_GETTIMEOFDAY
>>> - select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT)
>>> + select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT && COMPAT_CC_IS_GCC)
>>> select HANDLE_DOMAIN_IRQ
>>> select HARDIRQS_SW_RESEND
>>> select HAVE_PCI
>>> @@ -313,6 +313,9 @@ config KASAN_SHADOW_OFFSET
>>> default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
>>> default 0xffffffffffffffff
>>>
>>> +config COMPAT_CC_IS_GCC
>>> + def_bool $(success,$(CROSS_COMPILE_COMPAT)gcc --version | head -n 1 | grep -q arm)
>>
>> Nitpick: I prefer COMPATCC instead of COMPAT_CC for consistency with
>> HOSTCC.
>>
>
> Ok, will change this in v2.
>
>> Now, could we not generate a COMPATCC in the Makefile and use
>> $(COMPATCC) here instead of $(CROSS_COMPILE_COMPAT)gcc? It really
>> doesn't make sense to check that gcc is gcc.
>>
>
> All right, COMPATCC is already in the makefile, I will use it in here.
>

What you are proposing seems not possible because Kconfig runs first and then
the arch Makefile, hence compatcc does not take effect on the Kconfig. I will
post v2 with what I proposed, please feel free to comment if you have a better idea.

arch/arm64/configs/defconfig:726:warning: symbol value 'm' invalid for
REMOTEPROC
#

# configuration written to .config

#

make[1]: Leaving directory '/data1/Projects/LinuxKernel/linux-out'

make[1]: Entering directory '/data1/Projects/LinuxKernel/linux-out'

$COMPATCC is [arm-linux-gnueabihf-gcc]

GEN Makefile

>> A next step would be to check that COMPATCC can actually generate 32-bit
>> objects. But it's not essential at this stage.
>>
>
> We are already checking this making sure that arm is present in the triple (grep
> -q arm).
>
>>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>>> index 84a3d502c5a5..34f53eb11878 100644
>>> --- a/arch/arm64/Makefile
>>> +++ b/arch/arm64/Makefile
>>> @@ -54,19 +54,8 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
>>> endif
>>>
>>> ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
>>> - CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
>>> -
>>> - ifeq ($(CONFIG_CC_IS_CLANG), y)
>>> - $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
>>> - else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
>>> - $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
>>> - else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
>>> - $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
>>> - else
>>> - export CROSS_COMPILE_COMPAT
>>> - export CONFIG_COMPAT_VDSO := y
>>> - compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>> - endif
>>> + export CONFIG_COMPAT_VDSO := y
>>> + compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>> endif
>>
>> Has CONFIG_CROSS_COMPILE_COMPAT_VDSO actually been removed from
>> lib/vdso/Kconfig? (I haven't checked the subsequent patches).
>>
>

--
Regards,
Vincenzo