Skip to content

Commit 04bd527

Browse files
authored
Update to Musl 1.2.6, setup git subtrees (#797)
This is a series of commits which culminates in the update to Musl 1.2.6. In order to make this a bit more automatic in the future as well I've setup the git history here to be able to use the `git subtree` command in the future. The `libc-top-half/README.md` file documents this information and how to update in the future, along with what I've executed for this PR. The commits here are intended to stay separate and I'll use a "merge" strategy with this PR rather than squash & merge since the git commit history is intended to be important. Specifically what this is doing is: * d059c0d - the `libc-top-half/musl` directory is deleted entirely, including all changes made for wasi-libc. * c5991c6 and b78ff33 - commits created by `git subtree add`. This creates the `musl` directory in a pristine state at 1.2.5 * 1065f2d reverts back to `main`, meaning that the diff from main is nothing. Git history is in place though for `git subtree` * 968167f and 0b361f2 - created by `git subtree pull` to update to Musl 1.2.6. I've edited the merge commit myself quite a bit to resolve conflicts. * 93f1ec6 - a final commit with minor build fixes, symbol updates, etc. The end result is that `git subtree pull` can be used in the future to update the musl subtree with conflict markers and everything making it easy to see what changed.
2 parents 161b319 + 93f1ec6 commit 04bd527

193 files changed

Lines changed: 1257 additions & 801 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

expected/wasm32-wasip1-threads/predefined-macros.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@
619619
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
620620
#define IN6_IS_ADDR_SITELOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
621621
#define IN6_IS_ADDR_UNSPECIFIED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
622-
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
622+
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && !IN6_IS_ADDR_UNSPECIFIED(a) && !IN6_IS_ADDR_LOOPBACK(a))
623623
#define IN6_IS_ADDR_V4MAPPED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
624624
#define INADDRSZ NS_INADDRSZ
625625
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001)
@@ -657,8 +657,8 @@
657657
#define INTMAX_MIN INT64_MIN
658658
#define INTPTR_MAX INT32_MAX
659659
#define INTPTR_MIN INT32_MIN
660-
#define INT_FAST16_MAX INT16_MAX
661-
#define INT_FAST16_MIN INT16_MIN
660+
#define INT_FAST16_MAX INT32_MAX
661+
#define INT_FAST16_MIN INT32_MIN
662662
#define INT_FAST32_MAX INT32_MAX
663663
#define INT_FAST32_MIN INT32_MIN
664664
#define INT_FAST64_MAX INT64_MAX
@@ -1521,6 +1521,9 @@
15211521
#define REG_NOTBOL 1
15221522
#define REG_NOTEOL 2
15231523
#define REG_OK 0
1524+
#define RENAME_EXCHANGE (1 << 1)
1525+
#define RENAME_NOREPLACE (1 << 0)
1526+
#define RENAME_WHITEOUT (1 << 2)
15241527
#define RE_DUP_MAX 255
15251528
#define RMSGD 0x0001
15261529
#define RMSGN 0x0002
@@ -2050,7 +2053,7 @@
20502053
#define UINTMAX_C(c) c ## ULL
20512054
#define UINTMAX_MAX UINT64_MAX
20522055
#define UINTPTR_MAX UINT32_MAX
2053-
#define UINT_FAST16_MAX UINT16_MAX
2056+
#define UINT_FAST16_MAX UINT32_MAX
20542057
#define UINT_FAST32_MAX UINT32_MAX
20552058
#define UINT_FAST64_MAX UINT64_MAX
20562059
#define UINT_FAST8_MAX UINT8_MAX
@@ -2271,8 +2274,8 @@
22712274
#define _POSIX_TRACE_USER_EVENT_MAX 32
22722275
#define _POSIX_TTY_NAME_MAX 9
22732276
#define _POSIX_TZNAME_MAX 6
2274-
#define _POSIX_V6_ILP32_OFFBIG (1)
2275-
#define _POSIX_V7_ILP32_OFFBIG (1)
2277+
#define _POSIX_V6_ILP32_OFFBIG 1
2278+
#define _POSIX_V7_ILP32_OFFBIG 1
22762279
#define _POSIX_VDISABLE 0
22772280
#define _POSIX_VERSION 200809L
22782281
#define _PTHREAD_H
@@ -3105,7 +3108,7 @@
31053108
#define __WINT_MAX__ 2147483647
31063109
#define __WINT_TYPE__ int
31073110
#define __WINT_WIDTH__ 32
3108-
#define __WORDSIZE 64
3111+
#define __WORDSIZE 32
31093112
#define __alignas_is_defined 1
31103113
#define __alignof_is_defined 1
31113114
#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))

