Page MenuHomeFreeBSD

uname: switch machine to HW_MACHINE_ARCH
Needs RevisionPublic

Authored by pkubaj on Wed, Jul 27, 12:43 AM.

Details

Reviewers
imp
Group Reviewers
PowerPC
Summary

On powerpc64, powerpc64le and riscv64 some software wrongly assumes that
it runs on powerpc or riscv (32-bit).

Test Plan

make universe

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 46620
Build 43509: arc lint + arc unit

Event Timeline

If you're going by the output of 'uname -a' or 'uname -m', on FreeBSD you can see the MACHINE_ARCH with uname -p instead.

imp requested changes to this revision.Wed, Jul 27, 2:57 AM

I'm sure this would break things...
What software? We've had this "issue" for ~2 decades since powerpc grew 64 bit support...
Why now?

This revision now requires changes to proceed.Wed, Jul 27, 2:57 AM

If you're going by the output of 'uname -a' or 'uname -m', on FreeBSD you can see the MACHINE_ARCH with uname -p instead.

Yea, this isn't even used for uname(1)...

One would be Perl's uname(): https://github.com/Perl/perl5/blob/blead/ext/POSIX/POSIX.xs#L3349. This causes e.g. OpenSSL's build system to be explicitly told what architecture to build (see security/openssl port).
Another would be Firefox's generation of default UA: https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttpHandler.cpp#931

I'm pretty sure there are others, it's just that powerpc and riscv are not that widely used. It also benefits armv*, since with this change either armv6 or armv7 should be printed, instead of plain arm

This doesn't change anything for amd64 and i386 and very little for aarch64 (aarch64 will be printed instead of arm64), so I'm not sure what breakage you think about