New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 705732 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 690756



Sign in to add a comment

Clang: aarch64: -mgeneral-regs-only inconsistent with gcc

Project Member Reported by mka@chromium.org, Mar 27 2017

Issue description

"The AArch64 backend runs into a fatal error with the -mgeneral-regs-only when inline assembly refers to a SIMD register."

https://bugs.llvm.org//show_bug.cgi?id=30792

This affects the CrOS kernel build with clang. As a workaround -mno-implicit-float can be used instead of -mgeneral-regs-only.

There is a possible fix, however there hasn't been much activity lately:

https://reviews.llvm.org/D26856

Please check with the LLVM devs on the status to get more clarity on the decision of whether to use the workaround or wait for a fix in clang.
 
ok, will check with ARM on this. 
is the workaround -mno-implicit-float ok for you?
If they are not planning to implement -mgeneral-regs-only, It will be hard to get priority on this if you don't really need it.

Comment 2 by mka@chromium.org, Mar 28 2017

Yes, I think the workaround is acceptable if a timely fix with reasonable effort in clang is unlikely.
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7cd12d58b84042724fb696ba4980884cbad30e31

commit 7cd12d58b84042724fb696ba4980884cbad30e31
Author: wangxianzhu <wangxianzhu@chromium.org>
Date: Fri Mar 31 20:54:41 2017

Fix GraphicsLayerUpdater::UpdateContext::compositingContainer() for corner cases

For the following corner cases:
- parent layer is not a LayoutBlock (in case the layer or an ancestor
  LayoutObject is a floating object under the parent layer),
- the current layer is a column spanner,
the current layer's compositingContainer may escape the normal layer hierarchy.
Fallback to slow path in the cases.

Also cleanup PaintLayer::containingLayer(), and added tests.

BUG= 705732 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2787203002
Cr-Commit-Position: refs/heads/master@{#461221}

[modify] https://crrev.com/7cd12d58b84042724fb696ba4980884cbad30e31/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp
[modify] https://crrev.com/7cd12d58b84042724fb696ba4980884cbad30e31/third_party/WebKit/Source/core/paint/PaintLayer.cpp
[modify] https://crrev.com/7cd12d58b84042724fb696ba4980884cbad30e31/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp

Sorry, I put a wrong bug number in my CL.

Comment 5 by mka@chromium.org, Apr 14 2017

llozano@: Is there an update on whether clang devs plans to implement '-mgeneral-regs-only'? Also knowing that they don't have plans would be helpful, in that case it seems reasonable to try to push the workaround upstream.

Comment 6 by mka@chromium.org, Apr 24 2017

Any update on this? Could somebody please check with the clang devs on possible plans for '-mgeneral-regs-only'? It's also helpful to know if there are no such plans.
Sent a msg on the bug. Will follow up directly with ARM folks if there is no response.
So far there is no plan for supporting -mgeneral-regs-only.

Reply from Silviu from ARM:
----
Comment # 9 on  bug 30792  from Silviu Baranga
Hi Manoj,

The solution at D26856 was the wrong one, we need to reject FP uses in
front-end (so probably D26856 could be abandoned).

I don't have any plans to implement this at the moment.

However, we should have a work-around with -mno-implicit-float (as long as the
code doesn't use any floating point types).

Thanks,
Silviu

Comment 9 by mka@chromium.org, Apr 26 2017

Thanks for following up, Manoj.

It should be ok to use -mno-implicit-float in our tree, however I'm reluctant to push it upstream since this is a workaround for a bug in clang and the maintainer reaction to that tends to be "fix your compiler!".

This is one of the very few bits missing for basic clang support for ARM64 in the upstream kernel, so it would be really great to get this fixed. Apparently the correct fix is to have the front-end reject FP uses, is this something our toolchain team could implement with a reasonable effort?
Cc: g...@chromium.org

Comment 11 by g...@chromium.org, May 1 2017

Cc: llozano@chromium.org
Owner: g...@chromium.org
yeah, it looks like we can make this work with some effort. i'm slightly concerned about potential backwards-compatibility issues if we change -mgeneral-regs-only to disallow floats completely, but i assume that'll be easy to fix if anyone actually cares. (since i think "horribly unsupported" was used to describe what we do with floats, i doubt anyone does)

it won't be at the top of my to-do list, but i'll see if i can chip away at this in the coming weeks. if we need something faster than that, please let me know.

Comment 12 by mka@chromium.org, May 1 2017

Thanks for picking this up gbiv@!

The timeframe sounds good, we can use -mno-implicit-float in our local tree in the meantime.

Comment 13 by mka@chromium.org, May 31 2017

Labels: -Restrict-View-Google
Project Member

Comment 14 by bugdroid1@chromium.org, Jul 18 2017

Labels: merge-merged-chromeos-4.4
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2873e0dab1ba9bbec6bbaa999f23e07cb0e9a3fa

commit 2873e0dab1ba9bbec6bbaa999f23e07cb0e9a3fa
Author: Greg Hackmann <ghackmann@google.com>
Date: Tue Jul 18 07:32:37 2017

HACK: arm64: use -mno-implicit-float instead of -mgeneral-regs-only

https://bugs.llvm.org/show_bug.cgi?id=30792 causes clang's AArch64
backend to crash compiling arch/arm64/crypto/aes-ce-cipher.c. Replacing
-mgeneral-regs-only with -mno-implicit-float is the suggested
workaround.

Drop this patch once the clang bug has been fixed.

BUG=chromium:702741,  chromium:705732 
TEST=build and boot on kevin

Change-Id: I229c5e9cb7306391afcc1819604662db54216a99
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/528532
Reviewed-by: Guenter Roeck <groeck@chromium.org>

[modify] https://crrev.com/2873e0dab1ba9bbec6bbaa999f23e07cb0e9a3fa/arch/arm64/Makefile

Comment 15 by mka@chromium.org, Jul 27 2017

Labels: -Pri-3 Pri-2
gbiv@, did you get a chance to start looking into this?

Comment 16 by g...@chromium.org, Jul 27 2017

Yeah, I have a patch in progress that I've been working on bit by bit. If this is becoming more pressing, I'll bump it higher on my to-do list. :)

Comment 17 by mka@chromium.org, Jul 27 2017

Great to know there is progress!

It's not really pressing because we have a workaround. Yet since it's the last (known) clang issue that prevents to build an upstream arm64 kernel it would be good to have it fixed :)