expected/wasm32-wasip1/predefined-macros.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@
619619
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
620620
#define IN6_IS_ADDR_SITELOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
621621
#define IN6_IS_ADDR_UNSPECIFIED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
622-
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
622+
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && !IN6_IS_ADDR_UNSPECIFIED(a) && !IN6_IS_ADDR_LOOPBACK(a))
623623
#define IN6_IS_ADDR_V4MAPPED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
624624
#define INADDRSZ NS_INADDRSZ
625625
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001)
@@ -657,8 +657,8 @@
657657
#define INTMAX_MIN INT64_MIN
658658
#define INTPTR_MAX INT32_MAX
659659
#define INTPTR_MIN INT32_MIN
660-
#define INT_FAST16_MAX INT16_MAX
661-
#define INT_FAST16_MIN INT16_MIN
660+
#define INT_FAST16_MAX INT32_MAX
661+
#define INT_FAST16_MIN INT32_MIN
662662
#define INT_FAST32_MAX INT32_MAX
663663
#define INT_FAST32_MIN INT32_MIN
664664
#define INT_FAST64_MAX INT64_MAX
@@ -1521,6 +1521,9 @@
15211521
#define REG_NOTBOL 1
15221522
#define REG_NOTEOL 2
15231523
#define REG_OK 0
1524+
#define RENAME_EXCHANGE (1 << 1)
1525+
#define RENAME_NOREPLACE (1 << 0)
1526+
#define RENAME_WHITEOUT (1 << 2)
15241527
#define RE_DUP_MAX 255
15251528
#define RMSGD 0x0001
15261529
#define RMSGN 0x0002
@@ -2048,7 +2051,7 @@
20482051
#define UINTMAX_C(c) c ## ULL
20492052
#define UINTMAX_MAX UINT64_MAX
20502053
#define UINTPTR_MAX UINT32_MAX
2051-
#define UINT_FAST16_MAX UINT16_MAX
2054+
#define UINT_FAST16_MAX UINT32_MAX
20522055
#define UINT_FAST32_MAX UINT32_MAX
20532056
#define UINT_FAST64_MAX UINT64_MAX
20542057
#define UINT_FAST8_MAX UINT8_MAX
@@ -2269,8 +2272,8 @@
22692272
#define _POSIX_TRACE_USER_EVENT_MAX 32
22702273
#define _POSIX_TTY_NAME_MAX 9
22712274
#define _POSIX_TZNAME_MAX 6
2272-
#define _POSIX_V6_ILP32_OFFBIG (1)
2273-
#define _POSIX_V7_ILP32_OFFBIG (1)
2275+
#define _POSIX_V6_ILP32_OFFBIG 1
2276+
#define _POSIX_V7_ILP32_OFFBIG 1
22742277
#define _POSIX_VDISABLE 0
22752278
#define _POSIX_VERSION 200809L
22762279
#define _PTHREAD_H
@@ -3102,7 +3105,7 @@
31023105
#define __WINT_MAX__ 2147483647
31033106
#define __WINT_TYPE__ int
31043107
#define __WINT_WIDTH__ 32
3105-
#define __WORDSIZE 64
3108+
#define __WORDSIZE 32
31063109
#define __alignas_is_defined 1
31073110
#define __alignof_is_defined 1
31083111
#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))

expected/wasm32-wasip2/defined-symbols.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,4 +1570,4 @@ y0f
15701570
y1
15711571
y1f
15721572
yn
1573-
ynf
1573+
ynf

