Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly support ARM64's 32-bit compatibility profile #4527

Conversation

directhex
Copy link
Contributor

uname -m on ARM64 processors using 32-bit personality shows as armv8l, not armv7l. See https://github.com/torvalds/linux/blob/cef7298262e9af841fb70d8673af45caf55300a1/arch/arm64/include/asm/compat.h#L22

This allows building on 64-bit ARM machines in a 32-bit environment. Without this patch, the build system thinks 32-bit personality on ARM64 is linux-x64, and the build explodes accordingly.

32-bit personality allows building ARM32 code on modern ARM64 systems, which in this day and age are easier to obtain with decent performance characteristics.

builder@xam-softiron-1:~$ uname -a
Linux xam-softiron-1 4.17.0ilp32-31333-gb2d7ec3 #1 SMP Tue Oct 16 16:37:20 EDT 2018 aarch64 aarch64 aarch64 GNU/Linux
builder@xam-softiron-1:~$ linux32 uname -a
Linux xam-softiron-1 4.17.0ilp32-31333-gb2d7ec3 #1 SMP Tue Oct 16 16:37:20 EDT 2018 armv8l armv8l armv8l GNU/Linux

Closes: https://github.com/dotnet/cli/issues/11437

Whatever process pushes to https://dot.net/v1/dotnet-install.sh really needs this update

`uname -m` on ARM64 processors using 32-bit personality shows as `armv8l`, not `armv7l`. See https://github.com/torvalds/linux/blob/cef7298262e9af841fb70d8673af45caf55300a1/arch/arm64/include/asm/compat.h#L22

This allows building on 64-bit ARM machines in a 32-bit environment. Without this patch, the build system thinks 32-bit personality on ARM64 is linux-x64, and the build explodes accordingly.

32-bit personality allows building ARM32 code on modern ARM64 systems, which in this day and age are easier to obtain with decent performance characteristics.

```
builder@xam-softiron-1:~$ uname -a
Linux xam-softiron-1 4.17.0ilp32-31333-gb2d7ec3 dotnet#1 SMP Tue Oct 16 16:37:20 EDT 2018 aarch64 aarch64 aarch64 GNU/Linux
builder@xam-softiron-1:~$ linux32 uname -a
Linux xam-softiron-1 4.17.0ilp32-31333-gb2d7ec3 dotnet#1 SMP Tue Oct 16 16:37:20 EDT 2018 armv8l armv8l armv8l GNU/Linux
```

Closes: https://github.com/dotnet/cli/issues/11437
@pgrawehr
Copy link

Is this supposed to fix issues like dotnet/iot#805?

@directhex
Copy link
Contributor Author

@pgrawehr related. build.sh will always do the wrong thing where the kernel is 64-bit and the userland is 32-bit. This PR is specifically for cases where the kernel lies about being 32-bit but the fake 32-bit ARM kernel is mis-detected as being AMD64. Your reported issue is for where the kernel isn't lying at all - but assuming kernel == userland is breaking. That's marginally more complicated to fix.

@pgrawehr
Copy link

Well, not sure. On the Raspberry Pi, with a default Raspbian installation, everything is 32Bit, except that the CPU is 64-bit capable. As far as I know, this isn't running a 64 Bit Kernel yet (how do I find out?)

@directhex
Copy link
Contributor Author

uname -m should report aarch64 for a 64-bit kernel, armvX for a 32-bit kernel, for some value of X

@pgrawehr
Copy link

pgrawehr commented Feb 1, 2020

uname -m returns armv7l

@jonfortescue
Copy link
Contributor

@pgrawehr @directhex Is this still something we're interested in merging?

@directhex
Copy link
Contributor Author

Yes. I have no idea why a 1 character fix died in review

@jonfortescue
Copy link
Contributor

@directhex awesome. I'll make sure this gets merged after a more recent build is green.

@jonfortescue
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants