[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=-TeLJn9=V_Dmj-X+qcRBcfH8tcktbm33xAx671VCYUw@mail.gmail.com>
Date: Fri, 16 Mar 2018 16:52:08 +0000
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: marc.zyngier@....com
Cc: Andrey Konovalov <andreyknvl@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>,
christoffer.dall@...aro.org,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
LKML <linux-kernel@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>,
kernel-dynamic-tools <kernel-dynamic-tools@...gle.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
takahiro.akashi@...aro.org
Subject: Re: arm64 kvm built with clang doesn't boot
+ Sami (Google), Takahiro (Linaro)
Just so I fully understand the problem enough to articulate it, we'd be
looking for the compiler to keep the jump tables for speed (I would guess
-fno-jump-tables would emit an if-else chain) but only emit relative jumps
(not absolute jumps)?
> Perhaps Nick can comment on whether something like
-fno-absolute-addressing would be feasible in clang.
Checked with some of my LLVM friends. They mentioned that this is tricky
because you need to move the addresses of the jump table from a data
section back into the text section.
Looks like LLVM has an interesting method
`shouldPutJumpTableInFunctionSection` [0]. Unfortunately, it gets
overridden for ELF to always return false. [1]
It looks like there's also a flag `no-jump-tables` [2]. Looks like Sami
has used this in the past in kvm. [3]
It's still probably possible to add this to LLVM, so I can pursue that with
LLVM devs.
> But just for the reference, I'm using 4.16-rc4 with a patch to fix SMCCC
issues that you mentioned.
Is this in regards to: commit "arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP
hardening support"? Has anyone tried to upstream a fix for this? We
probably want to be very explicit with register widths here.
[0]
https://github.com/llvm-mirror/llvm/blob/a5bd54307b1adacb3df297b9b8010979b9afa4d7/lib/Target/TargetLoweringObjectFile.cpp#L280
[1]
https://github.com/llvm-mirror/llvm/blob/e7676fec11b02e4b698b5ffc99e1901246a7bf66/lib/CodeGen/TargetLoweringObjectFileImpl.cpp#L494
[2]
https://github.com/llvm-mirror/llvm/blob/11f5adb29bf90bc1a40b8bb512afcff4b1ac0f56/lib/Transforms/Utils/SimplifyCFG.cpp#L5233
[3] https://patchwork.kernel.org/patch/10060301/
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists