Re: "arm64: vdso: Substitute gettimeofday() with C implementation" breaks clang build

From: Vincenzo Frascino
Date: Tue Jun 25 2019 - 10:30:41 EST


Hi Qian,

On 25/06/2019 15:28, Qian Cai wrote:
> On Tue, 2019-06-25 at 15:11 +0100, Vincenzo Frascino wrote:
>> Hi Qian,
>>
>> On 25/06/2019 14:51, Qian Cai wrote:
>>> On Tue, 2019-06-25 at 14:40 +0100, Vincenzo Frascino wrote:
>>>> On 25/06/2019 13:56, Qian Cai wrote:
>>>>> On Tue, 2019-06-25 at 13:47 +0100, Vincenzo Frascino wrote:
>>>>>> Hi Qian,
>>>>>>
>>>>>> On 25/06/2019 13:16, Qian Cai wrote:
>>>>>>> The linux-next commit "arm64: vdso: Substitute gettimeofday() with C
>>>>>>> implementation" [1] breaks clang build.
>>>>>>>
>>>>>>> error: invalid value 'tiny' in '-mcode-model tiny'
>>>>>>> make[1]: *** [scripts/Makefile.build:279:
>>>>>>> arch/arm64/kernel/vdso/vgettimeofday.o] Error 1
>>>>>>> make[1]: *** Waiting for unfinished jobs....
>>>>>>> make: *** [arch/arm64/Makefile:180: vdso_prepare] Error 2
>>>>>>>
>>>>>>> [1] https://patchwork.kernel.org/patch/11009663/
>>>>>>>
>>>>>>
>>>>>> I am not sure what does exactly break from your report. Could you
>>>>>> please
>>>>>> provide
>>>>>> more details?
>>>>>
>>>>> Here is the config to reproduce.
>>>>>
>>>>> https://raw.githubusercontent.com/cailca/linux-mm/master/arm64.config
>>>>>
>>>>> # make CC=clang -j $(nr_cpus)
>>>>>
>>>>> I can get it working again by removing "-mcmodel=tiny" in
>>>>> arch/arm64/kernel/vdso/Makefile
>>>>>
>>>>
>>>> With your defconfig I can't still reproduce the problem. Which version of
>>>> clang
>>>> are you using?
>>>
>>> Compiler: clang version 7.0.1 (tags/RELEASE_701/final)
>>>
>>
>> I am using clang 8.0.0. Could you please try with it and see if the issue goes
>> away?
>
> Looks like the "tiny" was added since clang 8.0.
>
> https://reviews.llvm.org/D49674
>
> but clang 7.0 is still use in many distros by default, so maybe this commit can
> be fixed by adding a conditional check to use "small" if clang version < 8.0.
>

It is what I thought that's why I asked to cross-check. I did not want to remove
tiny.

Thanks for your support, I will post a patch adding your tag as reported-by if
you are ok with that.

>>
>> Thanks,
>> Vincenzo
>>
>>>>
>>>>>>
>>>>>> On my env:
>>>>>>
>>>>>> $ make mrproper && make defconfig && make CC=clang HOSTCC=clang
>>>>>> -j$(nproc)
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> arch/arm64/Makefile:56: CROSS_COMPILE_COMPAT is clang, the compat vDSO
>>>>>> will
>>>>>> not
>>>>>> be built
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> Â LDSÂÂÂÂÂarch/arm64/kernel/vdso/vdso.lds
>>>>>> Â ASÂÂÂÂÂÂarch/arm64/kernel/vdso/note.o
>>>>>> Â ASÂÂÂÂÂÂarch/arm64/kernel/vdso/sigreturn.o
>>>>>> Â CCÂÂÂÂÂÂarch/arm64/kernel/vdso/vgettimeofday.o
>>>>>> Â LDÂÂÂÂÂÂarch/arm64/kernel/vdso/vdso.so.dbg
>>>>>> Â VDSOCHK arch/arm64/kernel/vdso/vdso.so.dbg
>>>>>> Â VDSOSYM include/generated/vdso-offsets.h
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> Â LDÂÂÂÂÂÂvmlinux.o
>>>>>> Â MODPOST vmlinux.o
>>>>>> Â MODINFO modules.builtin.modinfo
>>>>>> Â KSYMÂÂÂÂ.tmp_kallsyms1.o
>>>>>> Â KSYMÂÂÂÂ.tmp_kallsyms2.o
>>>>>> Â LDÂÂÂÂÂÂvmlinux
>>>>>> Â SORTEXÂÂvmlinux
>>>>>> Â SYSMAPÂÂSystem.map
>>>>>> Â Building modules, stage 2.
>>>>>> Â OBJCOPY arch/arm64/boot/Image
>>>>>> Â MODPOST 483 modules
>>>>>>
>>>>
>>>>
>>
>>

--
Regards,
Vincenzo