| Summary: | [cmake][armv7] OFFLINE_ASM_BACKEND is wrongly set building in a native ARMv7 env in the top of a ARM64 host | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Pablo Saavedra <psaavedra> | ||||||||
| Component: | CMake | Assignee: | Pablo Saavedra <psaavedra> | ||||||||
| Status: | RESOLVED WORKSFORME | ||||||||||
| Severity: | Normal | CC: | annulen, bburg, ews-watchlist, gyuyoung.kim, hi, keith_miller, mark.lam, msaboff, ross.kirsling, ryuan.choi, saam, sergio, tzagallo, ysuzuki | ||||||||
| Priority: | P2 | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Pablo Saavedra
2020-09-15 07:06:04 PDT
Created attachment 408815 [details]
patch
Created attachment 408816 [details]
patch
Created attachment 408817 [details]
patch
Comment on attachment 408817 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=408817&action=review > Source/JavaScriptCore/CMakeLists.txt:255 > + elseif (WTF_CPU_ARM64) A pure ARM64 will not have Thumb2 extensions defined. Only an ARMv7 system (using a or not a ARM64 kernel) could expose those extensions. > Source/cmake/OptionsCommon.cmake:23 > +if (WTF_CPU_ARM OR WTF_CPU_ARM64) The WTF_CPU_ARM64 is defined based on the `uname -m`. The kernel still could be a ARM64 but running a ARM 32bits basesystem. Comment on attachment 408817 [details]
patch
This patch doesn’t make sense to me. If you’re cross compiling for armv7 on a arm64 host, why is your cross compiler environment defining WTF_CPU_ARM64? Can you explain that? I suspect that that is where the real issue is.
(In reply to Mark Lam from comment #5) > Comment on attachment 408817 [details] > patch > > This patch doesn’t make sense to me. If you’re cross compiling for armv7 on > a arm64 host, why is your cross compiler environment defining WTF_CPU_ARM64? > Can you explain that? I suspect that that is where the real issue is. I'm not crosscompiling. The kernel is arm64 but the basesystem is armhf. The compilation is done purely natively. (In reply to Pablo Saavedra from comment #6) > (In reply to Mark Lam from comment #5) > > Comment on attachment 408817 [details] > > patch > > > > This patch doesn’t make sense to me. If you’re cross compiling for armv7 on > > a arm64 host, why is your cross compiler environment defining WTF_CPU_ARM64? > > Can you explain that? I suspect that that is where the real issue is. > > I'm not crosscompiling. The kernel is arm64 but the basesystem is armhf. The > compilation is done purely natively. * HOST Kernel (ARM 64 bits) (ARM64 / AARCH64 / Linux 5.6.0-0.bpo.2-arm64 #1 SMP Debian 5.6.14-2~bpo10+1 (2020-06-09) aarch64 GNU/Linux) * HOST Basesystem libs (ARM 32 bits) (Debian armhf / ARMv7 Thumb2 Hard Floating point) * TARGET (ARM 32 bits): The same above ^ Comment on attachment 408817 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=408817&action=review r- for now >> Source/cmake/OptionsCommon.cmake:23 >> +if (WTF_CPU_ARM OR WTF_CPU_ARM64) > > The WTF_CPU_ARM64 is defined based on the `uname -m`. The kernel still could be a ARM64 but running a ARM 32bits basesystem. I think this is the wrong approach. I think that if you’re cross compiling for 32-bit ARM, WTF_CPU_ARM64 shouldn’t be defined. Is there a reason that this cannot be? (In reply to Pablo Saavedra from comment #7) > (In reply to Pablo Saavedra from comment #6) > > (In reply to Mark Lam from comment #5) > > > Comment on attachment 408817 [details] > > > patch > > > > > > This patch doesn’t make sense to me. If you’re cross compiling for armv7 on > > > a arm64 host, why is your cross compiler environment defining WTF_CPU_ARM64? > > > Can you explain that? I suspect that that is where the real issue is. > > > > I'm not crosscompiling. The kernel is arm64 but the basesystem is armhf. The > > compilation is done purely natively. > > * HOST Kernel (ARM 64 bits) (ARM64 / AARCH64 / Linux 5.6.0-0.bpo.2-arm64 #1 > SMP Debian 5.6.14-2~bpo10+1 (2020-06-09) aarch64 GNU/Linux) > * HOST Basesystem libs (ARM 32 bits) (Debian armhf / ARMv7 Thumb2 Hard > Floating point) > * TARGET (ARM 32 bits): The same above ^ Same thing. WebKit is not set up to have such ambiguity. Even if you get past the offlineasm here, you’ll run into all manner of problems later simply because ARM64 is defined. In your case, it looks like you want to build and run a 32-bit arm binary on a 64 bit host. This is effectively cross compiling and the solution you need is the same as that used for cross compilation i.e. the target platform code needs to detect that you’re targeting 32-bit ARM and not pollute it with the detail that it will end up running on a 64-bit host. That detail is orthogonal to how it needs to build. (In reply to Mark Lam from comment #9) > (In reply to Pablo Saavedra from comment #7) > > (In reply to Pablo Saavedra from comment #6) > > > (In reply to Mark Lam from comment #5) > > > > Comment on attachment 408817 [details] > > > > patch > > > > > > > > This patch doesn’t make sense to me. If you’re cross compiling for armv7 on > > > > a arm64 host, why is your cross compiler environment defining WTF_CPU_ARM64? > > > > Can you explain that? I suspect that that is where the real issue is. > > > > > > I'm not crosscompiling. The kernel is arm64 but the basesystem is armhf. The > > > compilation is done purely natively. > > > > * HOST Kernel (ARM 64 bits) (ARM64 / AARCH64 / Linux 5.6.0-0.bpo.2-arm64 #1 > > SMP Debian 5.6.14-2~bpo10+1 (2020-06-09) aarch64 GNU/Linux) > > * HOST Basesystem libs (ARM 32 bits) (Debian armhf / ARMv7 Thumb2 Hard > > Floating point) > > * TARGET (ARM 32 bits): The same above ^ > > Same thing. WebKit is not set up to have such ambiguity. Even if you get > past the offlineasm here, you’ll run into all manner of problems later > simply because ARM64 is defined. > > In your case, it looks like you want to build and run a 32-bit arm binary on > a 64 bit host. This is effectively cross compiling and the solution you > need is the same as that used for cross compilation i.e. the target platform > code needs to detect that you’re targeting 32-bit ARM and not pollute it > with the detail that it will end up running on a 64-bit host. That detail > is orthogonal to how it needs to build. I see your point. Lately I was sharing my thoughts with aperez@igalia.com. He told about `setarch` setarch - change reported architecture in new program environment and/or set personality flags ``` # uname -m aarch64 # setarch --list uname26 linux32 linux64 armv7l armv8l armh arm arm64 aarch64 # setarch arm # uname -m armv8l <<< ``` I suppose I can use this in my environment and keep it the WK's CMakes as it is. |