From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Joel Stanley <joel@jms.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [v2] powerpc/32: Avoid unsupported flags with clang
Date: Sat, 22 Dec 2018 20:55:04 +1100 (AEDT) [thread overview]
Message-ID: <43MLT46d40z9sPj@ozlabs.org> (raw)
In-Reply-To: <20181112052806.18939-1-joel@jms.id.au>
On Mon, 2018-11-12 at 05:28:06 UTC, Joel Stanley wrote:
> When building for ppc32 with clang these flags are unsupported:
>
> -ffixed-r2 and -mmultiple
>
> llvm's lib/Target/PowerPC/PPCRegisterInfo.cpp marks r2 as reserved on
> when building for SVR4ABI and !ppc64:
>
> // The SVR4 ABI reserves r2 and r13
> if (Subtarget.isSVR4ABI()) {
> // We only reserve r2 if we need to use the TOC pointer. If we have no
> // explicit uses of the TOC pointer (meaning we're a leaf function with
> // no constant-pool loads, etc.) and we have no potential uses inside an
> // inline asm block, then we can treat r2 has an ordinary callee-saved
> // register.
> const PPCFunctionInfo *FuncInfo = MF.getInfo<PPCFunctionInfo>();
> if (!TM.isPPC64() || FuncInfo->usesTOCBasePtr() || MF.hasInlineAsm())
> markSuperRegs(Reserved, PPC::R2); // System-reserved register
> markSuperRegs(Reserved, PPC::R13); // Small Data Area pointer register
> }
>
> This means we can safely omit -ffixed-r2 when building for 32-bit
> targets.
>
> The -mmultiple/-mno-multiple flags are not supported by clang, so
> platforms that might support multiple miss out on using multiple word
> instructions.
>
> We wrap these flags in cc-option so that when Clang gains support the
> kernel will be able use these flags.
>
> Clang 8 can then build a ppc44x_defconfig which boots in Qemu:
>
> make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- ppc44x_defconfig
> ./scripts/config -e CONFIG_DEVTMPFS -d DEVTMPFS_MOUNT
> make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
>
> qemu-system-ppc -M bamboo \
> -kernel arch/powerpc/boot/zImage \
> -dtb arch/powerpc/boot/dts/bamboo.dtb \
> -initrd ~/ppc32-440-rootfs.cpio \
> -nographic -serial stdio -monitor pty -append "console=ttyS0"
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/261
> Link: https://bugs.llvm.org/show_bug.cgi?id=39556
> Link: https://bugs.llvm.org/show_bug.cgi?id=39555
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/72e7bcc2cdf82bf03caaa5e6c9b013
cheers
prev parent reply other threads:[~2018-12-22 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 5:28 [PATCH v2] powerpc/32: Avoid unsupported flags with clang Joel Stanley
2018-11-12 18:59 ` Nick Desaulniers
2018-12-22 9:55 ` Michael Ellerman [this message]
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=43MLT46d40z9sPj@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=joel@jms.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ndesaulniers@google.com \
/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).