Page MenuHomeFreeBSD

Support armv7 builds for userland
ClosedPublic

Authored by imp on Aug 12 2017, 6:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 8:29 PM
Unknown Object (File)
Fri, Mar 22, 8:29 PM
Unknown Object (File)
Fri, Mar 22, 8:29 PM
Unknown Object (File)
Fri, Mar 22, 8:29 PM
Unknown Object (File)
Fri, Mar 22, 8:29 PM
Unknown Object (File)
Fri, Mar 8, 7:14 AM
Unknown Object (File)
Jan 11 2024, 6:02 PM
Unknown Object (File)
Jan 3 2024, 10:01 PM

Details

Summary

Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

How will the linker identify <= armv6 vs armv7?

How will the linker identify <= armv6 vs armv7?

.if ${MACHINE_ARCH} == "armv6"
blah
.else
baz
.endif

Or are you asking 'how do I know if I'm using armv7 in this .o' in which case I'll refer you to the ARM docs on the magic section that encodes all that stuff.

Or if you are asking 'how do I keep armv6 and armv7 binaries on a single system and have then use the right shared libraries, I'll just say that's beyond the scope of what I plan to do.

gnu/usr.bin/binutils/Makefile.inc0
19 ↗(On Diff #31994)

IMO this (and same change elsewhere) is a reasonable improvement / cleanup that could/ought to be commited independently in advance of actually adding armv7.

gnu/usr.bin/binutils/Makefile.inc0
19 ↗(On Diff #31994)

As soon as the build finishes, I'll commit this split out.

Rebase with all the fixes and stuff I've pushed in that's basically
unrelated to this...

imp retitled this revision from First cut at going through the tree and mechanically enabling armv7 support. to Support armv7 builds for userland.Aug 15 2017, 12:27 AM
imp edited the summary of this revision. (Show Details)
imp added reviewers: emaste, bdrewery.

You may want to take a look at lib/libc/arm/sys/__vdso_gettc.c and at least use proper asm if possible, instead of the hardcoded instruction byte encoding, if possible after the patch.

In D12010#249499, @kib wrote:

You may want to take a look at lib/libc/arm/sys/__vdso_gettc.c and at least use proper asm if possible, instead of the hardcoded instruction byte encoding, if possible after the patch.

I'll take a look, but if they are used because our as don't grok the instructions, then it won't be possible.
If it's because we're not setting the right arch for this file, then that may be fixable, but should be unrelated to this patch.

if they are used because our as don't grok the instructions, then it won't be possible.

We're using Clang's IAS for all of these, are we not?

mmel added inline comments.
Makefile.libcompat
65 ↗(On Diff #32069)

Is MACHINE_ARCH=armv6 right for armv7?

gnu/usr.bin/binutils/as/Makefile
50 ↗(On Diff #32069)

ARM_ARCH_V6K doesn't looks like right default for armv7

gnu/usr.bin/cc/Makefile.inc
38 ↗(On Diff #32069)

.if ${TARGET_ARCH} == "armv6"
CFLAGS += -DFREEBSD_ARCH_armv6
.endif
.if ${TARGET_ARCH} == "armv7"
CFLAGS += -DFREEBSD_ARCH_armv7
.endif

lib/clang/llvm.build.mk
22 ↗(On Diff #32069)

Only for be sure - MACHINE_ARCH is armv7, so compiler triple starts with 'armv7-', so it uses -march=armv7-a as default, right?

share/mk/bsd.cpu.mk
337 ↗(On Diff #32069)

This change is probably wrong, armv7 case is handled by next if

Damn... You caught all the places I was being lazy :) I'll go back and try to fix them. Thanks!

Makefile.libcompat
65 ↗(On Diff #32069)

Not sure. This functionality may be removed soon, so I haven't thought too much about it.

gnu/usr.bin/binutils/as/Makefile
50 ↗(On Diff #32069)

Good point. However, as is going away soon so I haven't through too much about it... :)

gnu/usr.bin/cc/Makefile.inc
38 ↗(On Diff #32069)

Good point. However, as is going away soon so I haven't through too much about it... :)

lib/clang/llvm.build.mk
22 ↗(On Diff #32069)

I don't know. I think so.

share/mk/bsd.cpu.mk
337 ↗(On Diff #32069)

Good point. Will update.

I've updated with the suggested changes and plan to commit today.

Makefile.libcompat
65 ↗(On Diff #32069)

It should be TARGET_ARCH. Fixed.

This revision was automatically updated to reflect the committed changes.