mbox series

[0/4] powerpc/64: ELFv2 conversion

Message ID 20230505071850.228734-1-npiggin@gmail.com (mailing list archive)
Headers show
Series powerpc/64: ELFv2 conversion | expand

Message

Nicholas Piggin May 5, 2023, 7:18 a.m. UTC
This series has the steps to remove ELFv1 from the kernel build.
Patch 1 is a build fix, 2 defaults everything to ELFv2, 3 is
really a separate issue that concerns userspace. 4 removes v1
support.

Would like to try getting patch 1 in as a fix, then 2,3 merged in
the next merge window.

Thanks,
Nick

Nicholas Piggin (4):
  powerpc/64: Force ELFv2 when building with LLVM linker
  powerpc/64: Make ELFv2 the default for big-endian builds
  powerpc/64s: Remove support for ELFv1 little endian userspace
  powerpc/64: Remove support for kernel's built with ELFv1 ABI

 arch/powerpc/Kconfig                     | 21 ------
 arch/powerpc/Makefile                    | 15 +----
 arch/powerpc/boot/Makefile               |  4 +-
 arch/powerpc/include/asm/code-patching.h | 36 ++--------
 arch/powerpc/include/asm/elf.h           |  6 ++
 arch/powerpc/include/asm/kfence.h        |  4 --
 arch/powerpc/include/asm/linkage.h       |  9 ---
 arch/powerpc/include/asm/module.h        |  3 -
 arch/powerpc/include/asm/ppc_asm.h       | 38 +----------
 arch/powerpc/include/asm/ptrace.h        | 17 +----
 arch/powerpc/include/asm/sections.h      |  4 --
 arch/powerpc/include/asm/thread_info.h   |  6 +-
 arch/powerpc/kernel/exceptions-64s.S     |  2 +-
 arch/powerpc/kernel/fadump.c             |  6 +-
 arch/powerpc/kernel/head_64.S            |  5 +-
 arch/powerpc/kernel/interrupt_64.S       |  4 --
 arch/powerpc/kernel/kprobes.c            | 39 +----------
 arch/powerpc/kernel/misc_64.S            |  4 --
 arch/powerpc/kernel/module.c             |  8 ---
 arch/powerpc/kernel/module_64.c          | 84 ++++--------------------
 arch/powerpc/kernel/trace/ftrace.c       | 10 ---
 arch/powerpc/kernel/vdso/Makefile        |  2 +-
 arch/powerpc/kernel/vdso/gettimeofday.S  |  2 +-
 arch/powerpc/kernel/vmlinux.lds.S        |  8 ---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S  | 36 +++++-----
 arch/powerpc/kvm/book3s_interrupts.S     | 14 ++--
 arch/powerpc/kvm/book3s_rmhandlers.S     | 12 +---
 arch/powerpc/net/bpf_jit.h               |  6 --
 arch/powerpc/net/bpf_jit_comp.c          | 14 ++--
 arch/powerpc/net/bpf_jit_comp64.c        | 13 ++--
 arch/powerpc/platforms/Kconfig.cputype   |  6 --
 drivers/crypto/vmx/Makefile              |  4 --
 kernel/extable.c                         |  2 +-
 kernel/trace/ftrace.c                    | 12 ----
 34 files changed, 79 insertions(+), 377 deletions(-)

Comments

Christophe Leroy May 5, 2023, 8:51 a.m. UTC | #1
Le 05/05/2023 à 09:18, Nicholas Piggin a écrit :
> This series has the steps to remove ELFv1 from the kernel build.
> Patch 1 is a build fix, 2 defaults everything to ELFv2, 3 is
> really a separate issue that concerns userspace. 4 removes v1
> support.

I see CONFIG_MPROFILE_KERNEL is restricted to LITTLE_ENDIAN. Is that 
correct ? Don't we have mprofile_kernel as well on BIG ENDIAN once 
switched to ABI v2 ? If so, can we drop the -pg based profiling 
completely, or is CLANG still not supporting mprofile_kernel ?

Christophe

