Page MenuHomeFreeBSD

Add libc and libstand for arm64
ClosedPublic

Authored by andrew on Mar 25 2015, 11:40 AM.

Details

Summary

This adds support for libc and libstand on arm64. The latter uses _setjmp.S from the former.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

andrew updated this revision to Diff 4394.Mar 25 2015, 11:40 AM
andrew retitled this revision from to Add support for the toolchain target on arm64.
andrew updated this object.
andrew edited the test plan for this revision. (Show Details)
andrew added reviewers: emaste, imp.
emaste added inline comments.Mar 25 2015, 1:15 PM
contrib/gcc/unwind-dw2.c
1398 ↗(On Diff #4394)

Upstream bug submitted as https://llvm.org/pr22997

gnu/lib/libgomp/config.h
63 ↗(On Diff #4394)
lib/libc/aarch64/gd_qnan.h
7 ↗(On Diff #4394)

We should drop this line.

lib/libc/aarch64/gen/_set_tp.c
2 ↗(On Diff #4394)

I don't think the an old copyright applies to this file.

lib/libc/aarch64/sys/Makefile.inc
26 ↗(On Diff #4394)

aside, SYSCALL_COMPAT seems to be poorly documented in our infrastructure

lib/libc/aarch64/sys/__vdso_gettc.c
34–48 ↗(On Diff #4394)

This file looks like a good candidate for treatment similar to trivial-getcontextx.c. That can happen after committing this though, along with the ones already in libc/arch/{mips,powerpc,powerpc64,sparc,arm}/__vdso_gettc.c

lib/libthr/arch/aarch64/include/pthread_md.h
46–48 ↗(On Diff #4394)

We define it to be variant I in lib/libc/gen/tls.c?

lib/msun/aarch64/fenv.h
74–75 ↗(On Diff #4394)

The changes in this file seem like they ought to be committed independently right now.

sys/arm64/include/ptrace.h
2–3 ↗(On Diff #4394)

Remove old copyright from file with no content

sys/arm64/include/reg.h
2–6 ↗(On Diff #4394)

this file is new content

andrew added inline comments.Mar 25 2015, 1:36 PM
lib/libc/aarch64/gd_qnan.h
7 ↗(On Diff #4394)

It was mostly guess work for me, I should update it based on the above contrib tool.

emaste edited edge metadata.Mar 25 2015, 3:18 PM

Portions split out:
D2136 rtld-elf
D2137 libthr

imp edited edge metadata.Mar 25 2015, 4:18 PM

First round of changes...

contrib/gcc/unwind-dw2.c
1398 ↗(On Diff #4394)

Do we want to include links link this in comments here, and elsewhere, until the issues are resolved? There's way too much black voo-doo magic in these files anyway...

lib/libc/Makefile
82–89 ↗(On Diff #4394)

This is good... NOT. We need something more generic. Falls into the category of "well, one more isn't so bad" until you one more yourself into a list like this...

lib/libc/aarch64/_fpmath.h
1 ↗(On Diff #4394)

Another instance of where we need a generic IEEE thing, rather than copies of the IEEE thing...

lib/libc/aarch64/gd_qnan.h
7 ↗(On Diff #4394)

We should fix the arm version you copied...

lib/libc/aarch64/gen/flt_rounds.c
36 ↗(On Diff #4394)

This is bogus, unless we have soft floats...

And I'm not sure the copyright applies...

lib/libc/aarch64/sys/Makefile.inc
26 ↗(On Diff #4394)

It is a big bucket we put the dead hand of the past into. :)

For new architectures, though, we should look seriously at not supporting this at all. Or at least supporting it only for things from 10.x and up. Most of these compat things are quite old.

The thread stuff is for running on systems < 8.0.

This list is for stuff pre FreeBSD 7! Do we really need it? No.

As much as I hate to suggest it, I'd be inclined to tag aarch64 in src.conf as an arch where SYSCALL_COMPAT should be no.

lib/libc/aarch64/sys/brk.S
2 ↗(On Diff #4394)

2014 or 2015? I'd be inclined to go with 2015 across the board for any truly new files since they were all published in 2015 or the second half of 2014 for the first time.

lib/libc/aarch64/sys/cerror.S
2 ↗(On Diff #4394)

Some of the new files have copyright 2014 you, others have it copyright FF with your name as developed by. What makes some one, and other another?

lib/libc/gen/tls.c
75 ↗(On Diff #4394)

below you have comments that say it is variant II? Which is it?

lib/libc/xdr/xdr_float.c
64 ↗(On Diff #4394)

#if 1

it seems, no?

sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h
380 ↗(On Diff #4394)

Shouldn't this always be defined by the compiler?

emaste added inline comments.Mar 25 2015, 4:27 PM
contrib/gcc/unwind-dw2.c
1398 ↗(On Diff #4394)

That makes sense.

(There's a chance this one will be addressed in the immediate future though.)

lib/libc/aarch64/gd_qnan.h
7 ↗(On Diff #4394)

Yes, we should run the referenced tool on both 32- and 64-bit arm, and update as necessary.

lib/libc/aarch64/sys/Makefile.inc
26 ↗(On Diff #4394)

Would we put it in BROKEN_OPTIONS, and then delete the list here?

lib/libc/aarch64/sys/cerror.S
2 ↗(On Diff #4394)

Andy did a bunch of arm64 work as a volunteer early on, before joining the overall Foundation-sponsored project.

emaste added inline comments.Mar 25 2015, 4:38 PM
lib/libc/Makefile
82–89 ↗(On Diff #4394)

What would you suggest? If I understand correctly, quad/Makefile.inc should be included for 32-bit archs, other than mips32?

imp added inline comments.Mar 25 2015, 9:40 PM
lib/libc/Makefile
82–89 ↗(On Diff #4394)

IIRC, we have similar constructs elsewhere in the tree. I think we need to centralize. mipsn32, btw, is a 64-bit API despite its name...

I have split out the header changes to D2148

emaste added inline comments.Mar 26 2015, 9:39 PM
contrib/gcc/unwind-dw2.c
1398 ↗(On Diff #4394)

Link should be: http://llvm.org/pr22997

emaste added inline comments.Mar 28 2015, 6:18 PM
lib/libc/Makefile
82–89 ↗(On Diff #4394)

I wasn't able to find an equivalent one in any Makefile* under lib libexec bin sbin usr.bin usr.sbin

lib/libc/aarch64/SYS.h
64 ↗(On Diff #4394)

extra blank line at EOF

lib/libc/aarch64/gen/_setjmp.S
106 ↗(On Diff #4394)

extra blank line at EOF

emaste added inline comments.Mar 30 2015, 4:10 PM
contrib/gcc/unwind-dw2.c
1397 ↗(On Diff #4394)

Addressed by D2175

sys/sys/cdefs.h
746 ↗(On Diff #4394)

Addressed by D2175

We're not ready to enable TLS with D2175, because rtld does not yet support R_AARCH64_TLS_TPREL64

contrib/gcc/unwind-dw2.c
1397 ↗(On Diff #4394)

Oops, commented in the wrong location: not addressed by D2175.

gnu/lib/libgomp/config.h
62 ↗(On Diff #4394)

This one is addressed by D2175

andrew updated this revision to Diff 4566.Apr 1 2015, 8:44 AM
andrew edited edge metadata.

Update to remove parts of this that have been removed.

imp added a comment.Apr 1 2015, 6:07 PM

This is close. The FP stuff still needs some tweaks.

lib/libc/aarch64/SYS.h
36 ↗(On Diff #4566)

Make sure the \ line up.

lib/libc/aarch64/gen/flt_rounds.c
36 ↗(On Diff #4566)

This is wrong unless we have soft float. It needs to be 0..3 for the current FP mode we're running in.

lib/libc/xdr/xdr_float.c
64–68 ↗(On Diff #4566)

Maybe it is time to make this !defined(vax)

imp added a comment.Apr 1 2015, 6:08 PM

missed a spot.

lib/libc/aarch64/sys/Makefile.inc
26–33 ↗(On Diff #4566)

I think you should just delete this. We don't support FreeBSD 5, 6, or 7 aarch64 images. So compat here isn't needed, and really is counter productive.

andrew updated this revision to Diff 4607.Apr 2 2015, 5:08 PM

Add SYSCALL_COMPAT to BROKEN_OPTIONS on arm64, etc.

andrew retitled this revision from Add support for the toolchain target on arm64 to Add libc and libstand for arm64.Apr 2 2015, 5:10 PM
andrew updated this object.
andrew added a comment.Apr 2 2015, 5:13 PM

Still missing __flt_rounds

lib/libc/aarch64/SYS.h
36 ↗(On Diff #4566)

They do, just not in this interface

lib/libc/xdr/xdr_float.c
64–68 ↗(On Diff #4566)

Feel free to fix in head

andrew updated this revision to Diff 4610.Apr 2 2015, 5:14 PM

Remove MK_SYSCALL_COMPAT from lib/libc/aarch64/sys/Makefile.inc

emaste added a subscriber: kib.Apr 2 2015, 5:20 PM
emaste added inline comments.
gnu/lib/libgcc/Makefile
58 ↗(On Diff #4394)

Just to confirm, this is intentionally reverted, we don't want these bits for arm64?

lib/libc/Makefile
82–83 ↗(On Diff #4607)

@imp doesn't like this, but I don't see a straightforward "nicer" way

lib/libc/aarch64/gen/flt_rounds.c
36 ↗(On Diff #4566)

It's a bit strange - my understanding: the ABI specifies long double is 128-bit quad precision, but there's no hardware support. So long double is soft float, while float/double is hard.

36 ↗(On Diff #4607)

@imp says
This is bogus, unless we have soft floats...

We have hard float for float and double. The ABI specifies long double is 128-bit quad precision, but there is no hardware support, so we have soft float there.

lib/libc/aarch64/sys/Makefile.inc
26 ↗(On Diff #4607)

@imp, would we make SYSCAL_COMPAT a BROKEN_OPTIONS for aarch64?

lib/libc/aarch64/sys/__vdso_gettc.c
47 ↗(On Diff #4607)

In D2152 I proposed handling this like trivial-getcontextx.c. I see @kostikbel accepted it (I hadn't noticed until just now).

share/mk/src.opts.mk
236–238 ↗(On Diff #4607)

@imp can you confirm this is what you had in mind?

andrew added inline comments.Apr 2 2015, 5:27 PM
gnu/lib/libgcc/Makefile
58 ↗(On Diff #4394)
lib/libc/aarch64/gen/flt_rounds.c
36 ↗(On Diff #4607)

It needs to return a value depending on the rounding mode, I still need to add the asm to get this.

lib/libc/aarch64/sys/Makefile.inc
26 ↗(On Diff #4607)

Fixed in diff 4610

andrew updated this revision to Diff 4631.Apr 3 2015, 10:21 AM

Fix __flt_rounds

andrew updated this revision to Diff 4632.Apr 3 2015, 10:24 AM

Catch up with r281004

imp added inline comments.Apr 3 2015, 4:10 PM
share/mk/src.opts.mk
157 ↗(On Diff #4632)

Don't delete this here. It's fine, even if it is broken.

237–238 ↗(On Diff #4632)

You don't need this.

kib added a comment.Apr 3 2015, 4:35 PM

Why shmat() appears there ?

What are default permissions for the stack segment on aarch64 ? Is it allowed for dso to request an executable stack ?

emaste added inline comments.Apr 3 2015, 6:06 PM
share/mk/src.opts.mk
236 ↗(On Diff #4632)

I'd suggest we put SYSCALL_COMPAT on its own with a comment, since it isn't really "broken" per se, but just not applicable.

# Pre-SYSCALL_COMPAT FreeBSD releases did not support arm64, so the option has no purpose.
BROKEN_OPTIONS+=SYSCALL_COMPAT
andrew updated this revision to Diff 4679.Apr 5 2015, 5:32 PM

Update based on comments

emaste accepted this revision.Apr 6 2015, 2:02 PM
emaste edited edge metadata.

Looks good to me, any further nits can be fixed post-merge.

This revision is now accepted and ready to land.Apr 6 2015, 2:02 PM
andrew closed this revision.Apr 7 2015, 9:52 AM
andrew updated this revision to Diff 4717.

Closed by commit rS281197 (authored by @andrew).