find libc/ -type f -name \*c > /tmp/libc
#remove libc prefix
find_diff (which is:)
------
#!/bin/bash
execute_diff()
{
local NAME="$1"
echo "-----------------------------------------"
echo "DIFF: $NAME"
diff musl/src$NAME libc$NAME 2>&1
}
export -f execute_diff
cat /tmp/libc2 | xargs -I{} bash -c "execute_diff {}"
Hi,As I have been researching what it would take to add floating-point support to the AArch64 port
, I started realizing that it might be better (not necessarily easier) to upgrade musl.
At first, I hoped I could just add fegetenv support (https://linux.die.net/man/3/fegetenv) by adding fenv.S from the latest musl. But very soon I have discovered we need to support LDBL_MANT_DIG=113 (please see comments in include/api/aarch64/bits/float.h) which triggers many missing symbols for LDBL_MANT_DIG == 113 (see also musl/src/math/__invtrigl.* for example) which I added manually from latest musl (would really require moving it to libc) but then there are 10 or so other math-related files like musl/src/math/lgammal.c and vfprintf.c-like ones that also need updates. And this is just for floating-point support
(no signals, setjmp, and other goodies we also need to support AArch64 and might get from musl as well).This led me to question this approach and realize that it might be better to simply upgrade musl to the latest version which has the latest AArch64 support plus all bugs fixed in the last 7 years.So I was wondering what you think about my pretty controversial idea?Obviously it is not a small effort and somewhat risky as things might break (what is a chance of that? any concrete examples?). But I think it is necessary and there is some concrete upside to that.
Obviously we cannot simply update musl git subproject to the latest version as a significant number of files have been changed since and moved to libc subdirectory (or also somewhere else?) or were manually added from whatever version of musl at some point. So here is a high-level recipe on how we could do it:For each *.c|*.cc file (and probably headers) under libc/ find corresponding .c file under musl/src (sometimes the file will be .cc like libc/misc/getopt.cc where we had to add C++ code):
- if file not found under musl nothing has to be done (correct?)
- otherwise, find a delta between the two and apply to the copy in new musl (this would be in most cases manual step, as very often the old file in musl would have changed since 2013)
As I understand many files under libc/ never came from musl - some were written from scratch (see libc/mman.cc) and some may have come from different place (see libc/locale/*_l.c which I think delegate to musl).
Anything I have missed?How do we test all this? Besides unit tests we also have this - https://github.com/cloudius-systems/osv/wiki/Automated-Testing-Framework - which allows us to test OSv against 30+ apps.Do you have any suggestions for the strategy? Maybe something that would make future upgrades easier? What about reviewing the changes - how to make easier to review? Maybe a separate branch? Any step by step approach ideas?
I think that Geraldo Netto started working on this at some point, but I am not sure where he left it off.WaldekPS. I am enclosing a file that is an approximation of a diff between libc and musl/src directories which I achieved more-less in this way:
find libc/ -type f -name \*c > /tmp/libc
#remove libc prefix
find_diff (which is:)
------
#!/bin/bash
execute_diff()
{
local NAME="$1"
echo "-----------------------------------------"
echo "DIFF: $NAME"
diff musl/src$NAME libc$NAME 2>&1
}
export -f execute_diff
cat /tmp/libc2 | xargs -I{} bash -c "execute_diff {}"
--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/d61435ae-dc51-48a4-938b-e77eb7f2725an%40googlegroups.com.
On Fri, Jul 24, 2020 at 12:02 AM Waldek Kozaczuk <jwkoz...@gmail.com> wrote:Hi,As I have been researching what it would take to add floating-point support to the AArch64 portWhat is the problem with aarch64 floating point, and why is it related to musl?Is it just the esoteric functions like feenableexcept() and fegetenv() you mentioned - or are somehow all the math functions broken?Does the normal floating point - besides those functions - work correctly?Note that OSv uses floating point in the kernel (mostly for calculations in the scheduler...) and in x86 we had a lot of grief comingfrom this, needing to save the floating point state on context switches and things like that - I wonder if there isn't similar problemsin aarch64 which have nothing to do with Musl., I started realizing that it might be better (not necessarily easier) to upgrade musl.This is definitely a good idea, but won't be trivial. I think I once wrote an outline of how this could be done, but I don't remember where I wrote it :-)
To unsubscribe from this group and stop receiving emails from it, send an email to osv...@googlegroups.com.
libc/locale/duplocale.c
libc/locale/isalnum_l.c
libc/locale/isalpha_l.c
libc/locale/isblank_l.c
libc/locale/iscntrl_l.c
libc/locale/isdigit_l.c
libc/locale/isgraph_l.c
libc/locale/islower_l.c
libc/locale/isprint_l.c
libc/locale/ispunct_l.c
libc/locale/isspace_l.c
libc/locale/isupper_l.c
libc/locale/iswalnum_l.c
libc/locale/iswalpha_l.c
libc/locale/iswblank_l.c
libc/locale/iswcntrl_l.c
libc/locale/iswctype_l.c
libc/locale/iswdigit_l.c
libc/locale/iswgraph_l.c
libc/locale/iswlower_l.c
libc/locale/iswprint_l.c
libc/locale/iswpunct_l.c
libc/locale/iswspace_l.c
libc/locale/iswupper_l.c
libc/locale/iswxdigit_l.c
libc/locale/isxdigit_l.c
libc/locale/langinfo.c
libc/locale/nl_langinfo_l.c
libc/locale/setlocale.c
libc/locale/strcoll.c
libc/locale/strcoll_l.c
libc/locale/strfmon.c
libc/locale/strftime_l.c
libc/locale/strxfrm.c
libc/locale/strxfrm_l.c
libc/locale/tolower_l.c
libc/locale/towlower_l.c
libc/locale/towupper_l.c
libc/locale/uselocale.c
libc/locale/wcscoll.c
libc/locale/wcscoll_l.c
libc/locale/wcsxfrm.c
libc/locale/wcsxfrm_l.c
libc/locale/wctype_l.c
libc/time/__asctime.c
libc/time/gmtime.c
libc/time/gmtime_r.c
libc/time/localtime.c
libc/time/localtime_r.c
libc/time/mktime.c
libc/time/strftime.c
libc/time/timegm.c
libc/time/wcsftime.c
I believe these are copies from the older musl version.
Waldek