expected/wasm32-wasip2/predefined-macros.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@
710710
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
711711
#define IN6_IS_ADDR_SITELOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
712712
#define IN6_IS_ADDR_UNSPECIFIED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
713-
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
713+
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && !IN6_IS_ADDR_UNSPECIFIED(a) && !IN6_IS_ADDR_LOOPBACK(a))
714714
#define IN6_IS_ADDR_V4MAPPED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
715715
#define INADDRSZ NS_INADDRSZ
716716
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001)
@@ -748,8 +748,8 @@
748748
#define INTMAX_MIN INT64_MIN
749749
#define INTPTR_MAX INT32_MAX
750750
#define INTPTR_MIN INT32_MIN
751-
#define INT_FAST16_MAX INT16_MAX
752-
#define INT_FAST16_MIN INT16_MIN
751+
#define INT_FAST16_MAX INT32_MAX
752+
#define INT_FAST16_MIN INT32_MIN
753753
#define INT_FAST32_MAX INT32_MAX
754754
#define INT_FAST32_MIN INT32_MIN
755755
#define INT_FAST64_MAX INT64_MAX
@@ -1652,6 +1652,9 @@
16521652
#define REG_NOTBOL 1
16531653
#define REG_NOTEOL 2
16541654
#define REG_OK 0
1655+
#define RENAME_EXCHANGE (1 << 1)
1656+
#define RENAME_NOREPLACE (1 << 0)
1657+
#define RENAME_WHITEOUT (1 << 2)
16551658
#define RE_DUP_MAX 255
16561659
#define RMSGD 0x0001
16571660
#define RMSGN 0x0002
@@ -2198,7 +2201,7 @@
21982201
#define UINTMAX_C(c) c ## ULL
21992202
#define UINTMAX_MAX UINT64_MAX
22002203
#define UINTPTR_MAX UINT32_MAX
2201-
#define UINT_FAST16_MAX UINT16_MAX
2204+
#define UINT_FAST16_MAX UINT32_MAX
22022205
#define UINT_FAST32_MAX UINT32_MAX
22032206
#define UINT_FAST64_MAX UINT64_MAX
22042207
#define UINT_FAST8_MAX UINT8_MAX
@@ -2420,8 +2423,8 @@
24202423
#define _POSIX_TRACE_USER_EVENT_MAX 32
24212424
#define _POSIX_TTY_NAME_MAX 9
24222425
#define _POSIX_TZNAME_MAX 6
2423-
#define _POSIX_V6_ILP32_OFFBIG (1)
2424-
#define _POSIX_V7_ILP32_OFFBIG (1)
2426+
#define _POSIX_V6_ILP32_OFFBIG 1
2427+
#define _POSIX_V7_ILP32_OFFBIG 1
24252428
#define _POSIX_VDISABLE 0
24262429
#define _POSIX_VERSION 200809L
24272430
#define _PTHREAD_H
@@ -3100,7 +3103,7 @@
31003103
#define __WINT_MAX__ 2147483647
31013104
#define __WINT_TYPE__ int
31023105
#define __WINT_WIDTH__ 32
3103-
#define __WORDSIZE 64
3106+
#define __WORDSIZE 32
31043107
#define __alignas_is_defined 1
31053108
#define __alignof_is_defined 1
31063109
#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))

expected/wasm32-wasip3/defined-symbols.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,4 +1603,4 @@ y0f
16031603
y1
16041604
y1f
16051605
yn
1606-
ynf
1606+
ynf

