authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-11-23 23:50:36-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-11-23 23:50:36-05:00
loged8955cea6932aa34baf91224a63f3666319b08e
tree89dbf2dd0661180bf6ad1a0ba5fd4728ec9f0553
parent4aa6246345a5710b00a1f4f46f0f5a0046423ba7
parent67e524da54a934d6e14b1f02f954b16b7c2c5078
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #22049 from alexrp/musl-gen-stubs

`gen_stubs`: No compiler-rt hacks, more compact output, and more arch support

9 files changed, 388 insertions(+), 744 deletions(-)

lib/libc/musl/arch/i386/crt_arch.h+1
......@@ -3,6 +3,7 @@ __asm__(
33".weak _DYNAMIC \n"
44".hidden _DYNAMIC \n"
55".global " START "\n"
6".type " START ",%function \n"
67START ":\n"
78" xor %ebp,%ebp \n"
89" mov %esp,%eax \n"
lib/libc/musl/arch/x86_64/crt_arch.h+1
......@@ -1,6 +1,7 @@
11__asm__(
22".text \n"
33".global " START " \n"
4".type " START ",%function \n"
45START ": \n"
56" xor %rbp,%rbp \n"
67" mov %rsp,%rdi \n"
lib/libc/musl/libc.S+109-51
......@@ -7,6 +7,13 @@
77#define PTR_SIZE_BYTES 4
88#define PTR2_SIZE_BYTES 8
99#endif
10
11#ifdef TIME32
12#define WEAKTIME64 .globl
13#else
14#define WEAKTIME64 .weak
15#endif
16
1017.bss
1118.weak ___environ
1219.type ___environ, %object;
......@@ -168,18 +175,64 @@ _IO_putc:
168175.weak _IO_putc_unlocked
169176.type _IO_putc_unlocked, %function;
170177_IO_putc_unlocked:
171#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
178#ifdef ARCH_i386
172179.globl ___tls_get_addr
173180.type ___tls_get_addr, %function;
174181___tls_get_addr:
175182#endif
176#ifdef PTR32
183#ifdef TIME32
177184.globl __adjtime64
178185.type __adjtime64, %function;
179186__adjtime64:
180187.globl __adjtimex_time64
181188.type __adjtimex_time64, %function;
182189__adjtimex_time64:
190#endif
191#ifdef ARCH_arm
192.globl __aeabi_atexit
193.type __aeabi_atexit, %function;
194__aeabi_atexit:
195.globl __aeabi_memclr
196.type __aeabi_memclr, %function;
197__aeabi_memclr:
198.globl __aeabi_memclr4
199.type __aeabi_memclr4, %function;
200__aeabi_memclr4:
201.globl __aeabi_memclr8
202.type __aeabi_memclr8, %function;
203__aeabi_memclr8:
204.globl __aeabi_memcpy
205.type __aeabi_memcpy, %function;
206__aeabi_memcpy:
207.globl __aeabi_memcpy4
208.type __aeabi_memcpy4, %function;
209__aeabi_memcpy4:
210.globl __aeabi_memcpy8
211.type __aeabi_memcpy8, %function;
212__aeabi_memcpy8:
213.globl __aeabi_memmove
214.type __aeabi_memmove, %function;
215__aeabi_memmove:
216.globl __aeabi_memmove4
217.type __aeabi_memmove4, %function;
218__aeabi_memmove4:
219.globl __aeabi_memmove8
220.type __aeabi_memmove8, %function;
221__aeabi_memmove8:
222.globl __aeabi_memset
223.type __aeabi_memset, %function;
224__aeabi_memset:
225.globl __aeabi_memset4
226.type __aeabi_memset4, %function;
227__aeabi_memset4:
228.globl __aeabi_memset8
229.type __aeabi_memset8, %function;
230__aeabi_memset8:
231.globl __aeabi_read_tp
232.type __aeabi_read_tp, %function;
233__aeabi_read_tp:
234#endif
235#ifdef TIME32
183236.globl __aio_suspend_time64
184237.type __aio_suspend_time64, %function;
185238__aio_suspend_time64:
......@@ -187,12 +240,12 @@ __aio_suspend_time64:
187240.globl __assert_fail
188241.type __assert_fail, %function;
189242__assert_fail:
190#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
243#ifdef FAMILY_mips
191244.globl __cachectl
192245.type __cachectl, %function;
193246__cachectl:
194247#endif
195#ifdef PTR32
248#ifdef TIME32
196249.globl __clock_adjtime64
197250.type __clock_adjtime64, %function;
198251__clock_adjtime64:
......@@ -236,7 +289,7 @@ __cxa_atexit:
236289.globl __cxa_finalize
237290.type __cxa_finalize, %function;
238291__cxa_finalize:
239#ifdef PTR32
292#ifdef TIME32
240293.globl __difftime64
241294.type __difftime64, %function;
242295__difftime64:
......@@ -247,7 +300,12 @@ __dls2b:
247300.globl __dls3
248301.type __dls3, %function;
249302__dls3:
250#ifdef PTR32
303#ifdef FAMILY_mips
304.globl __dlstart
305.type __dlstart, %function;
306__dlstart:
307#endif
308#ifdef TIME32
251309.globl __dlsym_time64
252310.type __dlsym_time64, %function;
253311__dlsym_time64:
......@@ -312,7 +370,7 @@ __fseterr:
312370.globl __fsetlocking
313371.type __fsetlocking, %function;
314372__fsetlocking:
315#ifdef PTR32
373#ifdef TIME32
316374.weak __fstat_time64
317375.type __fstat_time64, %function;
318376__fstat_time64:
......@@ -347,7 +405,7 @@ __fxstatat:
347405.weak __getdelim
348406.type __getdelim, %function;
349407__getdelim:
350#ifdef PTR32
408#ifdef TIME32
351409.globl __getitimer_time64
352410.type __getitimer_time64, %function;
353411__getitimer_time64:
......@@ -364,6 +422,11 @@ __gmtime64:
364422.type __gmtime64_r, %function;
365423__gmtime64_r:
366424#endif
425#ifdef ARCH_arm
426.globl __gnu_Unwind_Find_exidx
427.type __gnu_Unwind_Find_exidx, %function;
428__gnu_Unwind_Find_exidx:
429#endif
367430.globl __h_errno_location
368431.type __h_errno_location, %function;
369432__h_errno_location:
......@@ -490,7 +553,7 @@ __libc_current_sigrtmin:
490553.globl __libc_start_main
491554.type __libc_start_main, %function;
492555__libc_start_main:
493#ifdef PTR32
556#ifdef TIME32
494557.globl __localtime64
495558.type __localtime64, %function;
496559__localtime64:
......@@ -498,12 +561,12 @@ __localtime64:
498561.type __localtime64_r, %function;
499562__localtime64_r:
500563#endif
501#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
564#ifdef FAMILY_riscv
502565.globl __longjmp
503566.type __longjmp, %function;
504567__longjmp:
505568#endif
506#ifdef PTR32
569#ifdef TIME32
507570.globl __lstat_time64
508571.type __lstat_time64, %function;
509572__lstat_time64:
......@@ -514,7 +577,7 @@ __lutimes_time64:
514577.globl __lxstat
515578.type __lxstat, %function;
516579__lxstat:
517#ifdef PTR32
580#ifdef TIME32
518581.globl __mktime64
519582.type __mktime64, %function;
520583__mktime64:
......@@ -547,7 +610,7 @@ __overflow:
547610.weak __posix_getopt
548611.type __posix_getopt, %function;
549612__posix_getopt:
550#ifdef PTR32
613#ifdef TIME32
551614.globl __ppoll_time64
552615.type __ppoll_time64, %function;
553616__ppoll_time64:
......@@ -576,17 +639,7 @@ __recvmmsg_time64:
576639.globl __res_state
577640.type __res_state, %function;
578641__res_state:
579#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
580.globl __restore
581.type __restore, %function;
582__restore:
583#endif
584#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
585.globl __restore_rt
586.type __restore_rt, %function;
587__restore_rt:
588#endif
589#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
642#ifdef FAMILY_riscv
590643.globl __riscv_flush_icache
591644.type __riscv_flush_icache, %function;
592645__riscv_flush_icache:
......@@ -594,7 +647,7 @@ __riscv_flush_icache:
594647.globl __sched_cpucount
595648.type __sched_cpucount, %function;
596649__sched_cpucount:
597#ifdef PTR32
650#ifdef TIME32
598651.globl __sched_rr_get_interval_time64
599652.type __sched_rr_get_interval_time64, %function;
600653__sched_rr_get_interval_time64:
......@@ -614,7 +667,7 @@ __setitimer_time64:
614667.globl __setjmp
615668.type __setjmp, %function;
616669__setjmp:
617#ifdef PTR32
670#ifdef TIME32
618671.globl __settimeofday_time64
619672.type __settimeofday_time64, %function;
620673__settimeofday_time64:
......@@ -631,7 +684,7 @@ __signbitl:
631684.globl __sigsetjmp
632685.type __sigsetjmp, %function;
633686__sigsetjmp:
634#ifdef PTR32
687#ifdef TIME32
635688.globl __sigtimedwait_time64
636689.type __sigtimedwait_time64, %function;
637690__sigtimedwait_time64:
......@@ -639,7 +692,7 @@ __sigtimedwait_time64:
639692.globl __stack_chk_fail
640693.type __stack_chk_fail, %function;
641694__stack_chk_fail:
642#ifdef PTR32
695#ifdef TIME32
643696.globl __stat_time64
644697.type __stat_time64, %function;
645698__stat_time64:
......@@ -692,7 +745,7 @@ __strxfrm_l:
692745.weak __sysv_signal
693746.type __sysv_signal, %function;
694747__sysv_signal:
695#ifdef PTR32
748#ifdef TIME32
696749.globl __thrd_sleep_time64
697750.type __thrd_sleep_time64, %function;
698751__thrd_sleep_time64:
......@@ -718,9 +771,16 @@ __timerfd_settime64:
718771.type __timespec_get_time64, %function;
719772__timespec_get_time64:
720773#endif
774#if !defined(ARCH_s390x)
721775.globl __tls_get_addr
722776.type __tls_get_addr, %function;
723777__tls_get_addr:
778#endif
779#ifdef ARCH_s390x
780.globl __tls_get_offset
781.type __tls_get_offset, %function;
782__tls_get_offset:
783#endif
724784.globl __tolower_l
725785.type __tolower_l, %function;
726786__tolower_l:
......@@ -743,7 +803,7 @@ __uflow:
743803.globl __uselocale
744804.type __uselocale, %function;
745805__uselocale:
746#ifdef PTR32
806#ifdef TIME32
747807.globl __utime64
748808.type __utime64, %function;
749809__utime64:
......@@ -796,7 +856,7 @@ _dl_debug_state:
796856.globl _dlstart
797857.type _dlstart, %function;
798858_dlstart:
799#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
859#ifdef FAMILY_mips
800860.globl _dlstart_data
801861.type _dlstart_data, %function;
802862_dlstart_data:
......@@ -807,7 +867,7 @@ _exit:
807867.weak _fini
808868.type _fini, %function;
809869_fini:
810#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
870#ifdef FAMILY_mips
811871.globl _flush_cache
812872.type _flush_cache, %function;
813873_flush_cache:
......@@ -908,7 +968,7 @@ aligned_alloc:
908968.globl alphasort
909969.type alphasort, %function;
910970alphasort:
911#if !defined(ARCH_riscv64) && !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
971#ifdef FAMILY_x86
912972.globl arch_prctl
913973.type arch_prctl, %function;
914974arch_prctl:
......@@ -1033,12 +1093,10 @@ cabsf:
10331093.globl cabsl
10341094.type cabsl, %function;
10351095cabsl:
1036#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
1096#ifdef FAMILY_mips
10371097.weak cachectl
10381098.type cachectl, %function;
10391099cachectl:
1040#endif
1041#if !defined(ARCH_riscv64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
10421100.weak cacheflush
10431101.type cacheflush, %function;
10441102cacheflush:
......@@ -1232,10 +1290,10 @@ clock_getcpuclockid:
12321290.globl clock_getres
12331291.type clock_getres, %function;
12341292clock_getres:
1235WEAK64 clock_gettime
1293WEAKTIME64 clock_gettime
12361294.type clock_gettime, %function;
12371295clock_gettime:
1238WEAK64 clock_nanosleep
1296WEAKTIME64 clock_nanosleep
12391297.type clock_nanosleep, %function;
12401298clock_nanosleep:
12411299.globl clock_settime
......@@ -2018,10 +2076,10 @@ fsetpos:
20182076.globl fsetxattr
20192077.type fsetxattr, %function;
20202078fsetxattr:
2021WEAK64 fstat
2079WEAKTIME64 fstat
20222080.type fstat, %function;
20232081fstat:
2024WEAK64 fstatat
2082WEAKTIME64 fstatat
20252083.type fstatat, %function;
20262084fstatat:
20272085.weak fstatfs
......@@ -2063,7 +2121,7 @@ futimens:
20632121.globl futimes
20642122.type futimes, %function;
20652123futimes:
2066WEAK64 futimesat
2124WEAKTIME64 futimesat
20672125.type futimesat, %function;
20682126futimesat:
20692127.globl fwide
......@@ -2408,7 +2466,7 @@ globfree:
24082466.globl gmtime
24092467.type gmtime, %function;
24102468gmtime:
2411WEAK64 gmtime_r
2469WEAKTIME64 gmtime_r
24122470.type gmtime_r, %function;
24132471gmtime_r:
24142472.globl grantpt
......@@ -2549,12 +2607,12 @@ insque:
25492607.globl ioctl
25502608.type ioctl, %function;
25512609ioctl:
2552#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
2610#if !defined(ARCH_aarch64) && !defined(ARCH_arm) && !defined(ARCH_loongarch64) && !defined(ARCH_mips64) && !defined(ARCH_mipsn32) && !defined(ARCH_riscv32) && !defined(ARCH_riscv64) && !defined(ARCH_s390x)
25532611.globl ioperm
25542612.type ioperm, %function;
25552613ioperm:
25562614#endif
2557#if !defined(ARCH_riscv64) && !defined(ARCH_mips64) && !defined(ARCH_aarch64) && !defined(ARCH_riscv32) && !defined(ARCH_loongarch64)
2615#if !defined(ARCH_aarch64) && !defined(ARCH_arm) && !defined(ARCH_loongarch64) && !defined(ARCH_mips64) && !defined(ARCH_mipsn32) && !defined(ARCH_riscv32) && !defined(ARCH_riscv64) && !defined(ARCH_s390x)
25582616.globl iopl
25592617.type iopl, %function;
25602618iopl:
......@@ -2853,7 +2911,7 @@ localeconv:
28532911.globl localtime
28542912.type localtime, %function;
28552913localtime:
2856WEAK64 localtime_r
2914WEAKTIME64 localtime_r
28572915.type localtime_r, %function;
28582916localtime_r:
28592917.globl lockf
......@@ -3552,7 +3610,7 @@ pthread_cond_init:
35523610.globl pthread_cond_signal
35533611.type pthread_cond_signal, %function;
35543612pthread_cond_signal:
3555WEAK64 pthread_cond_timedwait
3613WEAKTIME64 pthread_cond_timedwait
35563614.type pthread_cond_timedwait, %function;
35573615pthread_cond_timedwait:
35583616.globl pthread_cond_wait
......@@ -3642,7 +3700,7 @@ pthread_mutex_lock:
36423700.globl pthread_mutex_setprioceiling
36433701.type pthread_mutex_setprioceiling, %function;
36443702pthread_mutex_setprioceiling:
3645WEAK64 pthread_mutex_timedlock
3703WEAKTIME64 pthread_mutex_timedlock
36463704.type pthread_mutex_timedlock, %function;
36473705pthread_mutex_timedlock:
36483706.weak pthread_mutex_trylock
......@@ -3693,10 +3751,10 @@ pthread_rwlock_init:
36933751.weak pthread_rwlock_rdlock
36943752.type pthread_rwlock_rdlock, %function;
36953753pthread_rwlock_rdlock:
3696WEAK64 pthread_rwlock_timedrdlock
3754WEAKTIME64 pthread_rwlock_timedrdlock
36973755.type pthread_rwlock_timedrdlock, %function;
36983756pthread_rwlock_timedrdlock:
3699WEAK64 pthread_rwlock_timedwrlock
3757WEAKTIME64 pthread_rwlock_timedwrlock
37003758.type pthread_rwlock_timedwrlock, %function;
37013759pthread_rwlock_timedwrlock:
37023760.weak pthread_rwlock_tryrdlock
......@@ -3774,7 +3832,7 @@ pthread_spin_unlock:
37743832.weak pthread_testcancel
37753833.type pthread_testcancel, %function;
37763834pthread_testcancel:
3777WEAK64 pthread_timedjoin_np
3835WEAKTIME64 pthread_timedjoin_np
37783836.type pthread_timedjoin_np, %function;
37793837pthread_timedjoin_np:
37803838.weak pthread_tryjoin_np
......@@ -3999,7 +4057,7 @@ rintf:
39994057.globl rintl
40004058.type rintl, %function;
40014059rintl:
4002#if !defined(ARCH_mips) && !defined(ARCH_mips64) && !defined(ARCH_x86) && !defined(ARCH_x86_64) && !defined(ARCH_powerpc) && !defined(ARCH_powerpc64) && !defined(ARCH_aarch64) && !defined(ARCH_loongarch64)
4060#ifdef FAMILY_riscv
40034061.weak riscv_flush_icache
40044062.type riscv_flush_icache, %function;
40054063riscv_flush_icache:
lib/libc/musl/src/signal/riscv32/restore.s+2
......@@ -1,7 +1,9 @@
11.global __restore
2.hidden __restore
23.type __restore, %function
34__restore:
45.global __restore_rt
6.hidden __restore_rt
57.type __restore_rt, %function
68__restore_rt:
79 li a7, 139 # SYS_rt_sigreturn
lib/libc/musl/src/signal/riscv64/restore.s+2
......@@ -1,7 +1,9 @@
11.global __restore
2.hidden __restore
23.type __restore, %function
34__restore:
45.global __restore_rt
6.hidden __restore_rt
57.type __restore_rt, %function
68__restore_rt:
79 li a7, 139 # SYS_rt_sigreturn
lib/libc/musl/src/thread/s390x/__tls_get_offset.s+1
......@@ -5,6 +5,7 @@ __tls_get_offset:
55 aghi %r15, -160
66
77 la %r2, 0(%r2, %r12)
8.hidden __tls_get_addr
89 brasl %r14, __tls_get_addr
910
1011 ear %r1, %a0
src/Compilation.zig+3-1
......@@ -5884,7 +5884,9 @@ pub const FileExt = enum {
58845884};
58855885
58865886pub fn hasObjectExt(filename: []const u8) bool {
5887 return mem.endsWith(u8, filename, ".o") or mem.endsWith(u8, filename, ".obj");
5887 return mem.endsWith(u8, filename, ".o") or
5888 mem.endsWith(u8, filename, ".lo") or
5889 mem.endsWith(u8, filename, ".obj");
58885890}
58895891
58905892pub fn hasStaticLibraryExt(filename: []const u8) bool {
src/musl.zig+33-16
......@@ -138,17 +138,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
138138 try addSrcFile(arena, &source_table, src_file);
139139 }
140140
141 const time32_compat_arch_list = [_][]const u8{
142 "arm",
143 "i386",
144 "m68k",
145 "microblaze",
146 "mips",
147 "mipsn32",
148 "or1k",
149 "powerpc",
150 "sh",
151 };
152141 for (time32_compat_arch_list) |time32_compat_arch| {
153142 if (mem.eql(u8, arch_name, time32_compat_arch)) {
154143 for (compat_time32_files) |compat_time32_file| {
......@@ -239,13 +228,29 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
239228 });
240229
241230 const target = comp.root_mod.resolved_target.result;
242 const arch_define = try std.fmt.allocPrint(arena, "-DARCH_{s}", .{
243 @tagName(target.cpu.arch),
244 });
231 const arch_name = std.zig.target.muslArchName(target.cpu.arch, target.abi);
232 const time32 = for (time32_compat_arch_list) |time32_compat_arch| {
233 if (mem.eql(u8, arch_name, time32_compat_arch)) break true;
234 } else false;
235 const arch_define = try std.fmt.allocPrint(arena, "-DARCH_{s}", .{arch_name});
236 const family_define = switch (target.cpu.arch) {
237 .arm, .armeb, .thumb, .thumbeb => "-DFAMILY_arm",
238 .aarch64, .aarch64_be => "-DFAMILY_aarch64",
239 .loongarch64 => "-DFAMILY_loongarch",
240 .m68k => "-DFAMILY_m68k",
241 .mips, .mipsel, .mips64, .mips64el => "-DFAMILY_mips",
242 .powerpc, .powerpc64, .powerpc64le => "-DFAMILY_powerpc",
243 .riscv32, .riscv64 => "-DFAMILY_riscv",
244 .s390x => "-DFAMILY_s390x",
245 .x86, .x86_64 => "-DFAMILY_x86",
246 else => unreachable,
247 };
245248 const cc_argv: []const []const u8 = if (target.ptrBitWidth() == 64)
246 &.{ "-DPTR64", arch_define }
249 &.{ "-DPTR64", arch_define, family_define }
250 else if (time32)
251 &.{ "-DTIME32", arch_define, family_define }
247252 else
248 &.{arch_define};
253 &.{ arch_define, family_define };
249254
250255 const root_mod = try Module.create(arena, .{
251256 .global_cache_directory = comp.global_cache_directory,
......@@ -347,6 +352,18 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.Lin
347352 };
348353}
349354
355const time32_compat_arch_list = [_][]const u8{
356 "arm",
357 "i386",
358 "m68k",
359 "microblaze",
360 "mips",
361 "mipsn32",
362 "or1k",
363 "powerpc",
364 "sh",
365};
366
350367fn isArchName(name: []const u8) bool {
351368 const musl_arch_names = [_][]const u8{
352369 "aarch64",
tools/gen_stubs.zig+236-676
......@@ -2,23 +2,51 @@
22//! ./gen_stubs /path/to/musl/build-all >libc.S
33//!
44//! The directory 'build-all' is expected to contain these subdirectories:
5//! arm x86 mips mips64 powerpc powerpc64 riscv32 riscv64 x86_64 loongarch64
5//!
6//! * aarch64
7//! * arm
8//! * i386
9//! * loongarch64
10//! * mips
11//! * mips64
12//! * mipsn32
13//! * powerpc
14//! * powerpc64
15//! * riscv32
16//! * riscv64
17//! * s390x
18//! * x32 (currently broken)
19//! * x86_64
620//!
721//! ...each with 'lib/libc.so' inside of them.
822//!
923//! When building the resulting libc.S file, these defines are required:
10//! * `-DPTR64`: when the architecture is 64-bit
24//! * `-DTIME32`: When the target's primary time ABI is 32-bit
25//! * `-DPTR64`: When the target has 64-bit pointers
1126//! * One of the following, corresponding to the CPU architecture:
12//! - `-DARCH_riscv32`
13//! - `-DARCH_riscv64`
27//! - `-DARCH_aarch64`
28//! - `-DARCH_arm`
29//! - `-DARCH_i386`
30//! - `-DARCH_loongarch64`
1431//! - `-DARCH_mips`
1532//! - `-DARCH_mips64`
16//! - `-DARCH_i386`
17//! - `-DARCH_x86_64`
33//! - `-DARCH_mipsn32`
1834//! - `-DARCH_powerpc`
1935//! - `-DARCH_powerpc64`
20//! - `-DARCH_aarch64`
21//! - `-DARCH_loongarch64`
36//! - `-DARCH_riscv32`
37//! - `-DARCH_riscv64`
38//! - `-DARCH_s390x`
39//! - `-DARCH_x32`
40//! - `-DARCH_x86_64`
41//! * One of the following, corresponding to the CPU architecture family:
42//! - `-DFAMILY_aarch64`
43//! - `-DFAMILY_arm`
44//! - `-DFAMILY_loongarch`
45//! - `-DFAMILY_mips`
46//! - `-DFAMILY_powerpc`
47//! - `-DFAMILY_riscv`
48//! - `-DFAMILY_s390x`
49//! - `-DFAMILY_x86`
2250
2351// TODO: pick the best index to put them into instead of at the end
2452// - e.g. find a common previous symbol and put it after that one
......@@ -29,24 +57,85 @@ const builtin = std.builtin;
2957const mem = std.mem;
3058const log = std.log;
3159const elf = std.elf;
32const native_endian = @import("builtin").target.cpu.arch.endian();
33
34const inputs = .{
35 .riscv32,
36 .riscv64,
37 .loongarch64,
38 .mips,
39 .mips64,
40 .x86,
41 .x86_64,
42 .powerpc,
43 .powerpc64,
44 .aarch64,
60const native_endian = @import("builtin").cpu.arch.endian();
61
62const Arch = enum {
63 aarch64,
64 arm,
65 i386,
66 loongarch64,
67 mips,
68 mips64,
69 mipsn32,
70 powerpc,
71 powerpc64,
72 riscv32,
73 riscv64,
74 s390x,
75 x86_64,
76
77 pub fn ptrSize(arch: Arch) u16 {
78 return switch (arch) {
79 .arm,
80 .i386,
81 .mips,
82 .mipsn32,
83 .powerpc,
84 .riscv32,
85 => 4,
86 .aarch64,
87 .loongarch64,
88 .mips64,
89 .powerpc64,
90 .riscv64,
91 .s390x,
92 .x86_64,
93 => 8,
94 };
95 }
96
97 pub fn isTime32(arch: Arch) bool {
98 return switch (arch) {
99 // This list will never grow; newer 32-bit ports will be time64 (e.g. riscv32).
100 .arm,
101 .i386,
102 .mips,
103 .mipsn32,
104 .powerpc,
105 => true,
106 else => false,
107 };
108 }
109
110 pub fn family(arch: Arch) Family {
111 return switch (arch) {
112 .aarch64 => .aarch64,
113 .arm => .arm,
114 .i386, .x86_64 => .x86,
115 .loongarch64 => .loongarch,
116 .mips, .mips64, .mipsn32 => .mips,
117 .powerpc, .powerpc64 => .powerpc,
118 .riscv32, .riscv64 => .riscv,
119 .s390x => .s390x,
120 };
121 }
122};
123
124const Family = enum {
125 aarch64,
126 arm,
127 loongarch,
128 mips,
129 powerpc,
130 riscv,
131 s390x,
132 x86,
45133};
46134
47const arches: [inputs.len]std.Target.Cpu.Arch = blk: {
48 var result: [inputs.len]std.Target.Cpu.Arch = undefined;
49 for (inputs) |arch| {
135const arches: [@typeInfo(Arch).@"enum".fields.len]Arch = blk: {
136 var result: [@typeInfo(Arch).@"enum".fields.len]Arch = undefined;
137 for (@typeInfo(Arch).@"enum".fields) |field| {
138 const arch: Arch = @enumFromInt(field.value);
50139 result[archIndex(arch)] = arch;
51140 }
52141 break :blk result;
......@@ -60,6 +149,31 @@ const MultiSym = struct {
60149 ty: u4,
61150 visib: elf.STV,
62151
152 fn isSingleArch(ms: MultiSym) ?Arch {
153 var result: ?Arch = null;
154 inline for (@typeInfo(Arch).@"enum".fields) |field| {
155 const arch: Arch = @enumFromInt(field.value);
156 if (ms.present[archIndex(arch)]) {
157 if (result != null) return null;
158 result = arch;
159 }
160 }
161 return result;
162 }
163
164 fn isFamily(ms: MultiSym) ?Family {
165 var result: ?Family = null;
166 inline for (@typeInfo(Arch).@"enum".fields) |field| {
167 const arch: Arch = @enumFromInt(field.value);
168 if (ms.present[archIndex(arch)]) {
169 const family = arch.family();
170 if (result) |r| if (family != r) return null;
171 result = family;
172 }
173 }
174 return result;
175 }
176
63177 fn allPresent(ms: MultiSym) bool {
64178 for (arches, 0..) |_, i| {
65179 if (!ms.present[i]) {
......@@ -69,17 +183,14 @@ const MultiSym = struct {
69183 return true;
70184 }
71185
72 fn is32Only(ms: MultiSym) bool {
73 return ms.present[archIndex(.riscv32)] == true and
74 ms.present[archIndex(.riscv64)] == false and
75 ms.present[archIndex(.mips)] == true and
76 ms.present[archIndex(.mips64)] == false and
77 ms.present[archIndex(.x86)] == true and
78 ms.present[archIndex(.x86_64)] == false and
79 ms.present[archIndex(.powerpc)] == true and
80 ms.present[archIndex(.powerpc64)] == false and
81 ms.present[archIndex(.aarch64)] == false and
82 ms.present[archIndex(.loongarch64)] == false;
186 fn isTime32Only(ms: MultiSym) bool {
187 inline for (@typeInfo(Arch).@"enum".fields) |field| {
188 const arch: Arch = @enumFromInt(field.value);
189 if (ms.present[archIndex(arch)] != arch.isTime32()) {
190 return false;
191 }
192 }
193 return true;
83194 }
84195
85196 fn commonSize(ms: MultiSym) ?u64 {
......@@ -112,71 +223,38 @@ const MultiSym = struct {
112223 return binding.?;
113224 }
114225
115 fn isPtrSize(ms: MultiSym) bool {
116 const map = .{
117 .{ .riscv32, 4 },
118 .{ .riscv64, 8 },
119 .{ .mips, 4 },
120 .{ .mips64, 8 },
121 .{ .x86, 4 },
122 .{ .x86_64, 8 },
123 .{ .powerpc, 4 },
124 .{ .powerpc64, 8 },
125 .{ .aarch64, 8 },
126 .{ .loongarch64, 8 },
127 };
128 inline for (map) |item| {
129 const arch = item[0];
130 const size = item[1];
226 fn isPtrSize(ms: MultiSym, mult: u16) bool {
227 inline for (@typeInfo(Arch).@"enum".fields) |field| {
228 const arch: Arch = @enumFromInt(field.value);
131229 const arch_index = archIndex(arch);
132 if (ms.present[arch_index] and ms.size[arch_index] != size) {
230 if (ms.present[arch_index] and ms.size[arch_index] != arch.ptrSize() * mult) {
133231 return false;
134232 }
135233 }
136234 return true;
137235 }
138236
139 fn isPtr2Size(ms: MultiSym) bool {
140 const map = .{
141 .{ .riscv32, 8 },
142 .{ .riscv64, 16 },
143 .{ .mips, 8 },
144 .{ .mips64, 16 },
145 .{ .x86, 8 },
146 .{ .x86_64, 16 },
147 .{ .powerpc, 8 },
148 .{ .powerpc64, 16 },
149 .{ .aarch64, 16 },
150 .{ .loongarch64, 16 },
151 };
152 inline for (map) |item| {
153 const arch = item[0];
154 const size = item[1];
237 fn isWeak64(ms: MultiSym) bool {
238 inline for (@typeInfo(Arch).@"enum".fields) |field| {
239 const arch: Arch = @enumFromInt(field.value);
155240 const arch_index = archIndex(arch);
156 if (ms.present[arch_index] and ms.size[arch_index] != size) {
241 const binding: u4 = switch (arch.ptrSize()) {
242 4 => std.elf.STB_GLOBAL,
243 8 => std.elf.STB_WEAK,
244 else => unreachable,
245 };
246 if (ms.present[arch_index] and ms.binding[arch_index] != binding) {
157247 return false;
158248 }
159249 }
160250 return true;
161251 }
162252
163 fn isWeak64(ms: MultiSym) bool {
164 const map = .{
165 .{ .riscv32, 1 },
166 .{ .riscv64, 2 },
167 .{ .mips, 1 },
168 .{ .mips64, 2 },
169 .{ .x86, 1 },
170 .{ .x86_64, 2 },
171 .{ .powerpc, 1 },
172 .{ .powerpc64, 2 },
173 .{ .aarch64, 2 },
174 .{ .loongarch64, 2 },
175 };
176 inline for (map) |item| {
177 const arch = item[0];
178 const binding = item[1];
253 fn isWeakTime64(ms: MultiSym) bool {
254 inline for (@typeInfo(Arch).@"enum".fields) |field| {
255 const arch: Arch = @enumFromInt(field.value);
179256 const arch_index = archIndex(arch);
257 const binding: u4 = if (arch.isTime32()) std.elf.STB_GLOBAL else std.elf.STB_WEAK;
180258 if (ms.present[arch_index] and ms.binding[arch_index] != binding) {
181259 return false;
182260 }
......@@ -189,10 +267,9 @@ const Parse = struct {
189267 arena: mem.Allocator,
190268 sym_table: *std.StringArrayHashMap(MultiSym),
191269 sections: *std.StringArrayHashMap(void),
192 blacklist: std.StringArrayHashMap(void),
193270 elf_bytes: []align(@alignOf(elf.Elf64_Ehdr)) u8,
194271 header: elf.Header,
195 arch: std.Target.Cpu.Arch,
272 arch: Arch,
196273};
197274
198275pub fn main() !void {
......@@ -207,16 +284,10 @@ pub fn main() !void {
207284
208285 var sym_table = std.StringArrayHashMap(MultiSym).init(arena);
209286 var sections = std.StringArrayHashMap(void).init(arena);
210 var blacklist = std.StringArrayHashMap(void).init(arena);
211
212 try blacklist.ensureUnusedCapacity(blacklisted_symbols.len);
213 for (blacklisted_symbols) |name| {
214 blacklist.putAssumeCapacityNoClobber(name, {});
215 }
216287
217288 for (arches) |arch| {
218289 const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{
219 archMuslName(arch),
290 @tagName(arch),
220291 });
221292
222293 // Read the ELF header.
......@@ -238,7 +309,6 @@ pub fn main() !void {
238309 .arena = arena,
239310 .sym_table = &sym_table,
240311 .sections = &sections,
241 .blacklist = blacklist,
242312 .elf_bytes = elf_bytes,
243313 .header = header,
244314 .arch = arch,
......@@ -268,6 +338,13 @@ pub fn main() !void {
268338 \\#define PTR2_SIZE_BYTES 8
269339 \\#endif
270340 \\
341 \\#ifdef TIME32
342 \\#define WEAKTIME64 .globl
343 \\#else
344 \\#define WEAKTIME64 .weak
345 \\#endif
346 \\
347 \\
271348 );
272349
273350 // Sort the symbols for deterministic output and cleaner vcs diffs.
......@@ -301,7 +378,7 @@ pub fn main() !void {
301378 sym_table.sort(SymTableSort{ .sym_table = &sym_table, .sections = &sections });
302379
303380 var prev_section: u16 = std.math.maxInt(u16);
304 var prev_pp_state: enum { none, ptr32, special } = .none;
381 var prev_pp_state: union(enum) { all, single: Arch, multi, family: Family, time32 } = .all;
305382 for (sym_table.values(), 0..) |multi_sym, sym_index| {
306383 const name = sym_table.keys()[sym_index];
307384
......@@ -313,32 +390,66 @@ pub fn main() !void {
313390
314391 if (multi_sym.allPresent()) {
315392 switch (prev_pp_state) {
316 .none => {},
317 .ptr32, .special => {
393 .all => {},
394 .single, .multi, .family, .time32 => {
318395 try stdout.writeAll("#endif\n");
319 prev_pp_state = .none;
396 prev_pp_state = .all;
320397 },
321398 }
322 } else if (multi_sym.is32Only()) {
399 } else if (multi_sym.isSingleArch()) |arch| {
323400 switch (prev_pp_state) {
324 .none => {
325 try stdout.writeAll("#ifdef PTR32\n");
326 prev_pp_state = .ptr32;
401 .all => {
402 try stdout.print("#ifdef ARCH_{s}\n", .{@tagName(arch)});
403 prev_pp_state = .{ .single = arch };
327404 },
328 .special => {
329 try stdout.writeAll("#endif\n#ifdef PTR32\n");
330 prev_pp_state = .ptr32;
405 .multi, .family, .time32 => {
406 try stdout.print("#endif\n#ifdef ARCH_{s}\n", .{@tagName(arch)});
407 prev_pp_state = .{ .single = arch };
408 },
409 .single => |prev_arch| {
410 if (arch != prev_arch) {
411 try stdout.print("#endif\n#ifdef ARCH_{s}\n", .{@tagName(arch)});
412 prev_pp_state = .{ .single = arch };
413 }
331414 },
332 .ptr32 => {},
415 }
416 } else if (multi_sym.isFamily()) |family| {
417 switch (prev_pp_state) {
418 .all => {
419 try stdout.print("#ifdef FAMILY_{s}\n", .{@tagName(family)});
420 prev_pp_state = .{ .family = family };
421 },
422 .single, .multi, .time32 => {
423 try stdout.print("#endif\n#ifdef FAMILY_{s}\n", .{@tagName(family)});
424 prev_pp_state = .{ .family = family };
425 },
426 .family => |prev_family| {
427 if (family != prev_family) {
428 try stdout.print("#endif\n#ifdef FAMILY_{s}\n", .{@tagName(family)});
429 prev_pp_state = .{ .family = family };
430 }
431 },
432 }
433 } else if (multi_sym.isTime32Only()) {
434 switch (prev_pp_state) {
435 .all => {
436 try stdout.writeAll("#ifdef TIME32\n");
437 prev_pp_state = .time32;
438 },
439 .single, .multi, .family => {
440 try stdout.writeAll("#endif\n#ifdef TIME32\n");
441 prev_pp_state = .time32;
442 },
443 .time32 => {},
333444 }
334445 } else {
335446 switch (prev_pp_state) {
336 .none => {},
337 .special, .ptr32 => {
447 .all => {},
448 .single, .multi, .family, .time32 => {
338449 try stdout.writeAll("#endif\n");
339450 },
340451 }
341 prev_pp_state = .special;
452 prev_pp_state = .multi;
342453
343454 var first = true;
344455 try stdout.writeAll("#if ");
......@@ -366,6 +477,8 @@ pub fn main() !void {
366477 }
367478 } else if (multi_sym.isWeak64()) {
368479 try stdout.print("WEAK64 {s}\n", .{name});
480 } else if (multi_sym.isWeakTime64()) {
481 try stdout.print("WEAKTIME64 {s}\n", .{name});
369482 } else {
370483 for (arches, 0..) |arch, i| {
371484 log.info("symbol '{s}' binding on {s}: {d}", .{
......@@ -384,9 +497,9 @@ pub fn main() !void {
384497 try stdout.print(".type {s}, %object;\n", .{name});
385498 if (multi_sym.commonSize()) |size| {
386499 try stdout.print(".size {s}, {d}\n", .{ name, size });
387 } else if (multi_sym.isPtrSize()) {
500 } else if (multi_sym.isPtrSize(1)) {
388501 try stdout.print(".size {s}, PTR_SIZE_BYTES\n", .{name});
389 } else if (multi_sym.isPtr2Size()) {
502 } else if (multi_sym.isPtrSize(2)) {
390503 try stdout.print(".size {s}, PTR2_SIZE_BYTES\n", .{name});
391504 } else {
392505 for (arches, 0..) |arch, i| {
......@@ -410,8 +523,8 @@ pub fn main() !void {
410523 }
411524
412525 switch (prev_pp_state) {
413 .none => {},
414 .ptr32, .special => try stdout.writeAll("#endif\n"),
526 .all => {},
527 .single, .multi, .family, .time32 => try stdout.writeAll("#endif\n"),
415528 }
416529}
417530
......@@ -487,12 +600,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
487600 const visib = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));
488601 const size = s(sym.st_size);
489602
490 if (parse.blacklist.contains(name)) continue;
491
492603 if (size == 0) {
493604 log.warn("{s}: symbol '{s}' has size 0", .{ @tagName(parse.arch), name });
494605 }
495606
607 if (sym.st_shndx == elf.SHN_UNDEF) {
608 log.debug("{s}: skipping '{s}' due to it being undefined", .{
609 @tagName(parse.arch), name,
610 });
611 continue;
612 }
613
496614 switch (binding) {
497615 elf.STB_GLOBAL, elf.STB_WEAK => {},
498616 else => {
......@@ -590,40 +708,8 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
590708 }
591709}
592710
593fn archIndex(arch: std.Target.Cpu.Arch) u8 {
594 return switch (arch) {
595 // zig fmt: off
596 .riscv64 => 0,
597 .mips => 1,
598 .mips64 => 2,
599 .x86 => 3,
600 .x86_64 => 4,
601 .powerpc => 5,
602 .powerpc64 => 6,
603 .aarch64 => 7,
604 .riscv32 => 8,
605 .loongarch64 => 9,
606 else => unreachable,
607 // zig fmt: on
608 };
609}
610
611fn archMuslName(arch: std.Target.Cpu.Arch) []const u8 {
612 return switch (arch) {
613 // zig fmt: off
614 .riscv64 => "riscv64",
615 .mips => "mips",
616 .mips64 => "mips64",
617 .x86 => "i386",
618 .x86_64 => "x86_64",
619 .powerpc => "powerpc",
620 .powerpc64 => "powerpc64",
621 .aarch64 => "aarch64",
622 .riscv32 => "riscv32",
623 .loongarch64 => "loongarch64",
624 else => unreachable,
625 // zig fmt: on
626 };
711fn archIndex(arch: Arch) u8 {
712 return @intFromEnum(arch);
627713}
628714
629715fn archSetName(arch_set: [arches.len]bool) []const u8 {
......@@ -639,529 +725,3 @@ fn fatal(comptime format: []const u8, args: anytype) noreturn {
639725 log.err(format, args);
640726 std.process.exit(1);
641727}
642
643const blacklisted_symbols = [_][]const u8{
644 "__absvdi2",
645 "__absvsi2",
646 "__absvti2",
647 "__adddf3",
648 "__addkf3",
649 "__addodi4",
650 "__addosi4",
651 "__addoti4",
652 "__addsf3",
653 "__addtf3",
654 "__addxf3",
655 "__ashldi3",
656 "__ashlsi3",
657 "__ashlti3",
658 "__ashrdi3",
659 "__ashrsi3",
660 "__ashrti3",
661 "__atomic_compare_exchange",
662 "__atomic_compare_exchange_1",
663 "__atomic_compare_exchange_2",
664 "__atomic_compare_exchange_4",
665 "__atomic_compare_exchange_8",
666 "__atomic_exchange",
667 "__atomic_exchange_1",
668 "__atomic_exchange_2",
669 "__atomic_exchange_4",
670 "__atomic_exchange_8",
671 "__atomic_fetch_add_1",
672 "__atomic_fetch_add_2",
673 "__atomic_fetch_add_4",
674 "__atomic_fetch_add_8",
675 "__atomic_fetch_and_1",
676 "__atomic_fetch_and_2",
677 "__atomic_fetch_and_4",
678 "__atomic_fetch_and_8",
679 "__atomic_fetch_nand_1",
680 "__atomic_fetch_nand_2",
681 "__atomic_fetch_nand_4",
682 "__atomic_fetch_nand_8",
683 "__atomic_fetch_or_1",
684 "__atomic_fetch_or_2",
685 "__atomic_fetch_or_4",
686 "__atomic_fetch_or_8",
687 "__atomic_fetch_sub_1",
688 "__atomic_fetch_sub_2",
689 "__atomic_fetch_sub_4",
690 "__atomic_fetch_sub_8",
691 "__atomic_fetch_xor_1",
692 "__atomic_fetch_xor_2",
693 "__atomic_fetch_xor_4",
694 "__atomic_fetch_xor_8",
695 "__atomic_load",
696 "__atomic_load_1",
697 "__atomic_load_2",
698 "__atomic_load_4",
699 "__atomic_load_8",
700 "__atomic_store",
701 "__atomic_store_1",
702 "__atomic_store_2",
703 "__atomic_store_4",
704 "__atomic_store_8",
705 "__bswapdi2",
706 "__bswapsi2",
707 "__bswapti2",
708 "__ceilh",
709 "__ceilx",
710 "__clear_cache",
711 "__clzdi2",
712 "__chk_fail",
713 "__clzsi2",
714 "__clzti2",
715 "__cmpdf2",
716 "__cmpdi2",
717 "__cmpsf2",
718 "__cmpsi2",
719 "__cmptf2",
720 "__cmpti2",
721 "__cosh",
722 "__cosx",
723 "__ctzdi2",
724 "__ctzsi2",
725 "__ctzti2",
726 "__divdf3",
727 "__divdi3",
728 "__divkf3",
729 "__divmoddi4",
730 "__divmodsi4",
731 "__divmodti4",
732 "__divsf3",
733 "__divsi3",
734 "__divtf3",
735 "__divti3",
736 "__divxf3",
737 "__dlstart",
738 "__eqdf2",
739 "__eqkf2",
740 "__eqsf2",
741 "__eqtf2",
742 "__eqxf2",
743 "__exp2h",
744 "__exp2x",
745 "__exph",
746 "__expx",
747 "__extenddfkf2",
748 "__extenddftf2",
749 "__extenddfxf2",
750 "__extendhfsf2",
751 "__extendhftf2",
752 "__extendhfxf2",
753 "__extendsfdf2",
754 "__extendsfkf2",
755 "__extendsftf2",
756 "__extendsfxf2",
757 "__extendxftf2",
758 "__fabsh",
759 "__fabsx",
760 "__ffsdi2",
761 "__ffssi2",
762 "__ffsti2",
763 "__fixdfdi",
764 "__fixdfsi",
765 "__fixdfti",
766 "__fixkfdi",
767 "__fixkfsi",
768 "__fixkfti",
769 "__fixsfdi",
770 "__fixsfsi",
771 "__fixsfti",
772 "__fixtfdi",
773 "__fixtfsi",
774 "__fixtfti",
775 "__fixunsdfdi",
776 "__fixunsdfsi",
777 "__fixunsdfti",
778 "__fixunskfdi",
779 "__fixunskfsi",
780 "__fixunskfti",
781 "__fixunssfdi",
782 "__fixunssfsi",
783 "__fixunssfti",
784 "__fixunstfdi",
785 "__fixunstfsi",
786 "__fixunstfti",
787 "__fixunsxfdi",
788 "__fixunsxfsi",
789 "__fixunsxfti",
790 "__fixxfdi",
791 "__fixxfsi",
792 "__fixxfti",
793 "__floatdidf",
794 "__floatdikf",
795 "__floatdisf",
796 "__floatditf",
797 "__floatdixf",
798 "__floatsidf",
799 "__floatsikf",
800 "__floatsisf",
801 "__floatsitf",
802 "__floatsixf",
803 "__floattidf",
804 "__floattikf",
805 "__floattisf",
806 "__floattitf",
807 "__floattixf",
808 "__floatundidf",
809 "__floatundikf",
810 "__floatundisf",
811 "__floatunditf",
812 "__floatundixf",
813 "__floatunsidf",
814 "__floatunsikf",
815 "__floatunsisf",
816 "__floatunsitf",
817 "__floatunsixf",
818 "__floatuntidf",
819 "__floatuntikf",
820 "__floatuntisf",
821 "__floatuntitf",
822 "__floatuntixf",
823 "__floorh",
824 "__floorx",
825 "__fmah",
826 "__fmax",
827 "__fmaxh",
828 "__fmaxx",
829 "__fminh",
830 "__fminx",
831 "__fmodh",
832 "__fmodx",
833 "__gedf2",
834 "__gekf2",
835 "__gesf2",
836 "__getf2",
837 "__gexf2",
838 "__gnu_f2h_ieee",
839 "__gnu_h2f_ieee",
840 "__gtdf2",
841 "__gtkf2",
842 "__gtsf2",
843 "__gttf2",
844 "__gtxf2",
845 "__ledf2",
846 "__lekf2",
847 "__lesf2",
848 "__letf2",
849 "__lexf2",
850 "__log10h",
851 "__log10x",
852 "__log2h",
853 "__log2x",
854 "__logh",
855 "__logx",
856 "__lshrdi3",
857 "__lshrsi3",
858 "__lshrti3",
859 "__ltdf2",
860 "__ltkf2",
861 "__ltsf2",
862 "__lttf2",
863 "__ltxf2",
864 "__memcpy_chk",
865 "__memmove_chk",
866 "__memset",
867 "__memset_chk",
868 "__moddi3",
869 "__modsi3",
870 "__modti3",
871 "__muldc3",
872 "__muldf3",
873 "__muldi3",
874 "__mulkc3",
875 "__mulkf3",
876 "__mulodi4",
877 "__mulosi4",
878 "__muloti4",
879 "__mulsc3",
880 "__mulsf3",
881 "__mulsi3",
882 "__multc3",
883 "__multf3",
884 "__multi3",
885 "__mulxc3",
886 "__mulxf3",
887 "__nedf2",
888 "__negdf2",
889 "__negdi2",
890 "__negsf2",
891 "__negsi2",
892 "__negti2",
893 "__negvdi2",
894 "__negvsi2",
895 "__negvti2",
896 "__nekf2",
897 "__nesf2",
898 "__netf2",
899 "__nexf2",
900 "__paritydi2",
901 "__paritysi2",
902 "__parityti2",
903 "__popcountdi2",
904 "__popcountsi2",
905 "__popcountti2",
906 "__powidf2",
907 "__powihf2",
908 "__powikf2",
909 "__powisf2",
910 "__powitf2",
911 "__powixf2",
912 "__roundh",
913 "__roundx",
914 "__sincosh",
915 "__sincosx",
916 "__sinh",
917 "__sinx",
918 "__sqrth",
919 "__sqrtx",
920 "__strcat_chk",
921 "__strcpy_chk",
922 "__strncat_chk",
923 "__strncpy_chk",
924 "__subdf3",
925 "__subkf3",
926 "__subodi4",
927 "__subosi4",
928 "__suboti4",
929 "__subsf3",
930 "__subtf3",
931 "__subxf3",
932 "__tanh",
933 "__tanx",
934 "__truncdfhf2",
935 "__truncdfsf2",
936 "__trunch",
937 "__trunckfdf2",
938 "__trunckfsf2",
939 "__truncsfhf2",
940 "__trunctfdf2",
941 "__trunctfhf2",
942 "__trunctfsf2",
943 "__trunctfxf2",
944 "__truncx",
945 "__truncxfdf2",
946 "__truncxfhf2",
947 "__truncxfsf2",
948 "__ucmpdi2",
949 "__ucmpsi2",
950 "__ucmpti2",
951 "__udivdi3",
952 "__udivei4",
953 "__udivmoddi4",
954 "__udivmodsi4",
955 "__udivmodti4",
956 "__udivsi3",
957 "__udivti3",
958 "__umoddi3",
959 "__umodei4",
960 "__umodsi3",
961 "__umodti3",
962 "__unorddf2",
963 "__unordkf2",
964 "__unordsf2",
965 "__unordtf2",
966 "__zig_probe_stack",
967 "ceilf128",
968 "ceilq",
969 "cosf128",
970 "cosq",
971 "exp2f128",
972 "exp2q",
973 "expf128",
974 "expq",
975 "fabsf128",
976 "fabsq",
977 "fabsq.2",
978 "fabsq.3",
979 "floorf128",
980 "floorq",
981 "fmaf128",
982 "fmaq",
983 "fmaxf128",
984 "fmaxq",
985 "fmaxq.2",
986 "fmaxq.3",
987 "fminf128",
988 "fminq",
989 "fmodf128",
990 "fmodq",
991 "log10f128",
992 "log10q",
993 "log2f128",
994 "log2q",
995 "logf128",
996 "logq",
997 "roundf128",
998 "roundq",
999 "sincosf128",
1000 "sincosq",
1001 "sinf128",
1002 "sinq",
1003 "sqrtf128",
1004 "sqrtq",
1005 "tanf128",
1006 "tanq",
1007 "truncf128",
1008 "truncq",
1009 "__aarch64_cas16_acq",
1010 "__aarch64_cas16_acq_rel",
1011 "__aarch64_cas16_rel",
1012 "__aarch64_cas16_relax",
1013 "__aarch64_cas1_acq",
1014 "__aarch64_cas1_acq_rel",
1015 "__aarch64_cas1_rel",
1016 "__aarch64_cas1_relax",
1017 "__aarch64_cas2_acq",
1018 "__aarch64_cas2_acq_rel",
1019 "__aarch64_cas2_rel",
1020 "__aarch64_cas2_relax",
1021 "__aarch64_cas4_acq",
1022 "__aarch64_cas4_acq_rel",
1023 "__aarch64_cas4_rel",
1024 "__aarch64_cas4_relax",
1025 "__aarch64_cas8_acq",
1026 "__aarch64_cas8_acq_rel",
1027 "__aarch64_cas8_rel",
1028 "__aarch64_cas8_relax",
1029 "__aarch64_ldadd1_acq",
1030 "__aarch64_ldadd1_acq_rel",
1031 "__aarch64_ldadd1_rel",
1032 "__aarch64_ldadd1_relax",
1033 "__aarch64_ldadd2_acq",
1034 "__aarch64_ldadd2_acq_rel",
1035 "__aarch64_ldadd2_rel",
1036 "__aarch64_ldadd2_relax",
1037 "__aarch64_ldadd4_acq",
1038 "__aarch64_ldadd4_acq_rel",
1039 "__aarch64_ldadd4_rel",
1040 "__aarch64_ldadd4_relax",
1041 "__aarch64_ldadd8_acq",
1042 "__aarch64_ldadd8_acq_rel",
1043 "__aarch64_ldadd8_rel",
1044 "__aarch64_ldadd8_relax",
1045 "__aarch64_ldclr1_acq",
1046 "__aarch64_ldclr1_acq_rel",
1047 "__aarch64_ldclr1_rel",
1048 "__aarch64_ldclr1_relax",
1049 "__aarch64_ldclr2_acq",
1050 "__aarch64_ldclr2_acq_rel",
1051 "__aarch64_ldclr2_rel",
1052 "__aarch64_ldclr2_relax",
1053 "__aarch64_ldclr4_acq",
1054 "__aarch64_ldclr4_acq_rel",
1055 "__aarch64_ldclr4_rel",
1056 "__aarch64_ldclr4_relax",
1057 "__aarch64_ldclr8_acq",
1058 "__aarch64_ldclr8_acq_rel",
1059 "__aarch64_ldclr8_rel",
1060 "__aarch64_ldclr8_relax",
1061 "__aarch64_ldeor1_acq",
1062 "__aarch64_ldeor1_acq_rel",
1063 "__aarch64_ldeor1_rel",
1064 "__aarch64_ldeor1_relax",
1065 "__aarch64_ldeor2_acq",
1066 "__aarch64_ldeor2_acq_rel",
1067 "__aarch64_ldeor2_rel",
1068 "__aarch64_ldeor2_relax",
1069 "__aarch64_ldeor4_acq",
1070 "__aarch64_ldeor4_acq_rel",
1071 "__aarch64_ldeor4_rel",
1072 "__aarch64_ldeor4_relax",
1073 "__aarch64_ldeor8_acq",
1074 "__aarch64_ldeor8_acq_rel",
1075 "__aarch64_ldeor8_rel",
1076 "__aarch64_ldeor8_relax",
1077 "__aarch64_ldset1_acq",
1078 "__aarch64_ldset1_acq_rel",
1079 "__aarch64_ldset1_rel",
1080 "__aarch64_ldset1_relax",
1081 "__aarch64_ldset2_acq",
1082 "__aarch64_ldset2_acq_rel",
1083 "__aarch64_ldset2_rel",
1084 "__aarch64_ldset2_relax",
1085 "__aarch64_ldset4_acq",
1086 "__aarch64_ldset4_acq_rel",
1087 "__aarch64_ldset4_rel",
1088 "__aarch64_ldset4_relax",
1089 "__aarch64_ldset8_acq",
1090 "__aarch64_ldset8_acq_rel",
1091 "__aarch64_ldset8_rel",
1092 "__aarch64_ldset8_relax",
1093 "__aarch64_swp1_acq",
1094 "__aarch64_swp1_acq_rel",
1095 "__aarch64_swp1_rel",
1096 "__aarch64_swp1_relax",
1097 "__aarch64_swp2_acq",
1098 "__aarch64_swp2_acq_rel",
1099 "__aarch64_swp2_rel",
1100 "__aarch64_swp2_relax",
1101 "__aarch64_swp4_acq",
1102 "__aarch64_swp4_acq_rel",
1103 "__aarch64_swp4_rel",
1104 "__aarch64_swp4_relax",
1105 "__aarch64_swp8_acq",
1106 "__aarch64_swp8_acq_rel",
1107 "__aarch64_swp8_rel",
1108 "__aarch64_swp8_relax",
1109 "__addhf3",
1110 "__atomic_compare_exchange_16",
1111 "__atomic_exchange_16",
1112 "__atomic_fetch_add_16",
1113 "__atomic_fetch_and_16",
1114 "__atomic_fetch_nand_16",
1115 "__atomic_fetch_or_16",
1116 "__atomic_fetch_sub_16",
1117 "__atomic_fetch_umax_1",
1118 "__atomic_fetch_umax_16",
1119 "__atomic_fetch_umax_2",
1120 "__atomic_fetch_umax_4",
1121 "__atomic_fetch_umax_8",
1122 "__atomic_fetch_umin_1",
1123 "__atomic_fetch_umin_16",
1124 "__atomic_fetch_umin_2",
1125 "__atomic_fetch_umin_4",
1126 "__atomic_fetch_umin_8",
1127 "__atomic_fetch_xor_16",
1128 "__atomic_load_16",
1129 "__atomic_store_16",
1130 "__cmphf2",
1131 "__cmpxf2",
1132 "__divdc3",
1133 "__divhc3",
1134 "__divhf3",
1135 "__divkc3",
1136 "__divsc3",
1137 "__divtc3",
1138 "__divxc3",
1139 "__eqhf2",
1140 "__extendhfdf2",
1141 "__fixhfdi",
1142 "__fixhfsi",
1143 "__fixhfti",
1144 "__fixunshfdi",
1145 "__fixunshfsi",
1146 "__fixunshfti",
1147 "__floatdihf",
1148 "__floatsihf",
1149 "__floattihf",
1150 "__floatundihf",
1151 "__floatunsihf",
1152 "__floatuntihf",
1153 "__gehf2",
1154 "__gthf2",
1155 "__lehf2",
1156 "__lthf2",
1157 "__mulhc3",
1158 "__mulhf3",
1159 "__neghf2",
1160 "__negkf2",
1161 "__negtf2",
1162 "__negxf2",
1163 "__nehf2",
1164 "__subhf3",
1165 "__unordhf2",
1166 "__unordxf2",
1167};