commit 713b8ab
Michael Forney
·
2026-05-05 07:48:14 +0000 UTC
parent a9f1ee5
musl: Use arch-specific crt list This will facilitate the addition of architectures like riscv64 which use the generic crti.c and crtn.c.
4 files changed,
+24,
-2
+5,
-0
1@@ -57,4 +57,9 @@ return {
2 'signal.h',
3 'user.h',
4 },
5+ crts={
6+ -- <cd src && printf "\t\t'%s',\n" crt/aarch64/*.[csS]
7+ 'crt/aarch64/crti.s',
8+ 'crt/aarch64/crtn.s',
9+ },
10 }
+8,
-0
1@@ -1575,4 +1575,12 @@ return {
2 'termios.h',
3 'vt.h',
4 },
5+ crts={
6+ -- <cd src && printf "\t\t'%s',\n" crt/*.c
7+ 'crt/Scrt1.c',
8+ 'crt/crt1.c',
9+ 'crt/crti.c',
10+ 'crt/crtn.c',
11+ 'crt/rcrt1.c',
12+ },
13 }
+6,
-2
1@@ -116,10 +116,14 @@ for _, lib in ipairs{'libm.a', 'librt.a', 'libpthread.a', 'libcrypt.a', 'libutil
2 end
3
4 local startfiles = {'$outdir/libc.a'}
5-for _, src in ipairs{'crt1.c', 'rcrt1.c', 'Scrt1.c', arch..'/crti.s', arch..'/crtn.s'} do
6+local crts = {}
7+for src in iterstrings{basefiles.crts, archfiles.crts} do
8+ crts[src:match('(.*)%.'):gsub('/'..arch..'/', '/', 1)] = src
9+end
10+for _, src in pairs(crts) do
11 local obj = src:gsub('.-(%w*)%.[cs]$', '%1.o')
12 local out = '$outdir/'..obj
13- build('cc', out, {'$srcdir/crt/'..src, '|', '$gendir/deps'}, {cflags='$cflags $cflags_nossp'})
14+ build('cc', out, {'$srcdir/'..src, '|', '$gendir/deps'}, {cflags='$cflags $cflags_nossp'})
15 file('lib/'..obj, '644', out)
16 table.insert(startfiles, out)
17 end
+5,
-0
1@@ -65,4 +65,9 @@ return {
2 'stat.h',
3 'user.h',
4 },
5+ crts={
6+ -- <cd src && printf "\t\t'%s',\n" crt/x86_64/*.[csS]
7+ 'crt/x86_64/crti.s',
8+ 'crt/x86_64/crtn.s',
9+ },
10 }