expected/wasm32-wasip3/predefined-macros.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@
710710
#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
711711
#define IN6_IS_ADDR_SITELOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
712712
#define IN6_IS_ADDR_UNSPECIFIED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
713-
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
713+
#define IN6_IS_ADDR_V4COMPAT(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && !IN6_IS_ADDR_UNSPECIFIED(a) && !IN6_IS_ADDR_LOOPBACK(a))
714714
#define IN6_IS_ADDR_V4MAPPED(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
715715
#define INADDRSZ NS_INADDRSZ
716716
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001)
@@ -748,8 +748,8 @@
748748
#define INTMAX_MIN INT64_MIN
749749
#define INTPTR_MAX INT32_MAX
750750
#define INTPTR_MIN INT32_MIN
751-
#define INT_FAST16_MAX INT16_MAX
752-
#define INT_FAST16_MIN INT16_MIN
751+
#define INT_FAST16_MAX INT32_MAX
752+
#define INT_FAST16_MIN INT32_MIN
753753
#define INT_FAST32_MAX INT32_MAX
754754
#define INT_FAST32_MIN INT32_MIN
755755
#define INT_FAST64_MAX INT64_MAX
@@ -1631,6 +1631,9 @@
16311631
#define REG_NOTBOL 1
16321632
#define REG_NOTEOL 2
16331633
#define REG_OK 0
1634+
#define RENAME_EXCHANGE (1 << 1)
1635+
#define RENAME_NOREPLACE (1 << 0)
1636+
#define RENAME_WHITEOUT (1 << 2)
16341637
#define RE_DUP_MAX 255
16351638
#define RMSGD 0x0001
16361639
#define RMSGN 0x0002
@@ -2193,7 +2196,7 @@
21932196
#define UINTMAX_C(c) c ## ULL
21942197
#define UINTMAX_MAX UINT64_MAX
21952198
#define UINTPTR_MAX UINT32_MAX
2196-
#define UINT_FAST16_MAX UINT16_MAX
2199+
#define UINT_FAST16_MAX UINT32_MAX
21972200
#define UINT_FAST32_MAX UINT32_MAX
21982201
#define UINT_FAST64_MAX UINT64_MAX
21992202
#define UINT_FAST8_MAX UINT8_MAX
@@ -2426,8 +2429,8 @@
24262429
#define _POSIX_TRACE_USER_EVENT_MAX 32
24272430
#define _POSIX_TTY_NAME_MAX 9
24282431
#define _POSIX_TZNAME_MAX 6
2429-
#define _POSIX_V6_ILP32_OFFBIG (1)
2430-
#define _POSIX_V7_ILP32_OFFBIG (1)
2432+
#define _POSIX_V6_ILP32_OFFBIG 1
2433+
#define _POSIX_V7_ILP32_OFFBIG 1
24312434
#define _POSIX_VDISABLE 0
24322435
#define _POSIX_VERSION 200809L
24332436
#define _PTHREAD_H
@@ -3106,7 +3109,7 @@
31063109
#define __WINT_MAX__ 2147483647
31073110
#define __WINT_TYPE__ int
31083111
#define __WINT_WIDTH__ 32
3109-
#define __WORDSIZE 64
3112+
#define __WORDSIZE 32
31103113
#define __alignas_is_defined 1
31113114
#define __alignof_is_defined 1
31123115
#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))

libc-top-half/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ set(top_half_sources
282282
musl/src/time/__secs_to_tm.c
283283
musl/src/time/__tm_to_secs.c
284284
musl/src/time/__tz.c
285+
musl/src/time/__utc.c
285286
musl/src/time/__year_to_secs.c
286287
musl/src/time/asctime.c
287288
musl/src/time/asctime_r.c

libc-top-half/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@ Some major known missing areas include:
2323
- non-builtin locales
2424
- TIOCGWINSZ (because cloudabi lacks it; affects isatty, line buffering for stdout)
2525
- O\_CLOEXEC, O\_NOCTTY (because cloudabi lacks them)
26+
27+
## Updating Musl
28+
29+
The `libc-top-half/musl` directory is a `git subtree` for the upstream musl
30+
repository. Updating it can be done with:
31+
32+
```
33+
git subtree pull \
34+
--prefix libc-top-half/musl \
35+
https://git.musl-libc.org/git/musl v1.2.6 \
36+
--squash
37+
```
38+
39+
Resolve all conflicts and such that come about from the merge. Track deleted and
40+
updated files and update `libc-top-half/CMakeLists.txt` as appropriate.

libc-top-half/musl/COPYRIGHT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Kylie McClain
7474
Leah Neukirchen
7575
Luca Barbato
7676
Luka Perkov
77+
Lynn Ochs
7778
M Farkas-Dyck (Strake)
7879
Mahesh Bodapati
7980
Markus Wichmann
@@ -103,7 +104,6 @@ Stefan O'Rear
103104
Szabolcs Nagy
104105
Timo Teräs
105106
Trutz Behn
106-
Valentin Ochs
107107
Will Dietz
108108
William Haddon
109109
William Pitcock
@@ -143,7 +143,7 @@ domain. The code also comes with a fallback permissive license for use
143143
in jurisdictions that may not recognize the public domain.
144144

145145
The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
146-
Valentin Ochs and is licensed under an MIT-style license.
146+
Lynn Ochs and is licensed under an MIT-style license.
147147

148148
The x86_64 port was written by Nicholas J. Kain and is licensed under
149149
the standard MIT terms.

libc-top-half/musl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version
109109

110110
obj/crt/rcrt1.o obj/ldso/dlstart.lo obj/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h
111111

112-
obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h
112+
obj/crt/crt1.o obj/crt/Scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h
113113

114114
obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
115115

0 commit comments

Comments
 (0)