> 
> Would like to try getting patch 1 in as a fix, then 2,3 merged in
> the next merge window.
> 
> Thanks,
> Nick
> 
> Nicholas Piggin (4):
>    powerpc/64: Force ELFv2 when building with LLVM linker
>    powerpc/64: Make ELFv2 the default for big-endian builds
>    powerpc/64s: Remove support for ELFv1 little endian userspace
>    powerpc/64: Remove support for kernel's built with ELFv1 ABI
> 
>   arch/powerpc/Kconfig                     | 21 ------
>   arch/powerpc/Makefile                    | 15 +----
>   arch/powerpc/boot/Makefile               |  4 +-
>   arch/powerpc/include/asm/code-patching.h | 36 ++--------
>   arch/powerpc/include/asm/elf.h           |  6 ++
>   arch/powerpc/include/asm/kfence.h        |  4 --
>   arch/powerpc/include/asm/linkage.h       |  9 ---
>   arch/powerpc/include/asm/module.h        |  3 -
>   arch/powerpc/include/asm/ppc_asm.h       | 38 +----------
>   arch/powerpc/include/asm/ptrace.h        | 17 +----
>   arch/powerpc/include/asm/sections.h      |  4 --
>   arch/powerpc/include/asm/thread_info.h   |  6 +-
>   arch/powerpc/kernel/exceptions-64s.S     |  2 +-
>   arch/powerpc/kernel/fadump.c             |  6 +-
>   arch/powerpc/kernel/head_64.S            |  5 +-
>   arch/powerpc/kernel/interrupt_64.S       |  4 --
>   arch/powerpc/kernel/kprobes.c            | 39 +----------
>   arch/powerpc/kernel/misc_64.S            |  4 --
>   arch/powerpc/kernel/module.c             |  8 ---
>   arch/powerpc/kernel/module_64.c          | 84 ++++--------------------
>   arch/powerpc/kernel/trace/ftrace.c       | 10 ---
>   arch/powerpc/kernel/vdso/Makefile        |  2 +-
>   arch/powerpc/kernel/vdso/gettimeofday.S  |  2 +-
>   arch/powerpc/kernel/vmlinux.lds.S        |  8 ---
>   arch/powerpc/kvm/book3s_hv_rmhandlers.S  | 36 +++++-----
>   arch/powerpc/kvm/book3s_interrupts.S     | 14 ++--
>   arch/powerpc/kvm/book3s_rmhandlers.S     | 12 +---
>   arch/powerpc/net/bpf_jit.h               |  6 --
>   arch/powerpc/net/bpf_jit_comp.c          | 14 ++--
>   arch/powerpc/net/bpf_jit_comp64.c        | 13 ++--
>   arch/powerpc/platforms/Kconfig.cputype   |  6 --
>   drivers/crypto/vmx/Makefile              |  4 --
>   kernel/extable.c                         |  2 +-
>   kernel/trace/ftrace.c                    | 12 ----
>   34 files changed, 79 insertions(+), 377 deletions(-)
>
Michael Ellerman May 5, 2023, 12:21 p.m. UTC | #2
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 05/05/2023 à 09:18, Nicholas Piggin a écrit :
>> This series has the steps to remove ELFv1 from the kernel build.
>> Patch 1 is a build fix, 2 defaults everything to ELFv2, 3 is
>> really a separate issue that concerns userspace. 4 removes v1
>> support.
>
> I see CONFIG_MPROFILE_KERNEL is restricted to LITTLE_ENDIAN. Is that 
> correct ? Don't we have mprofile_kernel as well on BIG ENDIAN once 
> switched to ABI v2 ? If so, can we drop the -pg based profiling 
> completely, or is CLANG still not supporting mprofile_kernel ?

Clang does not support -mprofile-kernel.

AIUI they would like us to switch to -fpatchable-function-entry which
could then be supported on GCC & clang.

That would be a nice cleanup but also a bunch of work that no one has
found time to do.

https://github.com/linuxppc/issues/issues/447
https://github.com/llvm/llvm-project/issues/57031


So for now we need to keep the -pg based version.

cheers
Naveen N. Rao May 5, 2023, 3:08 p.m. UTC | #3
Michael Ellerman wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Le 05/05/2023 à 09:18, Nicholas Piggin a écrit :
>>> This series has the steps to remove ELFv1 from the kernel build.
>>> Patch 1 is a build fix, 2 defaults everything to ELFv2, 3 is
>>> really a separate issue that concerns userspace. 4 removes v1
>>> support.

Super glad to see this!

>>
>> I see CONFIG_MPROFILE_KERNEL is restricted to LITTLE_ENDIAN. Is that 
>> correct ? Don't we have mprofile_kernel as well on BIG ENDIAN once 
>> switched to ABI v2 ? If so, can we drop the -pg based profiling 
>> completely, or is CLANG still not supporting mprofile_kernel ?
> 
> Clang does not support -mprofile-kernel.
> 
> AIUI they would like us to switch to -fpatchable-function-entry which
> could then be supported on GCC & clang.
> 
> That would be a nice cleanup but also a bunch of work that no one has
> found time to do.
> 
> https://github.com/linuxppc/issues/issues/447
> https://github.com/llvm/llvm-project/issues/57031

GCC's support for -fpatchable-function-entry needed fixes for ABIv2, 
which have landed in the recent v13.1 release. I am looking into adding 
support for that.

> 
> 
> So for now we need to keep the -pg based version.

Indeed, but removing elf v1 support does help cleaning up and 
simplifying some of the tracing code. Much of the -pg code is already 
separate, so it should be easy to drop that once clang picks up support 
for -fpatchable-function-entry.


- Naveen