Page MenuHomeFreeBSD

Add libc and libstand for arm64
ClosedPublic

Authored by andrew on Mar 25 2015, 11:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 3:01 PM
Unknown Object (File)
Sun, Dec 22, 9:41 AM
Unknown Object (File)
Thu, Dec 19, 8:33 PM
Unknown Object (File)
Thu, Dec 19, 3:52 PM
Unknown Object (File)
Thu, Dec 19, 3:51 PM
Unknown Object (File)
Thu, Dec 19, 2:58 PM
Unknown Object (File)
Thu, Dec 19, 2:56 PM
Unknown Object (File)
Thu, Dec 19, 10:01 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 - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

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.
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
8

We should drop this line.

lib/libc/aarch64/gen/_set_tp.c
3

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

lib/libc/aarch64/sys/Makefile.inc
27

aside, SYSCALL_COMPAT seems to be poorly documented in our infrastructure

lib/libc/aarch64/sys/__vdso_gettc.c
35–49

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

lib/libc/aarch64/gd_qnan.h
8

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

Portions split out:
D2136 rtld-elf
D2137 libthr

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

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
2

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

lib/libc/aarch64/gd_qnan.h
8

We should fix the arm version you copied...

lib/libc/aarch64/gen/flt_rounds.c
37

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

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

lib/libc/aarch64/sys/Makefile.inc
27

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
3

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
3

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

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

lib/libc/xdr/xdr_float.c
64

#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?

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
8

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

lib/libc/aarch64/sys/Makefile.inc
27

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

lib/libc/aarch64/sys/cerror.S
3

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

lib/libc/Makefile
82–89

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

lib/libc/Makefile
82–89

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

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

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

lib/libc/Makefile
82–89

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
65

extra blank line at EOF

lib/libc/aarch64/gen/_setjmp.S
107

extra blank line at EOF

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 edited edge metadata.

Update to remove parts of this that have been removed.

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

lib/libc/aarch64/SYS.h
36

Make sure the \ line up.

lib/libc/aarch64/gen/flt_rounds.c
36

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

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

missed a spot.

lib/libc/aarch64/sys/Makefile.inc
26–33

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.

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.

Still missing __flt_rounds

lib/libc/aarch64/SYS.h
36

They do, just not in this interface

lib/libc/xdr/xdr_float.c
64–68

Feel free to fix in head

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

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–84

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

lib/libc/aarch64/gen/flt_rounds.c
36

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.

37

@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
27

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

lib/libc/aarch64/sys/__vdso_gettc.c
48

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?

gnu/lib/libgcc/Makefile
58 ↗(On Diff #4394)
lib/libc/aarch64/gen/flt_rounds.c
37

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
27

Fixed in diff 4610

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.

Why shmat() appears there ?

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

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

Update based on comments

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 updated this revision to Diff 4717.

Closed by commit rS281197 (authored by @andrew).