Re: hppa vDSO and compiler (non-)support

From: Helge Deller
Date: Tue Mar 08 2022 - 11:41:20 EST


* Helge Deller <deller@xxxxxx>:
> Hi Jiri,
>
> Thanks for testing on parisc!
>
> On 3/8/22 12:06, Jiri Slaby wrote:
> > since the "parisc: Add vDSO support" commit, I can no longer cross-build a hppa kernel. I see two issues:
> >
> > 1) CROSS32_COMPILE detection doesn't work here, as openSUSE provides hppa-suse-linux-* binaries. It's easy to overcome by "CROSS32_COMPILE=hppa-suse-linux-"
>
> How is it handled for other platforms like s390x?
> Would it make sense to add the detection for SUSE too?
>
> > 2) openSUSE doesn't provide any libc for hppa. So gcc doesn't provide libgcc.a and the build of vDSO fails.
>
> libgcc.a comes with the compiler, I don't think you need libc for that.
> I'm currently installing opensuse to try myself though...
>
> > So could vDSO be optional on hppa via KConfig?
> The vDSO is one of the first things which is built during kernel build process.
> This is why you fail.
> Making it optional doesn't make sense, because then the kernel wouldn't be able
> to start the user space processes.
>
> > I used to use the cross compiler to at least compile-check the following  tty drivers:
> > arch/parisc/kernel/pdc_cons.o
> > drivers/tty/serial/mux.o
> > drivers/tty/serial/8250/8250_gsc.o
>
> I assume you never built a full kernel, but stopped when building those modules?
> Without libgcc.a the kernel itself wouldn't have linked before either.

Below is a hackish patch which should allow you to build at least until
those modules. The make will still fail when linking the vmlinux file,
because libgcc.a provides the necessary low level symbols.

I'm currently not planning to include this patch, because it simply
doesn't make sense. Maybe you could nevertheless try/use it?
I'm open to any other ideas you may have.

IMHO, the only solution is, that libgcc.a gets included into the suse cross
compiler rpm package.

Helge


diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 2a9387a93592..3e62527db749 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -165,6 +165,7 @@ vmlinuz: bzImage
$(OBJCOPY) $(boot)/bzImage $@

ifeq ($(KBUILD_EXTMOD),)
+ifdef CONFIG_VDSO
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
# In order to do that, we should use the archprepare target, but we can't since
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
@@ -177,6 +178,7 @@ vdso_prepare: prepare0
$(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
endif
+endif

PHONY += vdso_install

diff --git a/arch/parisc/include/asm/vdso.h b/arch/parisc/include/asm/vdso.h
index ef8206193f82..d667cddd700d 100644
--- a/arch/parisc/include/asm/vdso.h
+++ b/arch/parisc/include/asm/vdso.h
@@ -2,6 +2,7 @@
#ifndef __PARISC_VDSO_H__
#define __PARISC_VDSO_H__

+#ifdef CONFIG_VDSO
#ifndef __ASSEMBLY__

#ifdef CONFIG_64BIT
@@ -15,6 +16,12 @@
extern struct vdso_data *vdso_data;

#endif /* __ASSEMBLY __ */
+#else /* CONFIG_VDSO */
+
+#define VDSO64_SYMBOL(tsk, name) (0)
+#define VDSO32_SYMBOL(tsk, name) (0)
+
+#endif /* CONFIG_VDSO */

/* Default link addresses for the vDSOs */
#define VDSO_LBASE 0
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index d579243edc2f..461dd4a85e99 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -41,6 +41,8 @@ obj-$(CONFIG_KEXEC_CORE) += kexec.o relocate_kernel.o
obj-$(CONFIG_KEXEC_FILE) += kexec_file.o

# vdso
+ifdef CONFIG_VDSO
obj-y += vdso.o
obj-$(CONFIG_64BIT) += vdso64/
obj-y += vdso32/
+endif