diff options
| author | Michael Forney <mforney@mforney.org> | 2021-07-08 22:00:18 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2021-07-12 22:23:42 -0700 |
| commit | 1033b686d00b5f545117bbfab3e3643e3f48a73c (patch) | |
| tree | 18c7cf7eb4685b29528fcea44a42fb4e3f1b34bd /pkg | |
| parent | 583d84863c517f3a0ccd25b84dd195f9f14cefed (diff) | |
musl: Use architecture-specific crt[in].s
This fixes .init so that gcc's crtbegin can call functions in .ctors.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/musl/gen.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/musl/gen.lua b/pkg/musl/gen.lua index f89fa3dc..b7821ada 100644 --- a/pkg/musl/gen.lua +++ b/pkg/musl/gen.lua @@ -116,9 +116,10 @@ for _, lib in ipairs{'libm.a', 'librt.a', 'libpthread.a', 'libcrypt.a', 'libutil end local startfiles = {'$outdir/libc.a'} -for _, obj in ipairs{'crt1.o', 'crti.o', 'crtn.o', 'rcrt1.o', 'Scrt1.o'} do +for _, src in ipairs{'crt1.c', 'rcrt1.c', 'Scrt1.c', arch..'/crti.s', arch..'/crtn.s'} do + local obj = src:gsub('.-(%w*)%.[cs]$', '%1.o') local out = '$outdir/'..obj - build('cc', out, {'$srcdir/crt/'..obj:gsub('%.o$', '.c'), '|', '$gendir/deps'}, {cflags='$cflags -D CRT $cflags_nossp'}) + build('cc', out, {'$srcdir/crt/'..src, '|', '$gendir/deps'}, {cflags='$cflags $cflags_nossp'}) file('lib/'..obj, '644', out) table.insert(startfiles, out) end |
