linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 4/8] arm64: compat: Add a 32-bit vDSO
Date: Fri, 28 Oct 2016 11:09:26 +0800	[thread overview]
Message-ID: <20161028110926.0176e0ea@xhacker> (raw)
In-Reply-To: <20161027163058.12156-5-kevin.brodsky@arm.com>

Dear Kevin,

On Thu, 27 Oct 2016 17:30:54 +0100 Kevin Brodsky wrote:

> Provide the files necessary for building a compat (AArch32) vDSO in
> kernel/vdso32.
> 
> This is mostly an adaptation of the arm vDSO. The most significant
> change in vgettimeofday.c is the use of the arm64 vdso_data struct,
> allowing the vDSO data page to be shared between the 32 and 64-bit
> vDSOs.
> 
> In addition to the time functions, sigreturn trampolines are also
> provided, aiming at replacing those in the vector page. To improve
> debugging, CFI and unwinding directives are used, based on glibc's
> implementation. Symbol offsets are made available to the kernel using
> the same method as the 64-bit vDSO.
> 
> There is unfortunately an important caveat to all this: we cannot get
> away with hand-coding 32-bit instructions like in kernel/kuser32.S,
> this time we really need a 32-bit compiler. The compat vDSO Makefile
> relies on CROSS_COMPILE_ARM32 to provide a 32-bit compiler,
> appropriate logic will be added to the arm64 Makefile later on to
> ensure that an attempt to build the compat vDSO is made only if this
> variable has been set properly.
> 
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> ---
>  arch/arm64/kernel/vdso32/Makefile        | 121 +++++++++++++
>  arch/arm64/kernel/vdso32/sigreturn.S     |  86 +++++++++
>  arch/arm64/kernel/vdso32/vdso.S          |  32 ++++
>  arch/arm64/kernel/vdso32/vdso.lds.S      |  98 +++++++++++
>  arch/arm64/kernel/vdso32/vgettimeofday.c | 294 +++++++++++++++++++++++++++++++
>  5 files changed, 631 insertions(+)
>  create mode 100644 arch/arm64/kernel/vdso32/Makefile
>  create mode 100644 arch/arm64/kernel/vdso32/sigreturn.S
>  create mode 100644 arch/arm64/kernel/vdso32/vdso.S
>  create mode 100644 arch/arm64/kernel/vdso32/vdso.lds.S
>  create mode 100644 arch/arm64/kernel/vdso32/vgettimeofday.c
> 
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> new file mode 100644
> index 000000000000..38facc870f6e
> --- /dev/null
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -0,0 +1,121 @@
> +#
> +# Building a vDSO image for AArch32.
> +#
> +# Author: Kevin Brodsky <kevin.brodsky@arm.com>
> +# A mix between the arm64 and arm vDSO Makefiles.
> +
> +CC_ARM32 := $(CROSS_COMPILE_ARM32)gcc
> +
> +# Same as cc-ldoption, but using CC_ARM32 instead of CC
> +cc32-ldoption = $(call try-run,\
> +        $(CC_ARM32) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
> +
> +# Borrow vdsomunge.c from the arm vDSO
> +munge := arch/arm/vdso/vdsomunge
> +hostprogs-y := $(srctree)/$(munge)
> +
> +c-obj-vdso := vgettimeofday.o
> +asm-obj-vdso := sigreturn.o
> +
> +# Build rules
> +targets := $(c-obj-vdso) $(asm-obj-vdso) vdso.so vdso.so.dbg vdso.so.raw
> +c-obj-vdso := $(addprefix $(obj)/, $(c-obj-vdso))
> +asm-obj-vdso := $(addprefix $(obj)/, $(asm-obj-vdso))
> +obj-vdso := $(c-obj-vdso) $(asm-obj-vdso)
> +
> +ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
> +ccflags-y += -DDISABLE_BRANCH_PROFILING
> +
> +# Force -O2 to avoid libgcc dependencies
> +VDSO_CFLAGS := -march=armv8-a -O2

For completeness, bringing 32bit compiler need to check whether the 32bit
toolchain support some options. IIRC, armv8-a support isn't enabled until
gcc 4.8, so old toolchains such gcc-4.7 will complain:
 error: unrecognized argument in option ?-march=armv8-a?

Thanks,
Jisheng

  reply	other threads:[~2016-10-28  3:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 16:30 [RFC PATCH v2 0/8] arm64: Add a compat vDSO Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 1/8] arm64: Refactor vDSO setup Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 2/8] arm64: compat: Add time-related syscall numbers Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 3/8] arm64: compat: Expose offset to registers in sigframes Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 4/8] arm64: compat: Add a 32-bit vDSO Kevin Brodsky
2016-10-28  3:09   ` Jisheng Zhang [this message]
2016-10-28 10:20     ` Kevin Brodsky
2016-11-04 20:03       ` Catalin Marinas
2016-11-21 15:45         ` Kevin Brodsky
2016-11-21 18:44           ` Catalin Marinas
2016-12-01 14:27             ` Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 5/8] arm64: compat: 32-bit vDSO setup Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 6/8] arm64: elf: Set AT_SYSINFO_EHDR in compat processes Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 7/8] arm64: compat: Use vDSO sigreturn trampolines if available Kevin Brodsky
2016-10-27 16:30 ` [RFC PATCH v2 8/8] arm64: Wire up and expose the new compat vDSO Kevin Brodsky
2016-11-04 15:50   ` Catalin Marinas
2016-11-04 16:30     ` Kevin Brodsky
2016-11-04 16:47       ` Catalin Marinas
2016-11-04 17:53         ` Kevin Brodsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161028110926.0176e0ea@xhacker \
    --to=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).