Comment 18 by g...@chromium.org, Sep 18 2017

Is there documentation for how to build the packages that you care about, so I can make sure that my fix doesn't horribly break anything?

Comment 19 by mka@chromium.org, Sep 18 2017

The primary component is the linux kernel. v4.4 is currently the only version with support for clang.

You'd have to revert the following patch (in src/third_party/kernel/v4.4) to re-enable the use of -mgeneral-regs-only:

commit 2873e0dab1ba9bbec6bbaa999f23e07cb0e9a3fa
Author: Greg Hackmann <ghackmann@google.com>
Date:   Tue Nov 29 12:59:14 2016 -0800

    HACK: arm64: use -mno-implicit-float instead of -mgeneral-regs-only


To build a kernel for kevin with clang:

cros_workon-kevin start sys-kernel/chromeos-kernel-4_4
USE=clang emerge-kevin sys-kernel/chromeos-kernel-4_4

Different components of the arm64 bootloaders also use -mgeneral-regs-only, however to my knowledge the bootloaders are still built with gcc.

Please reach out if you have further questions.
Project Member

Comment 21 by bugdroid1@chromium.org, Oct 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/32446e9f5ab976e82e67e4d368892abd63a28c2a

commit 32446e9f5ab976e82e67e4d368892abd63a28c2a
Author: Manoj Gupta <manojgupta@google.com>
Date: Sat Oct 28 14:14:49 2017

llvm-next: Cherrypick a fix for kernel compilation.

Cherrypick r316374+r316374 to avoid clang crash with -mgeneral-regs-only.
This is only added to llvm-next for now. Does not impact current llvm used.

BUG= chromium:705732 
TEST=llvm-next builds.

Change-Id: Icafec2672b2fd169cbeff67a8160e2276d805cb8
Reviewed-on: https://chromium-review.googlesource.com/742744
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[add] https://crrev.com/32446e9f5ab976e82e67e4d368892abd63a28c2a/sys-devel/llvm/files/cherry/d7958d5ac0c1e979dec35ea26a981532e094b5b2.patch
[rename] https://crrev.com/32446e9f5ab976e82e67e4d368892abd63a28c2a/sys-devel/llvm/llvm-5.0_pre305632_p20170806-r12.ebuild

Status: Assigned (was: Unconfirmed)
Cc: mka@chromium.org
mka@ We have rolled ChromeOS llvm to include George's fix for this bug. Can you try reverting the kernel HACK.
Owner: mka@chromium.org

Comment 25 by mka@chromium.org, Nov 10 2017

Status: Verified (was: Assigned)
I verified that the v4.4 kernel can now be built with the CL reverted.

I plan to wait a bit before submitting the revert, to avoid problems for people who only sync their kernel and not the entire chroot.

Comment 26 by mka@chromium.org, Nov 22 2017

Could we try to get the fix merged into the clang 5 branch to make it available in the next 5.x release?

Comment 27 by g...@chromium.org, Nov 28 2017

(Copy-pasting from the other bug)

llvm.org says that the merge request deadline for 5.0.1 was 15-Nov, and the merge deadline was 22-Nov. Since this isn't a release blocking issue, I believe the 5.0.1 ship has sailed.

If the community decides to do a *.2 release (which is rare), I'll try to get this merged into that.
Project Member

Comment 28 by bugdroid1@chromium.org, Dec 1 2017

Labels: merge-merged-chromeos-4.14
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fc332161cf93750757092c627826672f424272e9

commit fc332161cf93750757092c627826672f424272e9
Author: Matthias Kaehlcke <mka@chromium.org>
Date: Fri Dec 01 01:25:05 2017

Revert "HACK: arm64: use -mno-implicit-float instead of -mgeneral-regs-only"

This reverts commit d9182041859590c3214790c6c90b992ef60cbaf6.

The hack isn't needed anymore with CrOS clang version >= "Chromium OS
6.0_pre316199_p20171105 clang version 6.0.0"

BUG= chromium:705732 
TEST=build kernel for kevin, no compiler error

Change-Id: I528ccd741fbf7cbf5c5f671b733b2ede2d3d8cf0
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/801576
Reviewed-by: Guenter Roeck <groeck@chromium.org>

[modify] https://crrev.com/fc332161cf93750757092c627826672f424272e9/arch/arm64/Makefile

Sign in to add a comment