powerpc/vdso32: Drop -mabi=elfv1 for 32 bit objects

Message ID 20190110014258.20963-1-joel@jms.id.au
State New
Headers show
Series
  • powerpc/vdso32: Drop -mabi=elfv1 for 32 bit objects
Related show

Checks

Context Check Description
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
snowpatch_ozlabs/build-pmac32 success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64e success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64be success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64le success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied

Commit Message

Joel Stanley Jan. 10, 2019, 1:42 a.m.
From: Daniel Axtens <dja@axtens.net>

All 64-bit objects need to specify the flag to be compiled correctly, we
just don't need it for 32-bit objects. GCC just ignored it, but clang
doesn't.

Link: https://github.com/ClangBuiltLinux/linux/issues/240
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/kernel/vdso32/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

christophe leroy Jan. 10, 2019, 7:10 a.m. | #1
Le 10/01/2019 à 02:42, Joel Stanley a écrit :
> From: Daniel Axtens <dja@axtens.net>
> 
> All 64-bit objects need to specify the flag to be compiled correctly, we
> just don't need it for 32-bit objects. GCC just ignored it, but clang
> doesn't.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/240
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>   arch/powerpc/kernel/vdso32/Makefile | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
> index 50112d4473bb..6bd41756e0c7 100644
> --- a/arch/powerpc/kernel/vdso32/Makefile
> +++ b/arch/powerpc/kernel/vdso32/Makefile
> @@ -34,6 +34,20 @@ obj-y += vdso32_wrapper.o
>   extra-y += vdso32.lds
>   CPPFLAGS_vdso32.lds += -P -C -Upowerpc
>   
> +# clang refuses to accept -mabi=elfv1 for when using the
> +# 64-bit target in 32-bit mode
> +ifdef CONFIG_CC_IS_CLANG

If -mabi=elfv1 is unneeded even for GCC, why depend on CLANG ?

> +ifdef CONFIG_PPC64
> +AFLAGS_REMOVE_getcpu.o += -mabi=elfv1
> +endif

Why only this one is inside the ifdef ? powerpc Makefile only set 
-mabi=elfv1 when CONFIG_PPC64 is set, so all objects should be handled 
the same way.

And would it harm just doing it all the time, regardless of CONFIG_PPC64 ?

Christophe

> +AFLAGS_REMOVE_sigtramp.o += -mabi=elfv1
> +AFLAGS_REMOVE_gettimeofday.o += -mabi=elfv1
> +AFLAGS_REMOVE_datapage.o += -mabi=elfv1
> +AFLAGS_REMOVE_cacheflush.o += -mabi=elfv1
> +AFLAGS_REMOVE_note.o += -mabi=elfv1
> +endif
> +
> +
>   # Force dependency (incbin is bad)
>   $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
>   
>
Daniel Axtens Jan. 10, 2019, 2:45 p.m. | #2
Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Le 10/01/2019 à 02:42, Joel Stanley a écrit :
>> From: Daniel Axtens <dja@axtens.net>
>> 
>> All 64-bit objects need to specify the flag to be compiled correctly, we
>> just don't need it for 32-bit objects. GCC just ignored it, but clang
>> doesn't.
>> 
>> Link: https://github.com/ClangBuiltLinux/linux/issues/240
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>> ---
>>   arch/powerpc/kernel/vdso32/Makefile | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>> 
>> diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
>> index 50112d4473bb..6bd41756e0c7 100644
>> --- a/arch/powerpc/kernel/vdso32/Makefile
>> +++ b/arch/powerpc/kernel/vdso32/Makefile
>> @@ -34,6 +34,20 @@ obj-y += vdso32_wrapper.o
>>   extra-y += vdso32.lds
>>   CPPFLAGS_vdso32.lds += -P -C -Upowerpc
>>   
>> +# clang refuses to accept -mabi=elfv1 for when using the
>> +# 64-bit target in 32-bit mode
>> +ifdef CONFIG_CC_IS_CLANG
>
> If -mabi=elfv1 is unneeded even for GCC, why depend on CLANG ?
>
>> +ifdef CONFIG_PPC64
>> +AFLAGS_REMOVE_getcpu.o += -mabi=elfv1
>> +endif
>
> Why only this one is inside the ifdef ? powerpc Makefile only set 
> -mabi=elfv1 when CONFIG_PPC64 is set, so all objects should be handled 
> the same way.
>
> And would it harm just doing it all the time, regardless of CONFIG_PPC64 ?

I designed the patch to mirror some code earlier on, and to be
conservative in what it did. I have no issue with it being restructured,
but I probably won't have the time to do it for a month or so. I'm very
happy for you or Joel to rework it and to test any resulting patches.

Regards,
Daniel

>
> Christophe
>
>> +AFLAGS_REMOVE_sigtramp.o += -mabi=elfv1
>> +AFLAGS_REMOVE_gettimeofday.o += -mabi=elfv1
>> +AFLAGS_REMOVE_datapage.o += -mabi=elfv1
>> +AFLAGS_REMOVE_cacheflush.o += -mabi=elfv1
>> +AFLAGS_REMOVE_note.o += -mabi=elfv1
>> +endif
>> +
>> +
>>   # Force dependency (incbin is bad)
>>   $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
>>   
>>
Segher Boessenkool Jan. 10, 2019, 3:28 p.m. | #3
On Thu, Jan 10, 2019 at 08:10:43AM +0100, Christophe Leroy wrote:
> Le 10/01/2019 à 02:42, Joel Stanley a écrit :
> >From: Daniel Axtens <dja@axtens.net>
> >
> >All 64-bit objects need to specify the flag to be compiled correctly, we
> >just don't need it for 32-bit objects. GCC just ignored it, but clang
> >doesn't.

> >+# clang refuses to accept -mabi=elfv1 for when using the
> >+# 64-bit target in 32-bit mode
> >+ifdef CONFIG_CC_IS_CLANG
> 
> If -mabi=elfv1 is unneeded even for GCC, why depend on CLANG ?

It is nonsensical to specify this flag when compiling -m32.  Apparently
clang uses -mabi= to set the current ABI, which isn't quite correct
(although of course the name suggests that's what it does ;-) )

'-mabi=ABI-TYPE'
     Extend the current ABI with a particular extension, or remove such
     extension.  Valid values are 'altivec', 'no-altivec',
     'ibmlongdouble', 'ieeelongdouble', 'elfv1', 'elfv2'.

(It is harmless to use it with -m32 on GCC, because the option just sets a
flag, internally).

> >+ifdef CONFIG_PPC64
> >+AFLAGS_REMOVE_getcpu.o += -mabi=elfv1
> >+endif

Don't remove it, just never set it where not needed?


Segher

Patch

diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 50112d4473bb..6bd41756e0c7 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -34,6 +34,20 @@  obj-y += vdso32_wrapper.o
 extra-y += vdso32.lds
 CPPFLAGS_vdso32.lds += -P -C -Upowerpc
 
+# clang refuses to accept -mabi=elfv1 for when using the
+# 64-bit target in 32-bit mode
+ifdef CONFIG_CC_IS_CLANG
+ifdef CONFIG_PPC64
+AFLAGS_REMOVE_getcpu.o += -mabi=elfv1
+endif
+AFLAGS_REMOVE_sigtramp.o += -mabi=elfv1
+AFLAGS_REMOVE_gettimeofday.o += -mabi=elfv1
+AFLAGS_REMOVE_datapage.o += -mabi=elfv1
+AFLAGS_REMOVE_cacheflush.o += -mabi=elfv1
+AFLAGS_REMOVE_note.o += -mabi=elfv1
+endif
+
+
 # Force dependency (incbin is bad)
 $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so