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__(...@@ -3,6 +3,7 @@ __asm__(
3".weak _DYNAMIC \n"3".weak _DYNAMIC \n"
4".hidden _DYNAMIC \n"4".hidden _DYNAMIC \n"
5".global " START "\n"5".global " START "\n"
6".type " START ",%function \n"
6START ":\n"7START ":\n"
7" xor %ebp,%ebp \n"8" xor %ebp,%ebp \n"
8" mov %esp,%eax \n"9" mov %esp,%eax \n"
lib/libc/musl/arch/x86_64/crt_arch.h+1
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1__asm__(1__asm__(
2".text \n"2".text \n"
3".global " START " \n"3".global " START " \n"
4".type " START ",%function \n"
4START ": \n"5START ": \n"
5" xor %rbp,%rbp \n"6" xor %rbp,%rbp \n"
6" mov %rsp,%rdi \n"7" mov %rsp,%rdi \n"
lib/libc/musl/libc.S+109-51
...@@ -7,6 +7,13 @@...@@ -7,6 +7,13 @@
7#define PTR_SIZE_BYTES 47#define PTR_SIZE_BYTES 4
8#define PTR2_SIZE_BYTES 88#define PTR2_SIZE_BYTES 8
9#endif9#endif
10
11#ifdef TIME32
12#define WEAKTIME64 .globl
13#else
14#define WEAKTIME64 .weak
15#endif
16
10.bss17.bss
11.weak ___environ18.weak ___environ
12.type ___environ, %object;19.type ___environ, %object;
...@@ -168,18 +175,64 @@ _IO_putc:...@@ -168,18 +175,64 @@ _IO_putc:
168.weak _IO_putc_unlocked175.weak _IO_putc_unlocked
169.type _IO_putc_unlocked, %function;176.type _IO_putc_unlocked, %function;
170_IO_putc_unlocked:177_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
172.globl ___tls_get_addr179.globl ___tls_get_addr
173.type ___tls_get_addr, %function;180.type ___tls_get_addr, %function;
174___tls_get_addr:181___tls_get_addr:
175#endif182#endif
176#ifdef PTR32183#ifdef TIME32
177.globl __adjtime64184.globl __adjtime64
178.type __adjtime64, %function;185.type __adjtime64, %function;
179__adjtime64:186__adjtime64:
180.globl __adjtimex_time64187.globl __adjtimex_time64
181.type __adjtimex_time64, %function;188.type __adjtimex_time64, %function;
182__adjtimex_time64:189__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
183.globl __aio_suspend_time64236.globl __aio_suspend_time64
184.type __aio_suspend_time64, %function;237.type __aio_suspend_time64, %function;
185__aio_suspend_time64:238__aio_suspend_time64:
...@@ -187,12 +240,12 @@ __aio_suspend_time64:...@@ -187,12 +240,12 @@ __aio_suspend_time64:
187.globl __assert_fail240.globl __assert_fail
188.type __assert_fail, %function;241.type __assert_fail, %function;
189__assert_fail:242__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
191.globl __cachectl244.globl __cachectl
192.type __cachectl, %function;245.type __cachectl, %function;
193__cachectl:246__cachectl:
194#endif247#endif
195#ifdef PTR32248#ifdef TIME32
196.globl __clock_adjtime64249.globl __clock_adjtime64
197.type __clock_adjtime64, %function;250.type __clock_adjtime64, %function;
198__clock_adjtime64:251__clock_adjtime64:
...@@ -236,7 +289,7 @@ __cxa_atexit:...@@ -236,7 +289,7 @@ __cxa_atexit:
236.globl __cxa_finalize289.globl __cxa_finalize
237.type __cxa_finalize, %function;290.type __cxa_finalize, %function;
238__cxa_finalize:291__cxa_finalize:
239#ifdef PTR32292#ifdef TIME32
240.globl __difftime64293.globl __difftime64
241.type __difftime64, %function;294.type __difftime64, %function;
242__difftime64:295__difftime64:
...@@ -247,7 +300,12 @@ __dls2b:...@@ -247,7 +300,12 @@ __dls2b:
247.globl __dls3300.globl __dls3
248.type __dls3, %function;301.type __dls3, %function;
249__dls3:302__dls3:
250#ifdef PTR32303#ifdef FAMILY_mips
304.globl __dlstart
305.type __dlstart, %function;
306__dlstart:
307#endif
308#ifdef TIME32
251.globl __dlsym_time64309.globl __dlsym_time64
252.type __dlsym_time64, %function;310.type __dlsym_time64, %function;
253__dlsym_time64:311__dlsym_time64:
...@@ -312,7 +370,7 @@ __fseterr:...@@ -312,7 +370,7 @@ __fseterr:
312.globl __fsetlocking370.globl __fsetlocking
313.type __fsetlocking, %function;371.type __fsetlocking, %function;
314__fsetlocking:372__fsetlocking:
315#ifdef PTR32373#ifdef TIME32
316.weak __fstat_time64374.weak __fstat_time64
317.type __fstat_time64, %function;375.type __fstat_time64, %function;
318__fstat_time64:376__fstat_time64:
...@@ -347,7 +405,7 @@ __fxstatat:...@@ -347,7 +405,7 @@ __fxstatat:
347.weak __getdelim405.weak __getdelim
348.type __getdelim, %function;406.type __getdelim, %function;
349__getdelim:407__getdelim:
350#ifdef PTR32408#ifdef TIME32
351.globl __getitimer_time64409.globl __getitimer_time64
352.type __getitimer_time64, %function;410.type __getitimer_time64, %function;
353__getitimer_time64:411__getitimer_time64:
...@@ -364,6 +422,11 @@ __gmtime64:...@@ -364,6 +422,11 @@ __gmtime64:
364.type __gmtime64_r, %function;422.type __gmtime64_r, %function;
365__gmtime64_r:423__gmtime64_r:
366#endif424#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
367.globl __h_errno_location430.globl __h_errno_location
368.type __h_errno_location, %function;431.type __h_errno_location, %function;
369__h_errno_location:432__h_errno_location:
...@@ -490,7 +553,7 @@ __libc_current_sigrtmin:...@@ -490,7 +553,7 @@ __libc_current_sigrtmin:
490.globl __libc_start_main553.globl __libc_start_main
491.type __libc_start_main, %function;554.type __libc_start_main, %function;
492__libc_start_main:555__libc_start_main:
493#ifdef PTR32556#ifdef TIME32
494.globl __localtime64557.globl __localtime64
495.type __localtime64, %function;558.type __localtime64, %function;
496__localtime64:559__localtime64:
...@@ -498,12 +561,12 @@ __localtime64:...@@ -498,12 +561,12 @@ __localtime64:
498.type __localtime64_r, %function;561.type __localtime64_r, %function;
499__localtime64_r:562__localtime64_r:
500#endif563#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
502.globl __longjmp565.globl __longjmp
503.type __longjmp, %function;566.type __longjmp, %function;
504__longjmp:567__longjmp:
505#endif568#endif
506#ifdef PTR32569#ifdef TIME32
507.globl __lstat_time64570.globl __lstat_time64
508.type __lstat_time64, %function;571.type __lstat_time64, %function;
509__lstat_time64:572__lstat_time64:
...@@ -514,7 +577,7 @@ __lutimes_time64:...@@ -514,7 +577,7 @@ __lutimes_time64:
514.globl __lxstat577.globl __lxstat
515.type __lxstat, %function;578.type __lxstat, %function;
516__lxstat:579__lxstat:
517#ifdef PTR32580#ifdef TIME32
518.globl __mktime64581.globl __mktime64
519.type __mktime64, %function;582.type __mktime64, %function;
520__mktime64:583__mktime64:
...@@ -547,7 +610,7 @@ __overflow:...@@ -547,7 +610,7 @@ __overflow:
547.weak __posix_getopt610.weak __posix_getopt
548.type __posix_getopt, %function;611.type __posix_getopt, %function;
549__posix_getopt:612__posix_getopt:
550#ifdef PTR32613#ifdef TIME32
551.globl __ppoll_time64614.globl __ppoll_time64
552.type __ppoll_time64, %function;615.type __ppoll_time64, %function;
553__ppoll_time64:616__ppoll_time64:
...@@ -576,17 +639,7 @@ __recvmmsg_time64:...@@ -576,17 +639,7 @@ __recvmmsg_time64:
576.globl __res_state639.globl __res_state
577.type __res_state, %function;640.type __res_state, %function;
578__res_state:641__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)642#ifdef FAMILY_riscv
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)
590.globl __riscv_flush_icache643.globl __riscv_flush_icache
591.type __riscv_flush_icache, %function;644.type __riscv_flush_icache, %function;
592__riscv_flush_icache:645__riscv_flush_icache:
...@@ -594,7 +647,7 @@ __riscv_flush_icache:...@@ -594,7 +647,7 @@ __riscv_flush_icache:
594.globl __sched_cpucount647.globl __sched_cpucount
595.type __sched_cpucount, %function;648.type __sched_cpucount, %function;
596__sched_cpucount:649__sched_cpucount:
597#ifdef PTR32650#ifdef TIME32
598.globl __sched_rr_get_interval_time64651.globl __sched_rr_get_interval_time64
599.type __sched_rr_get_interval_time64, %function;652.type __sched_rr_get_interval_time64, %function;
600__sched_rr_get_interval_time64:653__sched_rr_get_interval_time64:
...@@ -614,7 +667,7 @@ __setitimer_time64:...@@ -614,7 +667,7 @@ __setitimer_time64:
614.globl __setjmp667.globl __setjmp
615.type __setjmp, %function;668.type __setjmp, %function;
616__setjmp:669__setjmp:
617#ifdef PTR32670#ifdef TIME32
618.globl __settimeofday_time64671.globl __settimeofday_time64
619.type __settimeofday_time64, %function;672.type __settimeofday_time64, %function;
620__settimeofday_time64:673__settimeofday_time64:
...@@ -631,7 +684,7 @@ __signbitl:...@@ -631,7 +684,7 @@ __signbitl:
631.globl __sigsetjmp684.globl __sigsetjmp
632.type __sigsetjmp, %function;685.type __sigsetjmp, %function;
633__sigsetjmp:686__sigsetjmp:
634#ifdef PTR32687#ifdef TIME32
635.globl __sigtimedwait_time64688.globl __sigtimedwait_time64
636.type __sigtimedwait_time64, %function;689.type __sigtimedwait_time64, %function;
637__sigtimedwait_time64:690__sigtimedwait_time64:
...@@ -639,7 +692,7 @@ __sigtimedwait_time64:...@@ -639,7 +692,7 @@ __sigtimedwait_time64:
639.globl __stack_chk_fail692.globl __stack_chk_fail
640.type __stack_chk_fail, %function;693.type __stack_chk_fail, %function;
641__stack_chk_fail:694__stack_chk_fail:
642#ifdef PTR32695#ifdef TIME32
643.globl __stat_time64696.globl __stat_time64
644.type __stat_time64, %function;697.type __stat_time64, %function;
645__stat_time64:698__stat_time64:
...@@ -692,7 +745,7 @@ __strxfrm_l:...@@ -692,7 +745,7 @@ __strxfrm_l:
692.weak __sysv_signal745.weak __sysv_signal
693.type __sysv_signal, %function;746.type __sysv_signal, %function;
694__sysv_signal:747__sysv_signal:
695#ifdef PTR32748#ifdef TIME32
696.globl __thrd_sleep_time64749.globl __thrd_sleep_time64
697.type __thrd_sleep_time64, %function;750.type __thrd_sleep_time64, %function;
698__thrd_sleep_time64:751__thrd_sleep_time64:
...@@ -718,9 +771,16 @@ __timerfd_settime64:...@@ -718,9 +771,16 @@ __timerfd_settime64:
718.type __timespec_get_time64, %function;771.type __timespec_get_time64, %function;
719__timespec_get_time64:772__timespec_get_time64:
720#endif773#endif
774#if !defined(ARCH_s390x)
721.globl __tls_get_addr775.globl __tls_get_addr
722.type __tls_get_addr, %function;776.type __tls_get_addr, %function;
723__tls_get_addr:777__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
724.globl __tolower_l784.globl __tolower_l
725.type __tolower_l, %function;785.type __tolower_l, %function;
726__tolower_l:786__tolower_l:
...@@ -743,7 +803,7 @@ __uflow:...@@ -743,7 +803,7 @@ __uflow:
743.globl __uselocale803.globl __uselocale
744.type __uselocale, %function;804.type __uselocale, %function;
745__uselocale:805__uselocale:
746#ifdef PTR32806#ifdef TIME32
747.globl __utime64807.globl __utime64
748.type __utime64, %function;808.type __utime64, %function;
749__utime64:809__utime64:
...@@ -796,7 +856,7 @@ _dl_debug_state:...@@ -796,7 +856,7 @@ _dl_debug_state:
796.globl _dlstart856.globl _dlstart
797.type _dlstart, %function;857.type _dlstart, %function;
798_dlstart:858_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
800.globl _dlstart_data860.globl _dlstart_data
801.type _dlstart_data, %function;861.type _dlstart_data, %function;
802_dlstart_data:862_dlstart_data:
...@@ -807,7 +867,7 @@ _exit:...@@ -807,7 +867,7 @@ _exit:
807.weak _fini867.weak _fini
808.type _fini, %function;868.type _fini, %function;
809_fini:869_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
811.globl _flush_cache871.globl _flush_cache
812.type _flush_cache, %function;872.type _flush_cache, %function;
813_flush_cache:873_flush_cache:
...@@ -908,7 +968,7 @@ aligned_alloc:...@@ -908,7 +968,7 @@ aligned_alloc:
908.globl alphasort968.globl alphasort
909.type alphasort, %function;969.type alphasort, %function;
910alphasort:970alphasort:
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
912.globl arch_prctl972.globl arch_prctl
913.type arch_prctl, %function;973.type arch_prctl, %function;
914arch_prctl:974arch_prctl:
...@@ -1033,12 +1093,10 @@ cabsf:...@@ -1033,12 +1093,10 @@ cabsf:
1033.globl cabsl1093.globl cabsl
1034.type cabsl, %function;1094.type cabsl, %function;
1035cabsl:1095cabsl:
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
1037.weak cachectl1097.weak cachectl
1038.type cachectl, %function;1098.type cachectl, %function;
1039cachectl:1099cachectl:
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)
1042.weak cacheflush1100.weak cacheflush
1043.type cacheflush, %function;1101.type cacheflush, %function;
1044cacheflush:1102cacheflush:
...@@ -1232,10 +1290,10 @@ clock_getcpuclockid:...@@ -1232,10 +1290,10 @@ clock_getcpuclockid:
1232.globl clock_getres1290.globl clock_getres
1233.type clock_getres, %function;1291.type clock_getres, %function;
1234clock_getres:1292clock_getres:
1235WEAK64 clock_gettime1293WEAKTIME64 clock_gettime
1236.type clock_gettime, %function;1294.type clock_gettime, %function;
1237clock_gettime:1295clock_gettime:
1238WEAK64 clock_nanosleep1296WEAKTIME64 clock_nanosleep
1239.type clock_nanosleep, %function;1297.type clock_nanosleep, %function;
1240clock_nanosleep:1298clock_nanosleep:
1241.globl clock_settime1299.globl clock_settime
...@@ -2018,10 +2076,10 @@ fsetpos:...@@ -2018,10 +2076,10 @@ fsetpos:
2018.globl fsetxattr2076.globl fsetxattr
2019.type fsetxattr, %function;2077.type fsetxattr, %function;
2020fsetxattr:2078fsetxattr:
2021WEAK64 fstat2079WEAKTIME64 fstat
2022.type fstat, %function;2080.type fstat, %function;
2023fstat:2081fstat:
2024WEAK64 fstatat2082WEAKTIME64 fstatat
2025.type fstatat, %function;2083.type fstatat, %function;
2026fstatat:2084fstatat:
2027.weak fstatfs2085.weak fstatfs
...@@ -2063,7 +2121,7 @@ futimens:...@@ -2063,7 +2121,7 @@ futimens:
2063.globl futimes2121.globl futimes
2064.type futimes, %function;2122.type futimes, %function;
2065futimes:2123futimes:
2066WEAK64 futimesat2124WEAKTIME64 futimesat
2067.type futimesat, %function;2125.type futimesat, %function;
2068futimesat:2126futimesat:
2069.globl fwide2127.globl fwide
...@@ -2408,7 +2466,7 @@ globfree:...@@ -2408,7 +2466,7 @@ globfree:
2408.globl gmtime2466.globl gmtime
2409.type gmtime, %function;2467.type gmtime, %function;
2410gmtime:2468gmtime:
2411WEAK64 gmtime_r2469WEAKTIME64 gmtime_r
2412.type gmtime_r, %function;2470.type gmtime_r, %function;
2413gmtime_r:2471gmtime_r:
2414.globl grantpt2472.globl grantpt
...@@ -2549,12 +2607,12 @@ insque:...@@ -2549,12 +2607,12 @@ insque:
2549.globl ioctl2607.globl ioctl
2550.type ioctl, %function;2608.type ioctl, %function;
2551ioctl:2609ioctl:
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)
2553.globl ioperm2611.globl ioperm
2554.type ioperm, %function;2612.type ioperm, %function;
2555ioperm:2613ioperm:
2556#endif2614#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)
2558.globl iopl2616.globl iopl
2559.type iopl, %function;2617.type iopl, %function;
2560iopl:2618iopl:
...@@ -2853,7 +2911,7 @@ localeconv:...@@ -2853,7 +2911,7 @@ localeconv:
2853.globl localtime2911.globl localtime
2854.type localtime, %function;2912.type localtime, %function;
2855localtime:2913localtime:
2856WEAK64 localtime_r2914WEAKTIME64 localtime_r
2857.type localtime_r, %function;2915.type localtime_r, %function;
2858localtime_r:2916localtime_r:
2859.globl lockf2917.globl lockf
...@@ -3552,7 +3610,7 @@ pthread_cond_init:...@@ -3552,7 +3610,7 @@ pthread_cond_init:
3552.globl pthread_cond_signal3610.globl pthread_cond_signal
3553.type pthread_cond_signal, %function;3611.type pthread_cond_signal, %function;
3554pthread_cond_signal:3612pthread_cond_signal:
3555WEAK64 pthread_cond_timedwait3613WEAKTIME64 pthread_cond_timedwait
3556.type pthread_cond_timedwait, %function;3614.type pthread_cond_timedwait, %function;
3557pthread_cond_timedwait:3615pthread_cond_timedwait:
3558.globl pthread_cond_wait3616.globl pthread_cond_wait
...@@ -3642,7 +3700,7 @@ pthread_mutex_lock:...@@ -3642,7 +3700,7 @@ pthread_mutex_lock:
3642.globl pthread_mutex_setprioceiling3700.globl pthread_mutex_setprioceiling
3643.type pthread_mutex_setprioceiling, %function;3701.type pthread_mutex_setprioceiling, %function;
3644pthread_mutex_setprioceiling:3702pthread_mutex_setprioceiling:
3645WEAK64 pthread_mutex_timedlock3703WEAKTIME64 pthread_mutex_timedlock
3646.type pthread_mutex_timedlock, %function;3704.type pthread_mutex_timedlock, %function;
3647pthread_mutex_timedlock:3705pthread_mutex_timedlock:
3648.weak pthread_mutex_trylock3706.weak pthread_mutex_trylock
...@@ -3693,10 +3751,10 @@ pthread_rwlock_init:...@@ -3693,10 +3751,10 @@ pthread_rwlock_init:
3693.weak pthread_rwlock_rdlock3751.weak pthread_rwlock_rdlock
3694.type pthread_rwlock_rdlock, %function;3752.type pthread_rwlock_rdlock, %function;
3695pthread_rwlock_rdlock:3753pthread_rwlock_rdlock:
3696WEAK64 pthread_rwlock_timedrdlock3754WEAKTIME64 pthread_rwlock_timedrdlock
3697.type pthread_rwlock_timedrdlock, %function;3755.type pthread_rwlock_timedrdlock, %function;
3698pthread_rwlock_timedrdlock:3756pthread_rwlock_timedrdlock:
3699WEAK64 pthread_rwlock_timedwrlock3757WEAKTIME64 pthread_rwlock_timedwrlock
3700.type pthread_rwlock_timedwrlock, %function;3758.type pthread_rwlock_timedwrlock, %function;
3701pthread_rwlock_timedwrlock:3759pthread_rwlock_timedwrlock:
3702.weak pthread_rwlock_tryrdlock3760.weak pthread_rwlock_tryrdlock
...@@ -3774,7 +3832,7 @@ pthread_spin_unlock:...@@ -3774,7 +3832,7 @@ pthread_spin_unlock:
3774.weak pthread_testcancel3832.weak pthread_testcancel
3775.type pthread_testcancel, %function;3833.type pthread_testcancel, %function;
3776pthread_testcancel:3834pthread_testcancel:
3777WEAK64 pthread_timedjoin_np3835WEAKTIME64 pthread_timedjoin_np
3778.type pthread_timedjoin_np, %function;3836.type pthread_timedjoin_np, %function;
3779pthread_timedjoin_np:3837pthread_timedjoin_np:
3780.weak pthread_tryjoin_np3838.weak pthread_tryjoin_np
...@@ -3999,7 +4057,7 @@ rintf:...@@ -3999,7 +4057,7 @@ rintf:
3999.globl rintl4057.globl rintl
4000.type rintl, %function;4058.type rintl, %function;
4001rintl:4059rintl:
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
4003.weak riscv_flush_icache4061.weak riscv_flush_icache
4004.type riscv_flush_icache, %function;4062.type riscv_flush_icache, %function;
4005riscv_flush_icache:4063riscv_flush_icache:
lib/libc/musl/src/signal/riscv32/restore.s+2
...@@ -1,7 +1,9 @@...@@ -1,7 +1,9 @@
1.global __restore1.global __restore
2.hidden __restore
2.type __restore, %function3.type __restore, %function
3__restore:4__restore:
4.global __restore_rt5.global __restore_rt
6.hidden __restore_rt
5.type __restore_rt, %function7.type __restore_rt, %function
6__restore_rt:8__restore_rt:
7 li a7, 139 # SYS_rt_sigreturn9 li a7, 139 # SYS_rt_sigreturn
lib/libc/musl/src/signal/riscv64/restore.s+2
...@@ -1,7 +1,9 @@...@@ -1,7 +1,9 @@
1.global __restore1.global __restore
2.hidden __restore
2.type __restore, %function3.type __restore, %function
3__restore:4__restore:
4.global __restore_rt5.global __restore_rt
6.hidden __restore_rt
5.type __restore_rt, %function7.type __restore_rt, %function
6__restore_rt:8__restore_rt:
7 li a7, 139 # SYS_rt_sigreturn9 li a7, 139 # SYS_rt_sigreturn
lib/libc/musl/src/thread/s390x/__tls_get_offset.s+1
...@@ -5,6 +5,7 @@ __tls_get_offset:...@@ -5,6 +5,7 @@ __tls_get_offset:
5 aghi %r15, -1605 aghi %r15, -160
66
7 la %r2, 0(%r2, %r12)7 la %r2, 0(%r2, %r12)
8.hidden __tls_get_addr
8 brasl %r14, __tls_get_addr9 brasl %r14, __tls_get_addr
910
10 ear %r1, %a011 ear %r1, %a0
src/Compilation.zig+3-1
...@@ -5884,7 +5884,9 @@ pub const FileExt = enum {...@@ -5884,7 +5884,9 @@ pub const FileExt = enum {
5884};5884};
58855885
5886pub fn hasObjectExt(filename: []const u8) bool {5886pub 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");
5888}5890}
58895891
5890pub fn hasStaticLibraryExt(filename: []const u8) bool {5892pub 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...@@ -138,17 +138,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
138 try addSrcFile(arena, &source_table, src_file);138 try addSrcFile(arena, &source_table, src_file);
139 }139 }
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 };
152 for (time32_compat_arch_list) |time32_compat_arch| {141 for (time32_compat_arch_list) |time32_compat_arch| {
153 if (mem.eql(u8, arch_name, time32_compat_arch)) {142 if (mem.eql(u8, arch_name, time32_compat_arch)) {
154 for (compat_time32_files) |compat_time32_file| {143 for (compat_time32_files) |compat_time32_file| {
...@@ -239,13 +228,29 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro...@@ -239,13 +228,29 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
239 });228 });
240229
241 const target = comp.root_mod.resolved_target.result;230 const target = comp.root_mod.resolved_target.result;
242 const arch_define = try std.fmt.allocPrint(arena, "-DARCH_{s}", .{231 const arch_name = std.zig.target.muslArchName(target.cpu.arch, target.abi);
243 @tagName(target.cpu.arch),232 const time32 = for (time32_compat_arch_list) |time32_compat_arch| {
244 });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 };
245 const cc_argv: []const []const u8 = if (target.ptrBitWidth() == 64)248 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 }
247 else252 else
248 &.{arch_define};253 &.{ arch_define, family_define };
249254
250 const root_mod = try Module.create(arena, .{255 const root_mod = try Module.create(arena, .{
251 .global_cache_directory = comp.global_cache_directory,256 .global_cache_directory = comp.global_cache_directory,
...@@ -347,6 +352,18 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.Lin...@@ -347,6 +352,18 @@ pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.Lin
347 };352 };
348}353}
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
350fn isArchName(name: []const u8) bool {367fn isArchName(name: []const u8) bool {
351 const musl_arch_names = [_][]const u8{368 const musl_arch_names = [_][]const u8{
352 "aarch64",369 "aarch64",
tools/gen_stubs.zig+236-676
...@@ -2,23 +2,51 @@...@@ -2,23 +2,51 @@
2//! ./gen_stubs /path/to/musl/build-all >libc.S2//! ./gen_stubs /path/to/musl/build-all >libc.S
3//!3//!
4//! The directory 'build-all' is expected to contain these subdirectories:4//! The directory 'build-all' is expected to contain these subdirectories:
5//! arm x86 mips mips64 powerpc powerpc64 riscv32 riscv64 x86_64 loongarch645//!
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
6//!20//!
7//! ...each with 'lib/libc.so' inside of them.21//! ...each with 'lib/libc.so' inside of them.
8//!22//!
9//! When building the resulting libc.S file, these defines are required:23//! When building the resulting libc.S file, these defines are required:
10//! * `-DPTR64`: when the architecture is 64-bit24//! * `-DTIME32`: When the target's primary time ABI is 32-bit
25//! * `-DPTR64`: When the target has 64-bit pointers
11//! * One of the following, corresponding to the CPU architecture:26//! * One of the following, corresponding to the CPU architecture:
12//! - `-DARCH_riscv32`27//! - `-DARCH_aarch64`
13//! - `-DARCH_riscv64`28//! - `-DARCH_arm`
29//! - `-DARCH_i386`
30//! - `-DARCH_loongarch64`
14//! - `-DARCH_mips`31//! - `-DARCH_mips`
15//! - `-DARCH_mips64`32//! - `-DARCH_mips64`
16//! - `-DARCH_i386`33//! - `-DARCH_mipsn32`
17//! - `-DARCH_x86_64`
18//! - `-DARCH_powerpc`34//! - `-DARCH_powerpc`
19//! - `-DARCH_powerpc64`35//! - `-DARCH_powerpc64`
20//! - `-DARCH_aarch64`36//! - `-DARCH_riscv32`
21//! - `-DARCH_loongarch64`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
23// TODO: pick the best index to put them into instead of at the end51// TODO: pick the best index to put them into instead of at the end
24// - e.g. find a common previous symbol and put it after that one52// - e.g. find a common previous symbol and put it after that one
...@@ -29,24 +57,85 @@ const builtin = std.builtin;...@@ -29,24 +57,85 @@ const builtin = std.builtin;
29const mem = std.mem;57const mem = std.mem;
30const log = std.log;58const log = std.log;
31const elf = std.elf;59const elf = std.elf;
32const native_endian = @import("builtin").target.cpu.arch.endian();60const native_endian = @import("builtin").cpu.arch.endian();
3361
34const inputs = .{62const Arch = enum {
35 .riscv32,63 aarch64,
36 .riscv64,64 arm,
37 .loongarch64,65 i386,
38 .mips,66 loongarch64,
39 .mips64,67 mips,
40 .x86,68 mips64,
41 .x86_64,69 mipsn32,
42 .powerpc,70 powerpc,
43 .powerpc64,71 powerpc64,
44 .aarch64,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,
45};133};
46134
47const arches: [inputs.len]std.Target.Cpu.Arch = blk: {135const arches: [@typeInfo(Arch).@"enum".fields.len]Arch = blk: {
48 var result: [inputs.len]std.Target.Cpu.Arch = undefined;136 var result: [@typeInfo(Arch).@"enum".fields.len]Arch = undefined;
49 for (inputs) |arch| {137 for (@typeInfo(Arch).@"enum".fields) |field| {
138 const arch: Arch = @enumFromInt(field.value);
50 result[archIndex(arch)] = arch;139 result[archIndex(arch)] = arch;
51 }140 }
52 break :blk result;141 break :blk result;
...@@ -60,6 +149,31 @@ const MultiSym = struct {...@@ -60,6 +149,31 @@ const MultiSym = struct {
60 ty: u4,149 ty: u4,
61 visib: elf.STV,150 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
63 fn allPresent(ms: MultiSym) bool {177 fn allPresent(ms: MultiSym) bool {
64 for (arches, 0..) |_, i| {178 for (arches, 0..) |_, i| {
65 if (!ms.present[i]) {179 if (!ms.present[i]) {
...@@ -69,17 +183,14 @@ const MultiSym = struct {...@@ -69,17 +183,14 @@ const MultiSym = struct {
69 return true;183 return true;
70 }184 }
71185
72 fn is32Only(ms: MultiSym) bool {186 fn isTime32Only(ms: MultiSym) bool {
73 return ms.present[archIndex(.riscv32)] == true and187 inline for (@typeInfo(Arch).@"enum".fields) |field| {
74 ms.present[archIndex(.riscv64)] == false and188 const arch: Arch = @enumFromInt(field.value);
75 ms.present[archIndex(.mips)] == true and189 if (ms.present[archIndex(arch)] != arch.isTime32()) {
76 ms.present[archIndex(.mips64)] == false and190 return false;
77 ms.present[archIndex(.x86)] == true and191 }
78 ms.present[archIndex(.x86_64)] == false and192 }
79 ms.present[archIndex(.powerpc)] == true and193 return true;
80 ms.present[archIndex(.powerpc64)] == false and
81 ms.present[archIndex(.aarch64)] == false and
82 ms.present[archIndex(.loongarch64)] == false;
83 }194 }
84195
85 fn commonSize(ms: MultiSym) ?u64 {196 fn commonSize(ms: MultiSym) ?u64 {
...@@ -112,71 +223,38 @@ const MultiSym = struct {...@@ -112,71 +223,38 @@ const MultiSym = struct {
112 return binding.?;223 return binding.?;
113 }224 }
114225
115 fn isPtrSize(ms: MultiSym) bool {226 fn isPtrSize(ms: MultiSym, mult: u16) bool {
116 const map = .{227 inline for (@typeInfo(Arch).@"enum".fields) |field| {
117 .{ .riscv32, 4 },228 const arch: Arch = @enumFromInt(field.value);
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];
131 const arch_index = archIndex(arch);229 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) {
133 return false;231 return false;
134 }232 }
135 }233 }
136 return true;234 return true;
137 }235 }
138236
139 fn isPtr2Size(ms: MultiSym) bool {237 fn isWeak64(ms: MultiSym) bool {
140 const map = .{238 inline for (@typeInfo(Arch).@"enum".fields) |field| {
141 .{ .riscv32, 8 },239 const arch: Arch = @enumFromInt(field.value);
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];
155 const arch_index = archIndex(arch);240 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) {
157 return false;247 return false;
158 }248 }
159 }249 }
160 return true;250 return true;
161 }251 }
162252
163 fn isWeak64(ms: MultiSym) bool {253 fn isWeakTime64(ms: MultiSym) bool {
164 const map = .{254 inline for (@typeInfo(Arch).@"enum".fields) |field| {
165 .{ .riscv32, 1 },255 const arch: Arch = @enumFromInt(field.value);
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];
179 const arch_index = archIndex(arch);256 const arch_index = archIndex(arch);
257 const binding: u4 = if (arch.isTime32()) std.elf.STB_GLOBAL else std.elf.STB_WEAK;
180 if (ms.present[arch_index] and ms.binding[arch_index] != binding) {258 if (ms.present[arch_index] and ms.binding[arch_index] != binding) {
181 return false;259 return false;
182 }260 }
...@@ -189,10 +267,9 @@ const Parse = struct {...@@ -189,10 +267,9 @@ const Parse = struct {
189 arena: mem.Allocator,267 arena: mem.Allocator,
190 sym_table: *std.StringArrayHashMap(MultiSym),268 sym_table: *std.StringArrayHashMap(MultiSym),
191 sections: *std.StringArrayHashMap(void),269 sections: *std.StringArrayHashMap(void),
192 blacklist: std.StringArrayHashMap(void),
193 elf_bytes: []align(@alignOf(elf.Elf64_Ehdr)) u8,270 elf_bytes: []align(@alignOf(elf.Elf64_Ehdr)) u8,
194 header: elf.Header,271 header: elf.Header,
195 arch: std.Target.Cpu.Arch,272 arch: Arch,
196};273};
197274
198pub fn main() !void {275pub fn main() !void {
...@@ -207,16 +284,10 @@ pub fn main() !void {...@@ -207,16 +284,10 @@ pub fn main() !void {
207284
208 var sym_table = std.StringArrayHashMap(MultiSym).init(arena);285 var sym_table = std.StringArrayHashMap(MultiSym).init(arena);
209 var sections = std.StringArrayHashMap(void).init(arena);286 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
217 for (arches) |arch| {288 for (arches) |arch| {
218 const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{289 const libc_so_path = try std.fmt.allocPrint(arena, "{s}/lib/libc.so", .{
219 archMuslName(arch),290 @tagName(arch),
220 });291 });
221292
222 // Read the ELF header.293 // Read the ELF header.
...@@ -238,7 +309,6 @@ pub fn main() !void {...@@ -238,7 +309,6 @@ pub fn main() !void {
238 .arena = arena,309 .arena = arena,
239 .sym_table = &sym_table,310 .sym_table = &sym_table,
240 .sections = &sections,311 .sections = &sections,
241 .blacklist = blacklist,
242 .elf_bytes = elf_bytes,312 .elf_bytes = elf_bytes,
243 .header = header,313 .header = header,
244 .arch = arch,314 .arch = arch,
...@@ -268,6 +338,13 @@ pub fn main() !void {...@@ -268,6 +338,13 @@ pub fn main() !void {
268 \\#define PTR2_SIZE_BYTES 8338 \\#define PTR2_SIZE_BYTES 8
269 \\#endif339 \\#endif
270 \\340 \\
341 \\#ifdef TIME32
342 \\#define WEAKTIME64 .globl
343 \\#else
344 \\#define WEAKTIME64 .weak
345 \\#endif
346 \\
347 \\
271 );348 );
272349
273 // Sort the symbols for deterministic output and cleaner vcs diffs.350 // Sort the symbols for deterministic output and cleaner vcs diffs.
...@@ -301,7 +378,7 @@ pub fn main() !void {...@@ -301,7 +378,7 @@ pub fn main() !void {
301 sym_table.sort(SymTableSort{ .sym_table = &sym_table, .sections = &sections });378 sym_table.sort(SymTableSort{ .sym_table = &sym_table, .sections = &sections });
302379
303 var prev_section: u16 = std.math.maxInt(u16);380 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;
305 for (sym_table.values(), 0..) |multi_sym, sym_index| {382 for (sym_table.values(), 0..) |multi_sym, sym_index| {
306 const name = sym_table.keys()[sym_index];383 const name = sym_table.keys()[sym_index];
307384
...@@ -313,32 +390,66 @@ pub fn main() !void {...@@ -313,32 +390,66 @@ pub fn main() !void {
313390
314 if (multi_sym.allPresent()) {391 if (multi_sym.allPresent()) {
315 switch (prev_pp_state) {392 switch (prev_pp_state) {
316 .none => {},393 .all => {},
317 .ptr32, .special => {394 .single, .multi, .family, .time32 => {
318 try stdout.writeAll("#endif\n");395 try stdout.writeAll("#endif\n");
319 prev_pp_state = .none;396 prev_pp_state = .all;
320 },397 },
321 }398 }
322 } else if (multi_sym.is32Only()) {399 } else if (multi_sym.isSingleArch()) |arch| {
323 switch (prev_pp_state) {400 switch (prev_pp_state) {
324 .none => {401 .all => {
325 try stdout.writeAll("#ifdef PTR32\n");402 try stdout.print("#ifdef ARCH_{s}\n", .{@tagName(arch)});
326 prev_pp_state = .ptr32;403 prev_pp_state = .{ .single = arch };
327 },404 },
328 .special => {405 .multi, .family, .time32 => {
329 try stdout.writeAll("#endif\n#ifdef PTR32\n");406 try stdout.print("#endif\n#ifdef ARCH_{s}\n", .{@tagName(arch)});
330 prev_pp_state = .ptr32;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 }
331 },414 },
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 => {},
333 }444 }
334 } else {445 } else {
335 switch (prev_pp_state) {446 switch (prev_pp_state) {
336 .none => {},447 .all => {},
337 .special, .ptr32 => {448 .single, .multi, .family, .time32 => {
338 try stdout.writeAll("#endif\n");449 try stdout.writeAll("#endif\n");
339 },450 },
340 }451 }
341 prev_pp_state = .special;452 prev_pp_state = .multi;
342453
343 var first = true;454 var first = true;
344 try stdout.writeAll("#if ");455 try stdout.writeAll("#if ");
...@@ -366,6 +477,8 @@ pub fn main() !void {...@@ -366,6 +477,8 @@ pub fn main() !void {
366 }477 }
367 } else if (multi_sym.isWeak64()) {478 } else if (multi_sym.isWeak64()) {
368 try stdout.print("WEAK64 {s}\n", .{name});479 try stdout.print("WEAK64 {s}\n", .{name});
480 } else if (multi_sym.isWeakTime64()) {
481 try stdout.print("WEAKTIME64 {s}\n", .{name});
369 } else {482 } else {
370 for (arches, 0..) |arch, i| {483 for (arches, 0..) |arch, i| {
371 log.info("symbol '{s}' binding on {s}: {d}", .{484 log.info("symbol '{s}' binding on {s}: {d}", .{
...@@ -384,9 +497,9 @@ pub fn main() !void {...@@ -384,9 +497,9 @@ pub fn main() !void {
384 try stdout.print(".type {s}, %object;\n", .{name});497 try stdout.print(".type {s}, %object;\n", .{name});
385 if (multi_sym.commonSize()) |size| {498 if (multi_sym.commonSize()) |size| {
386 try stdout.print(".size {s}, {d}\n", .{ name, size });499 try stdout.print(".size {s}, {d}\n", .{ name, size });
387 } else if (multi_sym.isPtrSize()) {500 } else if (multi_sym.isPtrSize(1)) {
388 try stdout.print(".size {s}, PTR_SIZE_BYTES\n", .{name});501 try stdout.print(".size {s}, PTR_SIZE_BYTES\n", .{name});
389 } else if (multi_sym.isPtr2Size()) {502 } else if (multi_sym.isPtrSize(2)) {
390 try stdout.print(".size {s}, PTR2_SIZE_BYTES\n", .{name});503 try stdout.print(".size {s}, PTR2_SIZE_BYTES\n", .{name});
391 } else {504 } else {
392 for (arches, 0..) |arch, i| {505 for (arches, 0..) |arch, i| {
...@@ -410,8 +523,8 @@ pub fn main() !void {...@@ -410,8 +523,8 @@ pub fn main() !void {
410 }523 }
411524
412 switch (prev_pp_state) {525 switch (prev_pp_state) {
413 .none => {},526 .all => {},
414 .ptr32, .special => try stdout.writeAll("#endif\n"),527 .single, .multi, .family, .time32 => try stdout.writeAll("#endif\n"),
415 }528 }
416}529}
417530
...@@ -487,12 +600,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)...@@ -487,12 +600,17 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
487 const visib = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));600 const visib = @as(elf.STV, @enumFromInt(@as(u2, @truncate(sym.st_other))));
488 const size = s(sym.st_size);601 const size = s(sym.st_size);
489602
490 if (parse.blacklist.contains(name)) continue;
491
492 if (size == 0) {603 if (size == 0) {
493 log.warn("{s}: symbol '{s}' has size 0", .{ @tagName(parse.arch), name });604 log.warn("{s}: symbol '{s}' has size 0", .{ @tagName(parse.arch), name });
494 }605 }
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
496 switch (binding) {614 switch (binding) {
497 elf.STB_GLOBAL, elf.STB_WEAK => {},615 elf.STB_GLOBAL, elf.STB_WEAK => {},
498 else => {616 else => {
...@@ -590,40 +708,8 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)...@@ -590,40 +708,8 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian)
590 }708 }
591}709}
592710
593fn archIndex(arch: std.Target.Cpu.Arch) u8 {711fn archIndex(arch: Arch) u8 {
594 return switch (arch) {712 return @intFromEnum(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 };
627}713}
628714
629fn archSetName(arch_set: [arches.len]bool) []const u8 {715fn archSetName(arch_set: [arches.len]bool) []const u8 {
...@@ -639,529 +725,3 @@ fn fatal(comptime format: []const u8, args: anytype) noreturn {...@@ -639,529 +725,3 @@ fn fatal(comptime format: []const u8, args: anytype) noreturn {
639 log.err(format, args);725 log.err(format, args);
640 std.process.exit(1);726 std.process.exit(1);
641}727}
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};