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

Issue 630057 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 537368



Sign in to add a comment

dev-libs/openssl cannot be built by clang in thumb mode

Project Member Reported by laszio@chromium.org, Jul 21 2016

Issue description

llvm doesn't recognize expression in modified immediate in thumb mode:

(-triple=armv7a-cros-linux-gnueabihf)

.text
.syntax unified
.thumb
.arch armv7-a

.L1:
 sub r3,r3,#.L1-.L2
.L2:

 

Comment 1 by laszio@chromium.org, Jul 21 2016

Filed a bug against LLVM:
https://llvm.org/bugs/show_bug.cgi?id=28647

btw, this is the command line to reproduce:

$ llvm-mc -triple=armv7a-linux-gnueabi -o test.o test.s
test.s:7:12: error: invalid operand for instruction
 sub r3,r3,#.L1-.L2
Components: Internals>Network>SSL
Kenny uploaded a CL for this here that I still need to get to testing but should do the trick:
https://boringssl-review.googlesource.com/c/8893/

I'll try to get that in today.
Summary: BoringSSL cannot be built by clang in thumb mode (was: openssl cannot be built by clang in thumb mode)
Hrm, or perhaps that's something else? Anyway, I'll land that and we'll see if that resolves things.
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 10 2016

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

commit 1d2ea802441fd657aed6c2ebdf2e056a2adf27c2
Author: Ting-Yuan Huang <laszio@chromium.org>
Date: Thu Jul 21 23:49:49 2016

dev-libs/openssl: always use gcc to build openssl

clang's having trouble building openssl with -mthumb.

BUG=chromium:630057
TEST=cbuildbot falco-release daisy-release x86-alex-release

Change-Id: I7131bee2add182f8c331b5668e33b13362a4f02f
Reviewed-on: https://chromium-review.googlesource.com/362516
Commit-Ready: Ting-Yuan Huang <laszio@chromium.org>
Tested-by: Ting-Yuan Huang <laszio@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/1d2ea802441fd657aed6c2ebdf2e056a2adf27c2/chromeos/config/env/dev-libs/openssl

Blocking: 537368
Labels: llvm-build

Comment 8 by cmt...@chromium.org, Oct 27 2016

Owner: laszio@chromium.org

Comment 9 by laszio@chromium.org, Apr 21 2017

In openssl upstream, there are workarounds for __APPLE__. For example:

#ifdef  __APPLE__
  adr $tbl,AES_Te+1024        @ Te4
#else
  sub $tbl,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4
#endif

However, it is ugly...
Cc: yunlian@chromium.org llozano@chromium.org
I believe we've imported most of those. Going by Android, there were still a few files that clang couldn't assemble. Though I haven't tried this for a while.
Hi David,

This CL cherry-picked the upstream work-arounds and changed __APPLE__ to __clang__. Besides cbuildbot, are there other tests I can try?

https://chromium-review.googlesource.com/c/484791/
Cc: davidben@chromium.org
Components: -Internals>Network>SSL OS>Systems>Network
Labels: OS-Chrome
Summary: dev-libs/openssl cannot be built by clang in thumb mode (was: BoringSSL cannot be built by clang in thumb mode)
That's a CL for CrOS's system build of OpenSSL. Is that what you meant this bug was about?

The component of the bug and the title says this is about BoringSSL, which is used with Chrome, not CrOS. It looks like comment #2 miscategorized this bug and then I got confused with comment #4. You'll need to talk to CrOS folks to answer your question; I and the folks on this component maintain BoringSSL and Chrome's use of it, not CrOS's system OpenSSL.
I've been also confused and wondering what's the difference between openssl and boringssl. It's good that these misunderstandings are clarified now.

There is no difference wether this is worked-around by gcc or in openssl from toolchain team's perspective. I'm going to check with ARM to see if they can support this syntax; Otherwise we either upstream the workaround to openssl, or leave it with gcc (or gnu as).
Yeah, my bad, I got confused and made it worse. :-)
It seems that the assembler needs some time to support the syntax. I'll go for the above CL for now.

By the way, it's interesting that BoringSSL, which has the assembler syntax that clang doesn't support, doesn't encounter this problem. Perhaps we are not building it in Chrome OS, or not building it in thumb2?
BoringSSL turns off the clang assembler in both Chromium and Android. But we also sync OpenSSL assembly from upstream master rather than 1.0.2, so we probably include clang assembler compatibility fixes that dev-libs/openssl does not.

(Though, looking at Android, they only need to build two files without the clang assembler. It's possible we're not far off from fixing it? It's unclear. However, the BoringSSL team is absurdly oversubscribed right now and definitely does not have time to look into this right now.)
Project Member

Comment 18 by bugdroid1@chromium.org, Apr 29 2017

clang supports this asm syntax in r304702. The workarounds can be removed after we update clang :-)

See upstream bug for more details: https://bugs.llvm.org/show_bug.cgi?id=28647
Cc: mnissler@chromium.org djkurtz@chromium.org vapier@chromium.org ejcaruso@chromium.org drinkcat@chromium.org
 Issue 735342  has been merged into this issue.
Components: Tools>ChromeOS-Toolchain
Status: Assigned (was: Untriaged)
This bug has an owner, thus, it's been triaged. Changing status to "assigned".

Sign in to add a comment