@zigc/lib 0.17.0-dev.76 → 0.17.0-dev.813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/fcntl.zig +5 -0
- package/c/math.zig +41 -2
- package/c/pthread.zig +57 -0
- package/c/stdlib.zig +32 -22
- package/c/string.zig +20 -0
- package/c/unistd.zig +1 -0
- package/c/wchar.zig +10 -0
- package/c.zig +1 -0
- package/{std/Build → compiler/Maker}/Fuzz.zig +177 -89
- package/compiler/Maker/Graph.zig +85 -0
- package/compiler/Maker/PkgConfig.zig +122 -0
- package/compiler/Maker/ScannedConfig.zig +372 -0
- package/compiler/Maker/Step/CheckFile.zig +63 -0
- package/compiler/Maker/Step/Compile.zig +1388 -0
- package/compiler/Maker/Step/ConfigHeader.zig +610 -0
- package/compiler/Maker/Step/FindProgram.zig +120 -0
- package/compiler/Maker/Step/Fmt.zig +65 -0
- package/compiler/Maker/Step/InstallArtifact.zig +141 -0
- package/compiler/Maker/Step/InstallDir.zig +99 -0
- package/compiler/Maker/Step/InstallFile.zig +26 -0
- package/compiler/Maker/Step/ObjCopy.zig +173 -0
- package/compiler/Maker/Step/Options.zig +104 -0
- package/compiler/Maker/Step/Run.zig +2390 -0
- package/compiler/Maker/Step/TranslateC.zig +157 -0
- package/compiler/Maker/Step/UpdateSourceFiles.zig +89 -0
- package/compiler/Maker/Step/WriteFile.zig +294 -0
- package/compiler/Maker/Step.zig +894 -0
- package/{std/Build → compiler/Maker}/Watch/FsEvents.zig +36 -26
- package/{std/Build → compiler/Maker}/Watch.zig +89 -68
- package/{std/Build → compiler/Maker}/WebServer.zig +145 -118
- package/compiler/Maker.zig +2061 -0
- package/compiler/aro/aro/Attribute.zig +52 -51
- package/compiler/aro/aro/CodeGen.zig +7 -8
- package/compiler/aro/aro/Compilation.zig +22 -22
- package/compiler/aro/aro/Diagnostics.zig +7 -7
- package/compiler/aro/aro/Driver.zig +18 -16
- package/compiler/aro/aro/Parser.zig +22 -17
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor.zig +11 -8
- package/compiler/aro/aro/Tree.zig +11 -11
- package/compiler/aro/aro/features.zig +4 -4
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/text_literal.zig +5 -4
- package/compiler/aro/assembly_backend/x86_64.zig +4 -4
- package/compiler/aro/backend/Interner.zig +14 -13
- package/compiler/aro/backend/Ir/x86/Renderer.zig +3 -3
- package/compiler/configurer.zig +1402 -0
- package/compiler/reduce/Walk.zig +8 -13
- package/compiler/resinator/bmp.zig +3 -2
- package/compiler/resinator/code_pages.zig +14 -12
- package/compiler/resinator/compile.zig +1 -1
- package/compiler/resinator/cvtres.zig +15 -14
- package/compiler/resinator/errors.zig +25 -29
- package/compiler/resinator/ico.zig +4 -4
- package/compiler/resinator/lang.zig +7 -7
- package/compiler/resinator/parse.zig +3 -3
- package/compiler/resinator/res.zig +1 -1
- package/compiler/std-docs.zig +17 -38
- package/compiler/test_runner.zig +25 -15
- package/compiler/translate-c/MacroTranslator.zig +1 -1
- package/compiler/translate-c/Translator.zig +2 -2
- package/compiler/translate-c/ast.zig +22 -29
- package/compiler/translate-c/main.zig +1 -1
- package/compiler_rt/addf3.zig +1 -1
- package/compiler_rt/arm.zig +3 -3
- package/compiler_rt/atomics.zig +1 -1
- package/compiler_rt/comparef.zig +3 -3
- package/compiler_rt/cos.zig +1 -1
- package/compiler_rt/count0bits.zig +1 -1
- package/compiler_rt/divdf3.zig +2 -2
- package/compiler_rt/divsf3.zig +1 -1
- package/compiler_rt/divtf3.zig +1 -1
- package/compiler_rt/divxf3.zig +1 -1
- package/compiler_rt/extendf.zig +5 -5
- package/compiler_rt/fabs.zig +1 -1
- package/compiler_rt/float_from_int.zig +4 -5
- package/compiler_rt/fmax.zig +1 -1
- package/compiler_rt/fmin.zig +1 -1
- package/compiler_rt/fmod.zig +2 -2
- package/compiler_rt/int_from_float.zig +1 -1
- package/compiler_rt/limb64.zig +3 -34
- package/compiler_rt/log.zig +230 -3
- package/compiler_rt/log10.zig +228 -3
- package/compiler_rt/log2.zig +221 -3
- package/compiler_rt/log_f128.zig +173 -0
- package/compiler_rt/mulf3.zig +2 -2
- package/compiler_rt/rem_pio2l.zig +1 -1
- package/compiler_rt/sin.zig +1 -1
- package/compiler_rt/sincos.zig +1 -1
- package/compiler_rt/ssp.zig +2 -2
- package/compiler_rt/tan.zig +1 -1
- package/compiler_rt/truncf.zig +3 -3
- package/compiler_rt/trunctfhf2.zig +3 -0
- package/compiler_rt.zig +5 -26
- package/docs/main.js +8 -8
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/docs/wasm/markdown/Document.zig +3 -3
- package/docs/wasm/markdown/Parser.zig +19 -23
- package/fuzzer.zig +5 -3
- package/include/__clang_spirv_builtins.h +12 -12
- package/include/__float_float.h +176 -0
- package/include/__float_header_macro.h +12 -0
- package/include/__float_infinity_nan.h +20 -0
- package/include/amo.h +131 -0
- package/include/amxavx512intrin.h +215 -1
- package/include/amxintrin.h +0 -2
- package/include/arm_acle.h +37 -27
- package/include/arm_neon.h +218 -82
- package/include/arm_sme.h +8 -8
- package/include/arm_sve.h +4162 -3782
- package/include/avx10_2_512bf16intrin.h +19 -12
- package/include/avx10_2_512convertintrin.h +1 -1
- package/include/avx10_2_512niintrin.h +31 -31
- package/include/avx10_2_512satcvtdsintrin.h +1 -1
- package/include/avx10_2bf16intrin.h +54 -45
- package/include/avx10_2convertintrin.h +2 -2
- package/include/avx10_2copyintrin.h +1 -1
- package/include/avx10_2niintrin.h +14 -14
- package/include/avx10_2satcvtdsintrin.h +2 -2
- package/include/avx2intrin.h +275 -377
- package/include/avx512bf16intrin.h +25 -16
- package/include/avx512bitalgintrin.h +19 -30
- package/include/avx512bwintrin.h +386 -505
- package/include/avx512cdintrin.h +42 -55
- package/include/avx512dqintrin.h +132 -161
- package/include/avx512fintrin.h +1015 -1424
- package/include/avx512fp16intrin.h +112 -110
- package/include/avx512ifmaintrin.h +32 -34
- package/include/avx512ifmavlintrin.h +73 -46
- package/include/avx512vbmi2intrin.h +43 -32
- package/include/avx512vbmiintrin.h +19 -27
- package/include/avx512vbmivlintrin.h +35 -49
- package/include/avx512vlbf16intrin.h +32 -22
- package/include/avx512vlbitalgintrin.h +37 -53
- package/include/avx512vlbwintrin.h +470 -573
- package/include/avx512vlcdintrin.h +74 -102
- package/include/avx512vldqintrin.h +110 -127
- package/include/avx512vlfp16intrin.h +130 -111
- package/include/avx512vlintrin.h +945 -1299
- package/include/avx512vlvbmi2intrin.h +78 -63
- package/include/avx512vlvnniintrin.h +21 -18
- package/include/avx512vlvp2intersectintrin.h +2 -2
- package/include/avx512vnniintrin.h +10 -10
- package/include/avx512vp2intersectintrin.h +1 -2
- package/include/avx512vpopcntdqintrin.h +8 -10
- package/include/avx512vpopcntdqvlintrin.h +17 -15
- package/include/avxifmaintrin.h +16 -0
- package/include/avxintrin.h +165 -241
- package/include/avxvnniint16intrin.h +118 -99
- package/include/avxvnniint8intrin.h +56 -32
- package/include/avxvnniintrin.h +16 -8
- package/include/cpuid.h +101 -4
- package/include/emmintrin.h +168 -168
- package/include/f16cintrin.h +23 -9
- package/include/float.h +16 -155
- package/include/fma4intrin.h +98 -96
- package/include/fmaintrin.h +96 -66
- package/include/gfniintrin.h +21 -16
- package/include/hexagon_types.h +23 -20
- package/include/hvx_hexagon_protos.h +649 -860
- package/include/immintrin.h +0 -12
- package/include/intrin.h +4 -0
- package/include/lasxintrin.h +113 -0
- package/include/llvm_libc_wrappers/assert.h +3 -5
- package/include/llvm_libc_wrappers/ctype.h +3 -115
- package/include/llvm_libc_wrappers/inttypes.h +3 -5
- package/include/llvm_libc_wrappers/stdio.h +10 -38
- package/include/llvm_libc_wrappers/stdlib.h +3 -24
- package/include/llvm_libc_wrappers/string.h +2 -70
- package/include/llvm_libc_wrappers/time.h +4 -10
- package/include/mmintrin.h +188 -257
- package/include/module.modulemap +23 -4
- package/include/movrs_avx10_2_512intrin.h +2 -2
- package/include/movrs_avx10_2intrin.h +4 -4
- package/include/pmmintrin.h +12 -24
- package/include/ptrauth.h +16 -2
- package/include/riscv_mips.h +34 -0
- package/include/riscv_nds.h +89 -0
- package/include/sifive_vector.h +58 -2
- package/include/sm4evexintrin.h +2 -2
- package/include/smmintrin.h +77 -59
- package/include/spirvintrin.h +194 -0
- package/include/stddefer.h +19 -0
- package/include/tmmintrin.h +116 -147
- package/include/vaesintrin.h +1 -2
- package/include/xmmintrin.h +44 -70
- package/include/xopintrin.h +20 -10
- package/init/build.zig +1 -3
- package/libc/darwin/SDKSettings.json +1 -1
- package/libc/darwin/libSystem.tbd +88 -87
- package/libc/include/aarch64-linux-any/asm/hwcap.h +1 -0
- package/libc/include/aarch64-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/aarch64-netbsd-none/aarch64/armreg.h +259 -22
- package/libc/include/aarch64-netbsd-none/aarch64/byte_swap.h +3 -2
- package/libc/include/aarch64-netbsd-none/aarch64/cpu.h +26 -1
- package/libc/include/aarch64-netbsd-none/aarch64/lwp_private.h +3 -0
- package/libc/include/aarch64-netbsd-none/aarch64/pmap.h +7 -33
- package/libc/include/aarch64-netbsd-none/aarch64/sljit_machdep.h +1 -1
- package/libc/include/aarch64-netbsd-none/aarch64/vmparam.h +4 -4
- package/libc/include/aarch64-netbsd-none/machine/armreg.h +259 -22
- package/libc/include/aarch64-netbsd-none/machine/byte_swap.h +3 -2
- package/libc/include/aarch64-netbsd-none/machine/cpu.h +26 -1
- package/libc/include/aarch64-netbsd-none/machine/lwp_private.h +3 -0
- package/libc/include/aarch64-netbsd-none/machine/pmap.h +7 -33
- package/libc/include/aarch64-netbsd-none/machine/sljit_machdep.h +1 -1
- package/libc/include/aarch64-netbsd-none/machine/vmparam.h +4 -4
- package/libc/include/aarch64-openbsd-none/arm64/cpu.h +7 -1
- package/libc/include/aarch64-openbsd-none/arm64/intr.h +9 -1
- package/libc/include/aarch64-openbsd-none/machine/cpu.h +7 -1
- package/libc/include/aarch64-openbsd-none/machine/intr.h +9 -1
- package/libc/include/any-darwin-any/AvailabilityInternal.h +10 -10
- package/libc/include/any-darwin-any/AvailabilityVersions.h +8 -0
- package/libc/include/any-darwin-any/mach/host_info.h +3 -1
- package/libc/include/any-darwin-any/mach/mach_voucher_types.h +2 -0
- package/libc/include/any-darwin-any/mach/vm_statistics.h +33 -2
- package/libc/include/any-darwin-any/spawn.h +3 -1
- package/libc/include/any-darwin-any/sys/_symbol_aliasing.h +12 -0
- package/libc/include/any-linux-any/asm-generic/errno.h +2 -0
- package/libc/include/any-linux-any/asm-generic/unistd.h +4 -1
- package/libc/include/any-linux-any/drm/amdgpu_drm.h +20 -6
- package/libc/include/any-linux-any/drm/amdxdna_accel.h +8 -0
- package/libc/include/any-linux-any/drm/drm_fourcc.h +6 -6
- package/libc/include/any-linux-any/drm/panfrost_drm.h +75 -1
- package/libc/include/any-linux-any/drm/panthor_drm.h +154 -3
- package/libc/include/any-linux-any/drm/rocket_accel.h +74 -24
- package/libc/include/any-linux-any/drm/xe_drm.h +89 -6
- package/libc/include/any-linux-any/linux/android/binder.h +1 -1
- package/libc/include/any-linux-any/linux/bpf.h +28 -0
- package/libc/include/any-linux-any/linux/btrfs.h +1 -0
- package/libc/include/any-linux-any/linux/btrfs_tree.h +32 -2
- package/libc/include/any-linux-any/linux/dma-buf.h +1 -0
- package/libc/include/any-linux-any/linux/dpll.h +1 -0
- package/libc/include/any-linux-any/linux/elf.h +2 -0
- package/libc/include/any-linux-any/linux/ethtool.h +21 -5
- package/libc/include/any-linux-any/linux/fs.h +1 -0
- package/libc/include/any-linux-any/linux/hyperv.h +1 -1
- package/libc/include/any-linux-any/linux/idxd.h +134 -134
- package/libc/include/any-linux-any/linux/if_alg.h +1 -1
- package/libc/include/any-linux-any/linux/if_link.h +1 -0
- package/libc/include/any-linux-any/linux/input-event-codes.h +4 -0
- package/libc/include/any-linux-any/linux/io_uring/bpf_filter.h +68 -0
- package/libc/include/any-linux-any/linux/io_uring/query.h +5 -1
- package/libc/include/any-linux-any/linux/io_uring.h +33 -2
- package/libc/include/any-linux-any/linux/iommufd.h +39 -0
- package/libc/include/any-linux-any/linux/kfd_ioctl.h +13 -3
- package/libc/include/any-linux-any/linux/kfd_sysfs.h +2 -1
- package/libc/include/any-linux-any/linux/kvm.h +30 -6
- package/libc/include/any-linux-any/linux/landlock.h +22 -8
- package/libc/include/any-linux-any/linux/magic.h +1 -0
- package/libc/include/any-linux-any/linux/mempolicy.h +3 -0
- package/libc/include/any-linux-any/linux/mount.h +11 -2
- package/libc/include/any-linux-any/linux/mptcp_pm.h +1 -1
- package/libc/include/any-linux-any/linux/mshv.h +2 -0
- package/libc/include/any-linux-any/linux/netfilter_bridge.h +5 -4
- package/libc/include/any-linux-any/linux/netfilter_ipv4.h +4 -5
- package/libc/include/any-linux-any/linux/netfilter_ipv6.h +3 -4
- package/libc/include/any-linux-any/linux/nfs.h +1 -1
- package/libc/include/any-linux-any/linux/nfsd_netlink.h +1 -0
- package/libc/include/any-linux-any/linux/nilfs2_api.h +2 -2
- package/libc/include/any-linux-any/linux/nilfs2_ondisk.h +97 -66
- package/libc/include/any-linux-any/linux/nl80211.h +104 -3
- package/libc/include/any-linux-any/linux/pci.h +7 -0
- package/libc/include/any-linux-any/linux/pci_regs.h +65 -6
- package/libc/include/any-linux-any/linux/pcitest.h +1 -0
- package/libc/include/any-linux-any/linux/perf_event.h +24 -3
- package/libc/include/any-linux-any/linux/pkt_sched.h +1 -0
- package/libc/include/any-linux-any/linux/prctl.h +30 -0
- package/libc/include/any-linux-any/linux/rseq.h +62 -5
- package/libc/include/any-linux-any/linux/shm.h +0 -1
- package/libc/include/any-linux-any/linux/stddef.h +4 -0
- package/libc/include/any-linux-any/linux/sysctl.h +1 -2
- package/libc/include/any-linux-any/linux/taskstats.h +12 -1
- package/libc/include/any-linux-any/linux/tcp.h +23 -3
- package/libc/include/any-linux-any/linux/typelimits.h +8 -0
- package/libc/include/any-linux-any/linux/ublk_cmd.h +120 -1
- package/libc/include/any-linux-any/linux/v4l2-controls.h +63 -0
- package/libc/include/any-linux-any/linux/vbox_vmmdev_types.h +2 -2
- package/libc/include/any-linux-any/linux/vduse.h +80 -5
- package/libc/include/any-linux-any/linux/version.h +3 -3
- package/libc/include/any-linux-any/linux/vfio.h +4 -0
- package/libc/include/any-linux-any/linux/videodev2.h +3 -0
- package/libc/include/any-linux-any/linux/virtio_ring.h +1 -2
- package/libc/include/any-linux-any/linux/vmclock-abi.h +20 -0
- package/libc/include/any-linux-any/rdma/bnxt_re-abi.h +16 -0
- package/libc/include/any-linux-any/rdma/ib_user_ioctl_cmds.h +16 -0
- package/libc/include/any-linux-any/rdma/mana-abi.h +3 -0
- package/libc/include/any-linux-any/scsi/scsi_bsg_ufs.h +8 -9
- package/libc/include/any-linux-any/sound/sof/tokens.h +6 -0
- package/libc/include/arc-linux-any/asm/swab.h +0 -63
- package/libc/include/arc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/arm-linux-any/asm/ptrace.h +0 -9
- package/libc/include/arm-linux-any/asm/unistd-eabi.h +1 -0
- package/libc/include/arm-linux-any/asm/unistd-oabi.h +1 -0
- package/libc/include/arm-netbsd-eabi/float.h +2 -1
- package/libc/include/arm-netbsd-eabi/machine/asm.h +48 -19
- package/libc/include/arm-netbsd-eabi/machine/byte_swap.h +121 -0
- package/libc/include/arm-netbsd-eabi/machine/cpu.h +1 -3
- package/libc/include/arm-netbsd-eabi/machine/float.h +2 -1
- package/libc/include/arm-netbsd-eabi/machine/lwp_private.h +81 -0
- package/libc/include/arm-netbsd-eabi/machine/mcontext.h +5 -51
- package/libc/include/arm-netbsd-eabi/machine/mutex.h +1 -1
- package/libc/include/arm-netbsd-eabi/machine/proc.h +2 -2
- package/libc/include/arm-netbsd-eabi/machine/profile.h +28 -96
- package/libc/include/arm-netbsd-eabi/machine/setjmp.h +7 -6
- package/libc/include/arm-netbsd-eabi/machine/sysarch.h +85 -0
- package/libc/include/csky-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/generic-netbsd/altq/altq.h +2 -2
- package/libc/include/generic-netbsd/altq/altq_afmap.h +2 -1
- package/libc/include/generic-netbsd/altq/altq_classq.h +8 -6
- package/libc/include/generic-netbsd/altq/altq_jobs.h +37 -37
- package/libc/include/generic-netbsd/altq/altq_rmclass.h +8 -8
- package/libc/include/generic-netbsd/altq/altq_var.h +2 -2
- package/libc/include/generic-netbsd/arm/arm32/pmap.h +8 -32
- package/libc/include/generic-netbsd/arm/arm32/vmparam.h +5 -5
- package/libc/include/generic-netbsd/arm/asm.h +48 -19
- package/libc/include/generic-netbsd/arm/byte_swap.h +2 -2
- package/libc/include/generic-netbsd/arm/cpu.h +1 -3
- package/libc/include/generic-netbsd/arm/cputypes.h +12 -1
- package/libc/include/generic-netbsd/arm/float.h +2 -1
- package/libc/include/generic-netbsd/arm/lwp_private.h +81 -0
- package/libc/include/generic-netbsd/arm/mcontext.h +5 -51
- package/libc/include/generic-netbsd/arm/mutex.h +1 -1
- package/libc/include/generic-netbsd/arm/proc.h +2 -2
- package/libc/include/generic-netbsd/arm/profile.h +28 -96
- package/libc/include/generic-netbsd/arm/setjmp.h +7 -6
- package/libc/include/generic-netbsd/arpa/nameser.h +3 -3
- package/libc/include/generic-netbsd/arpa/nameser_compat.h +3 -3
- package/libc/include/generic-netbsd/assert.h +12 -22
- package/libc/include/generic-netbsd/bitstring.h +5 -5
- package/libc/include/generic-netbsd/cdbw.h +2 -2
- package/libc/include/generic-netbsd/crypto/cryptodev.h +99 -92
- package/libc/include/generic-netbsd/dev/i2c/emcfaninfo.h +234 -0
- package/libc/include/generic-netbsd/dev/i2c/emcfanreg.h +127 -0
- package/libc/include/generic-netbsd/dev/i2o/i2o.h +3 -366
- package/libc/include/generic-netbsd/dev/ic/hd44780var.h +3 -1
- package/libc/include/generic-netbsd/dev/ic/scmdreg.h +2 -2
- package/libc/include/generic-netbsd/dev/ic/stireg.h +777 -0
- package/libc/include/generic-netbsd/dev/ic/summitreg.h +214 -0
- package/libc/include/generic-netbsd/dev/iscsi/iscsi.h +1 -1
- package/libc/include/generic-netbsd/dev/pci/amrreg.h +2 -2
- package/libc/include/generic-netbsd/dev/pci/mlyreg.h +2 -2
- package/libc/include/generic-netbsd/dev/pci/pcidevs.h +177 -22
- package/libc/include/generic-netbsd/dev/pci/pcidevs_data.h +14971 -14588
- package/libc/include/generic-netbsd/dev/pci/pcireg.h +14 -14
- package/libc/include/generic-netbsd/dev/pckbc/pckbdreg.h +2 -1
- package/libc/include/generic-netbsd/dev/pcmcia/if_rayreg.h +2 -2
- package/libc/include/generic-netbsd/dev/raidframe/raidframeio.h +1 -1
- package/libc/include/generic-netbsd/dev/scsipi/scsi_disk.h +42 -7
- package/libc/include/generic-netbsd/dev/scsipi/scsi_spc.h +2 -2
- package/libc/include/generic-netbsd/dev/scsipi/scsipi_all.h +83 -2
- package/libc/include/generic-netbsd/dev/scsipi/scsipiconf.h +3 -1
- package/libc/include/generic-netbsd/dev/tc/sfbreg.h +3 -3
- package/libc/include/generic-netbsd/dev/tc/sticio.h +2 -2
- package/libc/include/generic-netbsd/dev/usb/umcpmio_hid_reports.h +499 -0
- package/libc/include/generic-netbsd/dev/usb/umcpmio_io.h +45 -0
- package/libc/include/generic-netbsd/dev/usb/usb.h +44 -6
- package/libc/include/generic-netbsd/dev/vndvar.h +2 -2
- package/libc/include/generic-netbsd/dev/wscons/wsconsio.h +19 -1
- package/libc/include/generic-netbsd/dev/wscons/wsksymdef.h +2 -2
- package/libc/include/generic-netbsd/dirent.h +1 -1
- package/libc/include/generic-netbsd/dlfcn.h +4 -2
- package/libc/include/generic-netbsd/elf.h +32 -20
- package/libc/include/generic-netbsd/elfdefinitions.h +1 -1
- package/libc/include/generic-netbsd/evbarm/intr.h +1 -1
- package/libc/include/generic-netbsd/evbmips/lwp_private.h +3 -0
- package/libc/include/generic-netbsd/execinfo.h +4 -2
- package/libc/include/generic-netbsd/fcntl.h +26 -2
- package/libc/include/generic-netbsd/float.h +58 -2
- package/libc/include/generic-netbsd/fmtmsg.h +2 -2
- package/libc/include/generic-netbsd/fs/hfs/libhfs.h +1 -1
- package/libc/include/generic-netbsd/fs/nilfs/nilfs_fs.h +2 -2
- package/libc/include/generic-netbsd/gelf.h +2 -2
- package/libc/include/generic-netbsd/i386/asm.h +12 -4
- package/libc/include/generic-netbsd/i386/byte_swap.h +2 -2
- package/libc/include/generic-netbsd/i386/cpu.h +15 -4
- package/libc/include/generic-netbsd/i386/elf_machdep.h +2 -1
- package/libc/include/generic-netbsd/i386/lwp_private.h +3 -0
- package/libc/include/generic-netbsd/i386/mcontext.h +6 -24
- package/libc/include/generic-netbsd/i386/param.h +9 -1
- package/libc/include/generic-netbsd/i386/pcb.h +6 -2
- package/libc/include/generic-netbsd/i386/ptrace.h +2 -2
- package/libc/include/generic-netbsd/i386/types.h +2 -1
- package/libc/include/generic-netbsd/i386/wchar_limits.h +1 -1
- package/libc/include/generic-netbsd/isofs/cd9660/cd9660_extern.h +6 -1
- package/libc/include/generic-netbsd/isofs/cd9660/cd9660_mount.h +7 -1
- package/libc/include/generic-netbsd/langinfo.h +2 -1
- package/libc/include/generic-netbsd/lauxlib.h +1 -1
- package/libc/include/generic-netbsd/libelf.h +6 -15
- package/libc/include/generic-netbsd/limits.h +1 -1
- package/libc/include/generic-netbsd/lua.h +1 -1
- package/libc/include/generic-netbsd/luaconf.h +1 -1
- package/libc/include/generic-netbsd/lualib.h +1 -1
- package/libc/include/generic-netbsd/lwp.h +1 -1
- package/libc/include/generic-netbsd/machine/ansi.h +2 -2
- package/libc/include/generic-netbsd/machine/aout_machdep.h +39 -2
- package/libc/include/generic-netbsd/machine/arm32/pmap.h +8 -32
- package/libc/include/generic-netbsd/machine/arm32/vmparam.h +5 -5
- package/libc/include/generic-netbsd/machine/asm.h +271 -2
- package/libc/include/generic-netbsd/machine/bswap.h +9 -1
- package/libc/include/generic-netbsd/machine/byte_swap.h +42 -64
- package/libc/include/generic-netbsd/machine/cdefs.h +7 -2
- package/libc/include/generic-netbsd/machine/cpu.h +207 -30
- package/libc/include/generic-netbsd/machine/cputypes.h +12 -1
- package/libc/include/generic-netbsd/machine/disklabel.h +41 -42
- package/libc/include/generic-netbsd/machine/elf_machdep.h +143 -2
- package/libc/include/generic-netbsd/machine/endian.h +1 -1
- package/libc/include/generic-netbsd/machine/fenv.h +35 -2
- package/libc/include/generic-netbsd/machine/float.h +58 -2
- package/libc/include/generic-netbsd/machine/frame.h +129 -2
- package/libc/include/generic-netbsd/machine/ieee.h +3 -2
- package/libc/include/generic-netbsd/machine/ieeefp.h +43 -2
- package/libc/include/generic-netbsd/machine/int_const.h +32 -2
- package/libc/include/generic-netbsd/machine/int_fmtio.h +380 -2
- package/libc/include/generic-netbsd/machine/int_limits.h +2 -2
- package/libc/include/generic-netbsd/machine/int_mwgwtypes.h +2 -2
- package/libc/include/generic-netbsd/machine/int_types.h +2 -2
- package/libc/include/generic-netbsd/machine/kcore.h +39 -2
- package/libc/include/generic-netbsd/machine/limits.h +2 -2
- package/libc/include/generic-netbsd/machine/lock.h +2 -2
- package/libc/include/generic-netbsd/machine/lwp_private.h +83 -0
- package/libc/include/generic-netbsd/machine/math.h +3 -2
- package/libc/include/generic-netbsd/machine/mcontext.h +149 -2
- package/libc/include/generic-netbsd/machine/mutex.h +127 -2
- package/libc/include/generic-netbsd/machine/param.h +90 -23
- package/libc/include/generic-netbsd/machine/pcb.h +54 -2
- package/libc/include/generic-netbsd/machine/pmap.h +262 -2
- package/libc/include/generic-netbsd/machine/proc.h +75 -2
- package/libc/include/generic-netbsd/machine/profile.h +116 -2
- package/libc/include/generic-netbsd/machine/psl.h +2 -2
- package/libc/include/generic-netbsd/machine/pte.h +346 -2
- package/libc/include/generic-netbsd/machine/ptrace.h +62 -2
- package/libc/include/generic-netbsd/machine/reg.h +124 -2
- package/libc/include/generic-netbsd/machine/reloc.h +2 -2
- package/libc/include/generic-netbsd/machine/setjmp.h +69 -2
- package/libc/include/generic-netbsd/machine/signal.h +39 -2
- package/libc/include/generic-netbsd/machine/sljit_machdep.h +1 -1
- package/libc/include/generic-netbsd/machine/sysarch.h +2 -84
- package/libc/include/generic-netbsd/machine/sysreg.h +354 -0
- package/libc/include/generic-netbsd/machine/trap.h +2 -2
- package/libc/include/generic-netbsd/machine/types.h +118 -6
- package/libc/include/generic-netbsd/machine/vmparam.h +235 -2
- package/libc/include/generic-netbsd/machine/wchar_limits.h +2 -2
- package/libc/include/generic-netbsd/math.h +19 -6
- package/libc/include/generic-netbsd/md2.h +6 -3
- package/libc/include/generic-netbsd/mips/asm.h +69 -17
- package/libc/include/generic-netbsd/mips/bswap.h +3 -1
- package/libc/include/generic-netbsd/mips/cpu.h +7 -7
- package/libc/include/generic-netbsd/mips/elf_machdep.h +2 -1
- package/libc/include/generic-netbsd/mips/fenv.h +2 -1
- package/libc/include/generic-netbsd/mips/float.h +3 -2
- package/libc/include/generic-netbsd/mips/frame.h +3 -2
- package/libc/include/generic-netbsd/mips/limits.h +4 -13
- package/libc/include/generic-netbsd/mips/lwp_private.h +87 -0
- package/libc/include/generic-netbsd/mips/mcontext.h +2 -53
- package/libc/include/generic-netbsd/mips/mips3_pte.h +2 -2
- package/libc/include/generic-netbsd/mips/mips_param.h +16 -2
- package/libc/include/generic-netbsd/mips/mutex.h +1 -1
- package/libc/include/generic-netbsd/mips/types.h +1 -1
- package/libc/include/generic-netbsd/mips/vmparam.h +1 -1
- package/libc/include/generic-netbsd/miscfs/kernfs/kernfs.h +2 -2
- package/libc/include/generic-netbsd/miscfs/procfs/procfs.h +33 -2
- package/libc/include/generic-netbsd/miscfs/specfs/specdev.h +1 -2
- package/libc/include/generic-netbsd/monetary.h +2 -1
- package/libc/include/generic-netbsd/net/agr/if_agrioctl.h +2 -2
- package/libc/include/generic-netbsd/net/bpf.h +11 -4
- package/libc/include/generic-netbsd/net/bpfdesc.h +1 -1
- package/libc/include/generic-netbsd/net/dlt.h +222 -48
- package/libc/include/generic-netbsd/net/if.h +20 -5
- package/libc/include/generic-netbsd/net/if_bridgevar.h +2 -3
- package/libc/include/generic-netbsd/net/if_ether.h +4 -3
- package/libc/include/generic-netbsd/net/if_lagg.h +2 -2
- package/libc/include/generic-netbsd/net/if_media.h +2 -2
- package/libc/include/generic-netbsd/net/if_ppp.h +1 -3
- package/libc/include/generic-netbsd/net/if_stats.h +19 -5
- package/libc/include/generic-netbsd/net/net_stats.h +13 -6
- package/libc/include/generic-netbsd/net/npf.h +33 -5
- package/libc/include/generic-netbsd/net/pfkeyv2.h +1 -1
- package/libc/include/generic-netbsd/net/route.h +4 -4
- package/libc/include/generic-netbsd/net80211/ieee80211_node.h +3 -2
- package/libc/include/generic-netbsd/net80211/ieee80211_var.h +2 -2
- package/libc/include/generic-netbsd/netbt/hci.h +3 -3
- package/libc/include/generic-netbsd/netdb.h +2 -2
- package/libc/include/generic-netbsd/netinet/icmp6.h +6 -2
- package/libc/include/generic-netbsd/netinet/in.h +17 -17
- package/libc/include/generic-netbsd/netinet/in_var.h +5 -9
- package/libc/include/generic-netbsd/netinet/ip_mroute.h +24 -28
- package/libc/include/generic-netbsd/netinet/ip_var.h +2 -2
- package/libc/include/generic-netbsd/netinet/sctp.h +4 -4
- package/libc/include/generic-netbsd/netinet/tcp_var.h +2 -2
- package/libc/include/generic-netbsd/netinet/tcp_vtw.h +2 -2
- package/libc/include/generic-netbsd/netinet6/in6_var.h +7 -33
- package/libc/include/generic-netbsd/netinet6/ip6_var.h +2 -2
- package/libc/include/generic-netbsd/nfs/krpc.h +9 -4
- package/libc/include/generic-netbsd/nfs/nfs.h +5 -3
- package/libc/include/generic-netbsd/nfs/nfsdiskless.h +37 -20
- package/libc/include/generic-netbsd/nfs/nfsm_subs.h +4 -7
- package/libc/include/generic-netbsd/nfs/nfsmount.h +3 -4
- package/libc/include/generic-netbsd/nfs/nfsnode.h +9 -6
- package/libc/include/generic-netbsd/nfs/nfsproto.h +5 -2
- package/libc/include/generic-netbsd/nfs/nfsrtt.h +8 -4
- package/libc/include/generic-netbsd/nfs/nfsrvcache.h +9 -3
- package/libc/include/generic-netbsd/nfs/rpcv2.h +5 -3
- package/libc/include/generic-netbsd/nfs/xdr_subs.h +6 -5
- package/libc/include/generic-netbsd/nl_types.h +3 -1
- package/libc/include/generic-netbsd/ntfs/ntfs_inode.h +2 -2
- package/libc/include/generic-netbsd/poll.h +8 -2
- package/libc/include/generic-netbsd/prop/prop_object.h +48 -3
- package/libc/include/generic-netbsd/protocols/talkd.h +2 -2
- package/libc/include/generic-netbsd/pthread.h +51 -12
- package/libc/include/generic-netbsd/regex.h +2 -1
- package/libc/include/generic-netbsd/riscv/ansi.h +3 -0
- package/libc/include/generic-netbsd/riscv/aout_machdep.h +40 -0
- package/libc/include/generic-netbsd/riscv/asm.h +272 -0
- package/libc/include/generic-netbsd/riscv/bswap.h +11 -0
- package/libc/include/generic-netbsd/riscv/byte_swap.h +99 -0
- package/libc/include/generic-netbsd/riscv/cdefs.h +8 -0
- package/libc/include/generic-netbsd/riscv/cpu.h +242 -0
- package/libc/include/generic-netbsd/riscv/disklabel.h +68 -0
- package/libc/include/generic-netbsd/riscv/elf_machdep.h +144 -0
- package/libc/include/generic-netbsd/riscv/endian.h +3 -0
- package/libc/include/generic-netbsd/riscv/endian_machdep.h +3 -0
- package/libc/include/generic-netbsd/riscv/fenv.h +36 -0
- package/libc/include/generic-netbsd/riscv/float.h +59 -0
- package/libc/include/generic-netbsd/riscv/ieee.h +4 -0
- package/libc/include/generic-netbsd/riscv/ieeefp.h +44 -0
- package/libc/include/generic-netbsd/riscv/int_const.h +33 -0
- package/libc/include/generic-netbsd/riscv/int_fmtio.h +381 -0
- package/libc/include/generic-netbsd/riscv/int_limits.h +3 -0
- package/libc/include/generic-netbsd/riscv/int_mwgwtypes.h +3 -0
- package/libc/include/generic-netbsd/riscv/int_types.h +3 -0
- package/libc/include/generic-netbsd/riscv/kcore.h +40 -0
- package/libc/include/generic-netbsd/riscv/limits.h +3 -0
- package/libc/include/generic-netbsd/riscv/lock.h +3 -0
- package/libc/include/generic-netbsd/riscv/lwp_private.h +83 -0
- package/libc/include/generic-netbsd/riscv/math.h +4 -0
- package/libc/include/generic-netbsd/riscv/mcontext.h +150 -0
- package/libc/include/generic-netbsd/riscv/mutex.h +128 -0
- package/libc/include/generic-netbsd/riscv/param.h +110 -0
- package/libc/include/generic-netbsd/riscv/pcb.h +55 -0
- package/libc/include/generic-netbsd/riscv/pmap.h +263 -0
- package/libc/include/generic-netbsd/riscv/proc.h +76 -0
- package/libc/include/generic-netbsd/riscv/profile.h +117 -0
- package/libc/include/generic-netbsd/riscv/pte.h +347 -0
- package/libc/include/generic-netbsd/riscv/ptrace.h +63 -0
- package/libc/include/generic-netbsd/riscv/reg.h +125 -0
- package/libc/include/generic-netbsd/riscv/rwlock.h +1 -0
- package/libc/include/generic-netbsd/riscv/setjmp.h +70 -0
- package/libc/include/generic-netbsd/riscv/signal.h +40 -0
- package/libc/include/generic-netbsd/riscv/sysarch.h +3 -0
- package/libc/include/generic-netbsd/riscv/sysreg.h +354 -0
- package/libc/include/generic-netbsd/riscv/types.h +123 -0
- package/libc/include/generic-netbsd/riscv/vmparam.h +236 -0
- package/libc/include/generic-netbsd/riscv/wchar_limits.h +13 -0
- package/libc/include/generic-netbsd/rmd160.h +3 -3
- package/libc/include/generic-netbsd/rpc/xdr.h +3 -3
- package/libc/include/generic-netbsd/rpcsvc/yp_prot.h +3 -2
- package/libc/include/generic-netbsd/rump/rump_namei.h +2 -2
- package/libc/include/generic-netbsd/rump/rump_syscalls.h +4 -4
- package/libc/include/generic-netbsd/rump/rumpuser.h +6 -1
- package/libc/include/generic-netbsd/rump/rumpvnode_if.h +2 -2
- package/libc/include/generic-netbsd/sha1.h +3 -3
- package/libc/include/generic-netbsd/sha2.h +8 -1
- package/libc/include/generic-netbsd/signal.h +4 -4
- package/libc/include/generic-netbsd/sparc/asm.h +10 -1
- package/libc/include/generic-netbsd/sparc/bswap.h +9 -1
- package/libc/include/generic-netbsd/sparc/cgtworeg.h +2 -2
- package/libc/include/generic-netbsd/sparc/cpu.h +1 -1
- package/libc/include/generic-netbsd/sparc/float.h +3 -1
- package/libc/include/generic-netbsd/sparc/limits.h +4 -6
- package/libc/include/generic-netbsd/sparc/lwp_private.h +51 -0
- package/libc/include/generic-netbsd/sparc/mcontext.h +4 -22
- package/libc/include/generic-netbsd/sparc/mutex.h +1 -1
- package/libc/include/generic-netbsd/sparc/param.h +4 -2
- package/libc/include/generic-netbsd/sparc/pmap.h +2 -2
- package/libc/include/generic-netbsd/sparc/psl.h +6 -3
- package/libc/include/generic-netbsd/sparc/types.h +2 -2
- package/libc/include/generic-netbsd/sparc64/bswap.h +9 -1
- package/libc/include/generic-netbsd/sparc64/cpu.h +2 -2
- package/libc/include/generic-netbsd/sparc64/ctlreg.h +8 -7
- package/libc/include/generic-netbsd/sparc64/intr.h +1 -1
- package/libc/include/generic-netbsd/sparc64/lwp_private.h +3 -0
- package/libc/include/generic-netbsd/sparc64/mcontext.h +4 -4
- package/libc/include/generic-netbsd/sparc64/mutex.h +1 -1
- package/libc/include/generic-netbsd/sparc64/param.h +8 -2
- package/libc/include/generic-netbsd/sparc64/psl.h +7 -2
- package/libc/include/generic-netbsd/sparc64/pte.h +2 -2
- package/libc/include/generic-netbsd/sparc64/vmparam.h +1 -1
- package/libc/include/generic-netbsd/ssp/ssp.h +16 -6
- package/libc/include/generic-netbsd/stdalign.h +3 -3
- package/libc/include/generic-netbsd/stdarg.h +2 -2
- package/libc/include/generic-netbsd/stddef.h +90 -12
- package/libc/include/generic-netbsd/stdlib.h +11 -2
- package/libc/include/generic-netbsd/stdnoreturn.h +2 -2
- package/libc/include/generic-netbsd/string.h +66 -39
- package/libc/include/generic-netbsd/strings.h +17 -3
- package/libc/include/generic-netbsd/sys/atomic.h +10 -5
- package/libc/include/generic-netbsd/sys/bitops.h +2 -2
- package/libc/include/generic-netbsd/sys/bootblock.h +13 -2
- package/libc/include/generic-netbsd/sys/bswap.h +46 -20
- package/libc/include/generic-netbsd/sys/buf.h +3 -3
- package/libc/include/generic-netbsd/sys/cdefs.h +44 -6
- package/libc/include/generic-netbsd/sys/cdefs_aout.h +8 -1
- package/libc/include/generic-netbsd/sys/cdefs_elf.h +9 -2
- package/libc/include/generic-netbsd/sys/chio.h +2 -2
- package/libc/include/generic-netbsd/sys/clock.h +5 -1
- package/libc/include/generic-netbsd/sys/common_limits.h +3 -1
- package/libc/include/generic-netbsd/sys/condvar.h +1 -1
- package/libc/include/generic-netbsd/sys/conf.h +4 -3
- package/libc/include/generic-netbsd/sys/container_of.h +75 -0
- package/libc/include/generic-netbsd/sys/device.h +20 -13
- package/libc/include/generic-netbsd/sys/disk.h +8 -1
- package/libc/include/generic-netbsd/sys/disklabel.h +2 -2
- package/libc/include/generic-netbsd/sys/disklabel_gpt.h +7 -1
- package/libc/include/generic-netbsd/sys/efiio.h +1 -1
- package/libc/include/generic-netbsd/sys/elfdefinitions.h +2368 -1591
- package/libc/include/generic-netbsd/sys/endian.h +17 -17
- package/libc/include/generic-netbsd/sys/evcnt.h +15 -2
- package/libc/include/generic-netbsd/sys/event.h +3 -2
- package/libc/include/generic-netbsd/sys/exec.h +2 -2
- package/libc/include/generic-netbsd/sys/exec_elf.h +32 -20
- package/libc/include/generic-netbsd/sys/fcntl.h +26 -2
- package/libc/include/generic-netbsd/sys/fd_set.h +3 -3
- package/libc/include/generic-netbsd/sys/featuretest.h +24 -6
- package/libc/include/generic-netbsd/sys/file.h +18 -6
- package/libc/include/generic-netbsd/sys/filedesc.h +8 -4
- package/libc/include/generic-netbsd/sys/futex.h +11 -11
- package/libc/include/generic-netbsd/sys/ieee754.h +2 -2
- package/libc/include/generic-netbsd/sys/ipc.h +2 -2
- package/libc/include/generic-netbsd/sys/ipmi.h +4 -2
- package/libc/include/generic-netbsd/sys/ksem.h +1 -1
- package/libc/include/generic-netbsd/sys/ktrace.h +6 -4
- package/libc/include/generic-netbsd/sys/lock.h +2 -2
- package/libc/include/generic-netbsd/sys/lua.h +1 -1
- package/libc/include/generic-netbsd/sys/lwp.h +25 -92
- package/libc/include/generic-netbsd/sys/mbuf.h +15 -13
- package/libc/include/generic-netbsd/sys/mman.h +11 -3
- package/libc/include/generic-netbsd/sys/mount.h +1 -2
- package/libc/include/generic-netbsd/sys/msg.h +3 -3
- package/libc/include/generic-netbsd/sys/mutex.h +1 -3
- package/libc/include/generic-netbsd/sys/namei.h +32 -17
- package/libc/include/generic-netbsd/sys/param.h +11 -8
- package/libc/include/generic-netbsd/sys/pipe.h +10 -11
- package/libc/include/generic-netbsd/sys/poll.h +8 -2
- package/libc/include/generic-netbsd/sys/proc.h +15 -15
- package/libc/include/generic-netbsd/sys/ptrace.h +24 -7
- package/libc/include/generic-netbsd/sys/ptree.h +2 -1
- package/libc/include/generic-netbsd/sys/queue.h +37 -37
- package/libc/include/generic-netbsd/sys/rbtree.h +23 -9
- package/libc/include/generic-netbsd/sys/resourcevar.h +2 -2
- package/libc/include/generic-netbsd/sys/rmd160.h +3 -3
- package/libc/include/generic-netbsd/sys/rndio.h +1 -1
- package/libc/include/generic-netbsd/sys/rwlock.h +1 -2
- package/libc/include/generic-netbsd/sys/sched.h +1 -1
- package/libc/include/generic-netbsd/sys/sdt.h +181 -111
- package/libc/include/generic-netbsd/sys/sem.h +7 -2
- package/libc/include/generic-netbsd/sys/sha1.h +3 -3
- package/libc/include/generic-netbsd/sys/sha2.h +8 -1
- package/libc/include/generic-netbsd/sys/shm.h +2 -2
- package/libc/include/generic-netbsd/sys/siginfo.h +5 -5
- package/libc/include/generic-netbsd/sys/signal.h +1 -1
- package/libc/include/generic-netbsd/sys/sigtypes.h +4 -4
- package/libc/include/generic-netbsd/sys/sleepq.h +14 -27
- package/libc/include/generic-netbsd/sys/socket.h +3 -1
- package/libc/include/generic-netbsd/sys/socketvar.h +4 -4
- package/libc/include/generic-netbsd/sys/stat.h +5 -5
- package/libc/include/generic-netbsd/sys/stdalign.h +55 -0
- package/libc/include/generic-netbsd/sys/stdarg.h +2 -2
- package/libc/include/generic-netbsd/sys/stddef.h +156 -0
- package/libc/include/generic-netbsd/sys/swap.h +2 -2
- package/libc/include/generic-netbsd/sys/syncobj.h +9 -6
- package/libc/include/generic-netbsd/sys/syscall.h +29 -8
- package/libc/include/generic-netbsd/sys/syscallargs.h +89 -12
- package/libc/include/generic-netbsd/sys/sysctl.h +94 -86
- package/libc/include/generic-netbsd/sys/syslimits.h +8 -1
- package/libc/include/generic-netbsd/sys/syslog.h +6 -7
- package/libc/include/generic-netbsd/sys/time.h +10 -8
- package/libc/include/generic-netbsd/sys/tree.h +13 -13
- package/libc/include/generic-netbsd/sys/tty.h +2 -2
- package/libc/include/generic-netbsd/sys/ttycom.h +7 -1
- package/libc/include/generic-netbsd/sys/types.h +1 -1
- package/libc/include/generic-netbsd/sys/ucontext.h +46 -49
- package/libc/include/generic-netbsd/sys/un.h +12 -4
- package/libc/include/generic-netbsd/sys/unistd.h +103 -102
- package/libc/include/generic-netbsd/sys/unpcb.h +2 -2
- package/libc/include/generic-netbsd/sys/vmmeter.h +1 -39
- package/libc/include/generic-netbsd/sys/vnode_if.h +2 -2
- package/libc/include/generic-netbsd/sys/vnode_impl.h +6 -3
- package/libc/include/generic-netbsd/sys/wapbl_replay.h +2 -2
- package/libc/include/generic-netbsd/sys/wchan.h +37 -0
- package/libc/include/generic-netbsd/syslog.h +6 -7
- package/libc/include/generic-netbsd/time.h +44 -8
- package/libc/include/generic-netbsd/tzfile.h +11 -6
- package/libc/include/generic-netbsd/uchar.h +1 -1
- package/libc/include/generic-netbsd/ucontext.h +2 -1
- package/libc/include/generic-netbsd/ufs/ext2fs/ext2fs.h +31 -16
- package/libc/include/generic-netbsd/ufs/ext2fs/ext2fs_dir.h +1 -1
- package/libc/include/generic-netbsd/ufs/ext2fs/ext2fs_extents.h +5 -5
- package/libc/include/generic-netbsd/ufs/ext2fs/ext2fs_extern.h +4 -4
- package/libc/include/generic-netbsd/ufs/ffs/ffs_extern.h +1 -1
- package/libc/include/generic-netbsd/ufs/ffs/fs.h +3 -3
- package/libc/include/generic-netbsd/ufs/ufs/quota2.h +2 -2
- package/libc/include/generic-netbsd/unistd.h +11 -5
- package/libc/include/generic-netbsd/unwind.h +1 -1
- package/libc/include/generic-netbsd/util.h +15 -1
- package/libc/include/generic-netbsd/uvm/uvm.h +1 -5
- package/libc/include/generic-netbsd/uvm/uvm_extern.h +3 -4
- package/libc/include/generic-netbsd/uvm/uvm_object.h +2 -2
- package/libc/include/generic-netbsd/uvm/uvm_param.h +1 -1
- package/libc/include/generic-netbsd/uvm/uvm_swap.h +14 -3
- package/libc/include/generic-netbsd/wchar.h +7 -2
- package/libc/include/generic-netbsd/x86/bootinfo.h +4 -1
- package/libc/include/generic-netbsd/x86/cpu.h +18 -1
- package/libc/include/generic-netbsd/x86/cpu_extended_state.h +3 -1
- package/libc/include/generic-netbsd/x86/cpuvar.h +4 -1
- package/libc/include/generic-netbsd/x86/float.h +24 -1
- package/libc/include/generic-netbsd/x86/ieee.h +11 -7
- package/libc/include/generic-netbsd/x86/lwp_private.h +56 -0
- package/libc/include/generic-netbsd/x86/mutex.h +1 -1
- package/libc/include/generic-netbsd/x86/specialreg.h +111 -23
- package/libc/include/generic-openbsd/db.h +1 -7
- package/libc/include/generic-openbsd/ddb/db_interface.h +2 -1
- package/libc/include/generic-openbsd/fnmatch.h +6 -2
- package/libc/include/generic-openbsd/login_cap.h +3 -1
- package/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h +2 -1
- package/libc/include/generic-openbsd/net/bpf.h +3 -1
- package/libc/include/generic-openbsd/net/hfsc.h +4 -4
- package/libc/include/generic-openbsd/net/if.h +5 -1
- package/libc/include/generic-openbsd/net/if_bridge.h +48 -1
- package/libc/include/generic-openbsd/net/if_etherbridge.h +20 -7
- package/libc/include/generic-openbsd/net/if_media.h +26 -1
- package/libc/include/generic-openbsd/net/if_pflow.h +71 -20
- package/libc/include/generic-openbsd/net/if_pfsync.h +2 -2
- package/libc/include/generic-openbsd/net/if_sppp.h +2 -1
- package/libc/include/generic-openbsd/net/if_trunk.h +3 -2
- package/libc/include/generic-openbsd/net/if_types.h +2 -2
- package/libc/include/generic-openbsd/net/if_var.h +34 -12
- package/libc/include/generic-openbsd/net/netisr.h +1 -3
- package/libc/include/generic-openbsd/net/pfvar.h +154 -1
- package/libc/include/generic-openbsd/net/pfvar_priv.h +256 -1
- package/libc/include/generic-openbsd/net80211/ieee80211.h +76 -4
- package/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h +3 -2
- package/libc/include/generic-openbsd/net80211/ieee80211_node.h +48 -2
- package/libc/include/generic-openbsd/net80211/ieee80211_proto.h +4 -1
- package/libc/include/generic-openbsd/net80211/ieee80211_var.h +18 -2
- package/libc/include/generic-openbsd/netinet/if_ether.h +12 -11
- package/libc/include/generic-openbsd/netinet/igmp_var.h +17 -3
- package/libc/include/generic-openbsd/netinet/in_pcb.h +2 -1
- package/libc/include/generic-openbsd/netinet/in_var.h +17 -59
- package/libc/include/generic-openbsd/netinet/ip.h +3 -2
- package/libc/include/generic-openbsd/netinet/tcp_timer.h +1 -2
- package/libc/include/generic-openbsd/netinet6/in6_var.h +15 -29
- package/libc/include/generic-openbsd/netinet6/ip6_var.h +1 -2
- package/libc/include/generic-openbsd/netinet6/mld6_var.h +17 -4
- package/libc/include/generic-openbsd/netinet6/nd6.h +2 -2
- package/libc/include/generic-openbsd/pthread.h +2 -2
- package/libc/include/generic-openbsd/signal.h +2 -2
- package/libc/include/generic-openbsd/sndio.h +6 -12
- package/libc/include/generic-openbsd/strings.h +5 -1
- package/libc/include/generic-openbsd/sys/device.h +4 -3
- package/libc/include/generic-openbsd/sys/disklabel.h +17 -5
- package/libc/include/generic-openbsd/sys/dkio.h +3 -5
- package/libc/include/generic-openbsd/sys/filedesc.h +3 -2
- package/libc/include/generic-openbsd/sys/mbuf.h +1 -1
- package/libc/include/generic-openbsd/sys/mman.h +7 -2
- package/libc/include/generic-openbsd/sys/mutex.h +10 -7
- package/libc/include/generic-openbsd/sys/namei.h +8 -7
- package/libc/include/generic-openbsd/sys/param.h +1 -1
- package/libc/include/generic-openbsd/sys/pledge.h +1 -3
- package/libc/include/generic-openbsd/sys/protosw.h +8 -1
- package/libc/include/generic-openbsd/sys/ptrace.h +4 -1
- package/libc/include/generic-openbsd/sys/sched.h +8 -1
- package/libc/include/generic-openbsd/sys/signal.h +4 -2
- package/libc/include/generic-openbsd/sys/socketvar.h +2 -1
- package/libc/include/generic-openbsd/sys/sockio.h +11 -1
- package/libc/include/generic-openbsd/sys/syscall.h +5 -3
- package/libc/include/generic-openbsd/sys/syscallargs.h +9 -2
- package/libc/include/generic-openbsd/sys/sysctl.h +7 -4
- package/libc/include/generic-openbsd/sys/types.h +6 -2
- package/libc/include/generic-openbsd/sys/videoio.h +143 -68
- package/libc/include/generic-openbsd/sys/xcall.h +2 -2
- package/libc/include/generic-openbsd/time.h +2 -2
- package/libc/include/generic-openbsd/unistd.h +2 -2
- package/libc/include/generic-openbsd/uvm/uvm_anon.h +2 -3
- package/libc/include/generic-openbsd/uvm/uvm_extern.h +1 -19
- package/libc/include/generic-openbsd/uvm/uvm_pager.h +3 -4
- package/libc/include/generic-openbsd/uvm/uvm_pmemrange.h +1 -2
- package/libc/include/generic-openbsd/uvm/uvm_swap.h +4 -1
- package/libc/include/generic-openbsd/uvm/uvm_vnode.h +3 -4
- package/libc/include/generic-openbsd/uvm/uvmexp.h +41 -35
- package/libc/include/hexagon-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/loongarch-linux-any/asm/hwcap.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm_para.h +1 -0
- package/libc/include/loongarch-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/loongarch-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/m68k-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/m68k-netbsd-none/m68k/asm.h +11 -2
- package/libc/include/m68k-netbsd-none/m68k/bus_dma.h +2 -2
- package/libc/include/m68k-netbsd-none/m68k/byte_swap.h +2 -2
- package/libc/include/m68k-netbsd-none/m68k/cacheops_30.h +2 -2
- package/libc/include/m68k-netbsd-none/m68k/cacheops_40.h +3 -1
- package/libc/include/m68k-netbsd-none/m68k/cacheops_60.h +5 -3
- package/libc/include/m68k-netbsd-none/m68k/cpu.h +86 -59
- package/libc/include/m68k-netbsd-none/m68k/cpuframe.h +5 -5
- package/libc/include/m68k-netbsd-none/m68k/fenv.h +6 -4
- package/libc/include/m68k-netbsd-none/m68k/float.h +26 -1
- package/libc/include/m68k-netbsd-none/m68k/frame.h +31 -19
- package/libc/include/m68k-netbsd-none/m68k/ieee.h +13 -8
- package/libc/include/m68k-netbsd-none/m68k/ieeefp.h +3 -3
- package/libc/include/m68k-netbsd-none/m68k/int_limits.h +2 -2
- package/libc/include/m68k-netbsd-none/m68k/intr.h +211 -0
- package/libc/include/m68k-netbsd-none/m68k/kcore.h +31 -31
- package/libc/include/m68k-netbsd-none/m68k/lwp_private.h +64 -0
- package/libc/include/m68k-netbsd-none/m68k/m68k.h +3 -7
- package/libc/include/m68k-netbsd-none/m68k/mcontext.h +5 -36
- package/libc/include/m68k-netbsd-none/m68k/mmu_30.h +105 -0
- package/libc/include/m68k-netbsd-none/m68k/mmu_40.h +232 -0
- package/libc/include/m68k-netbsd-none/m68k/mmu_51.h +273 -0
- package/libc/include/m68k-netbsd-none/m68k/mutex.h +1 -1
- package/libc/include/m68k-netbsd-none/m68k/pcb.h +2 -2
- package/libc/include/m68k-netbsd-none/m68k/pmap_motorola.h +32 -23
- package/libc/include/m68k-netbsd-none/m68k/psl.h +26 -7
- package/libc/include/m68k-netbsd-none/m68k/pte_motorola.h +37 -26
- package/libc/include/m68k-netbsd-none/m68k/trap.h +7 -7
- package/libc/include/m68k-netbsd-none/mac68k/cpu.h +1 -57
- package/libc/include/m68k-netbsd-none/mac68k/intr.h +3 -2
- package/libc/include/m68k-netbsd-none/mac68k/lwp_private.h +3 -0
- package/libc/include/m68k-netbsd-none/mac68k/pmap.h +20 -2
- package/libc/include/m68k-netbsd-none/mac68k/z8530var.h +2 -2
- package/libc/include/m68k-netbsd-none/machine/cpu.h +1 -57
- package/libc/include/m68k-netbsd-none/machine/intr.h +3 -2
- package/libc/include/m68k-netbsd-none/machine/lwp_private.h +3 -0
- package/libc/include/m68k-netbsd-none/machine/pmap.h +20 -2
- package/libc/include/m68k-netbsd-none/machine/z8530var.h +2 -2
- package/libc/include/mips-linux-any/asm/errno.h +2 -0
- package/libc/include/mips-linux-any/asm/unistd_n32.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_n64.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_o32.h +1 -0
- package/libc/include/mips-netbsd-eabi/machine/lwp_private.h +3 -0
- package/libc/include/mips64-openbsd-none/machine/octeonvar.h +1 -27
- package/libc/include/mips64-openbsd-none/octeon/octeonvar.h +1 -27
- package/libc/include/mips64el-openbsd-none/loongson/apmvar.h +1 -1
- package/libc/include/mips64el-openbsd-none/loongson/param.h +1 -5
- package/libc/include/mips64el-openbsd-none/machine/apmvar.h +1 -1
- package/libc/include/mips64el-openbsd-none/machine/param.h +1 -5
- package/libc/include/powerpc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/powerpc-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/powerpc-linux-gnu/bits/struct_mutex.h +2 -2
- package/libc/include/powerpc-netbsd-eabi/evbppc/lwp_private.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/float.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/ansi.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/aout_machdep.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/asm.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/cdefs.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/cpu.h +65 -0
- package/libc/include/powerpc-netbsd-eabi/machine/disklabel.h +69 -0
- package/libc/include/powerpc-netbsd-eabi/machine/elf_machdep.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/endian.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/fenv.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/float.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/frame.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/ieee.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/ieeefp.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/int_const.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/int_fmtio.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/int_limits.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/int_mwgwtypes.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/int_types.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/kcore.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/limits.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/lock.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/lwp_private.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/math.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/mcontext.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/mutex.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/param.h +43 -0
- package/libc/include/powerpc-netbsd-eabi/machine/pcb.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/pmap.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/proc.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/profile.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/psl.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/pte.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/ptrace.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/reg.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/reloc.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/setjmp.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/signal.h +3 -0
- package/libc/include/{mips-netbsd-eabi → powerpc-netbsd-eabi}/machine/sljit_machdep.h +1 -1
- package/libc/include/powerpc-netbsd-eabi/machine/trap.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/types.h +11 -0
- package/libc/include/powerpc-netbsd-eabi/machine/vmparam.h +3 -0
- package/libc/include/powerpc-netbsd-eabi/machine/wchar_limits.h +3 -0
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/asm.h +12 -2
- package/libc/include/powerpc-netbsd-eabi/powerpc/bswap.h +14 -0
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/cpu.h +3 -3
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/fenv.h +2 -1
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ibm4xx/pmap.h +3 -3
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ieee.h +7 -2
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/limits.h +4 -13
- package/libc/include/powerpc-netbsd-eabi/powerpc/lwp_private.h +79 -0
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/mcontext.h +6 -50
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/mutex.h +1 -1
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/hid.h +2 -2
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/pmap.h +2 -2
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/pmap.h +1 -1
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/psl.h +2 -2
- package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/vmparam.h +1 -1
- package/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h +1 -4
- package/libc/include/powerpc64-openbsd-none/machine/atomic.h +3 -3
- package/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h +3 -3
- package/libc/include/riscv-linux-any/asm/hwprobe.h +4 -0
- package/libc/include/riscv-linux-any/asm/kvm.h +3 -0
- package/libc/include/riscv-linux-any/asm/ptrace.h +37 -0
- package/libc/include/riscv-linux-any/asm/sigcontext.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/riscv32-netbsd-none/machine/bswap.h +11 -0
- package/libc/include/riscv32-netbsd-none/machine/endian_machdep.h +3 -0
- package/libc/include/riscv32-netbsd-none/machine/rwlock.h +1 -0
- package/libc/include/riscv32-netbsd-none/machine/wchar_limits.h +4 -0
- package/libc/include/riscv64-netbsd-none/machine/bswap.h +11 -0
- package/libc/include/riscv64-netbsd-none/machine/endian_machdep.h +3 -0
- package/libc/include/riscv64-netbsd-none/machine/rwlock.h +1 -0
- package/libc/include/riscv64-netbsd-none/machine/wchar_limits.h +4 -0
- package/libc/include/riscv64-openbsd-none/machine/cpu.h +4 -8
- package/libc/include/riscv64-openbsd-none/machine/cpufunc.h +4 -4
- package/libc/include/riscv64-openbsd-none/machine/pmap.h +5 -1
- package/libc/include/riscv64-openbsd-none/machine/pte.h +9 -1
- package/libc/include/riscv64-openbsd-none/riscv64/cpu.h +4 -8
- package/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h +4 -4
- package/libc/include/riscv64-openbsd-none/riscv64/pmap.h +5 -1
- package/libc/include/riscv64-openbsd-none/riscv64/pte.h +9 -1
- package/libc/include/s390x-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/s390x-linux-gnu/bits/fenv.h +2 -2
- package/libc/include/s390x-linux-gnu/bits/struct_mutex.h +2 -2
- package/libc/include/sparc-linux-any/asm/errno.h +2 -0
- package/libc/include/sparc-linux-any/asm/ioctls.h +4 -4
- package/libc/include/sparc-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/sparc-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/sparc-netbsd-none/float.h +3 -1
- package/libc/include/sparc-netbsd-none/machine/asm.h +10 -1
- package/libc/include/sparc-netbsd-none/machine/cgtworeg.h +2 -2
- package/libc/include/sparc-netbsd-none/machine/cpu.h +1 -1
- package/libc/include/sparc-netbsd-none/machine/float.h +3 -1
- package/libc/include/sparc-netbsd-none/machine/limits.h +4 -6
- package/libc/include/sparc-netbsd-none/machine/lwp_private.h +51 -0
- package/libc/include/sparc-netbsd-none/machine/mcontext.h +4 -22
- package/libc/include/sparc-netbsd-none/machine/mutex.h +1 -1
- package/libc/include/sparc-netbsd-none/machine/param.h +4 -2
- package/libc/include/sparc-netbsd-none/machine/pmap.h +2 -2
- package/libc/include/sparc-netbsd-none/machine/psl.h +6 -3
- package/libc/include/sparc-netbsd-none/machine/sxreg.h +5 -1
- package/libc/include/sparc-netbsd-none/machine/types.h +2 -2
- package/libc/include/sparc-netbsd-none/sparc/sxreg.h +5 -1
- package/libc/include/sparc64-netbsd-none/machine/cpu.h +2 -2
- package/libc/include/sparc64-netbsd-none/machine/ctlreg.h +8 -7
- package/libc/include/sparc64-netbsd-none/machine/intr.h +1 -1
- package/libc/include/sparc64-netbsd-none/machine/lwp_private.h +3 -0
- package/libc/include/sparc64-netbsd-none/machine/mcontext.h +4 -4
- package/libc/include/sparc64-netbsd-none/machine/mutex.h +1 -1
- package/libc/include/sparc64-netbsd-none/machine/param.h +8 -2
- package/libc/include/sparc64-netbsd-none/machine/psl.h +7 -2
- package/libc/include/sparc64-netbsd-none/machine/pte.h +2 -2
- package/libc/include/sparc64-netbsd-none/machine/vmparam.h +1 -1
- package/libc/include/x86-linux-any/asm/auxvec.h +0 -4
- package/libc/include/x86-linux-any/asm/kvm.h +13 -8
- package/libc/include/x86-linux-any/asm/svm.h +16 -16
- package/libc/include/x86-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_x32.h +1 -0
- package/libc/include/x86-linux-gnu/bits/struct_mutex.h +2 -2
- package/libc/include/x86-netbsd-none/machine/asm.h +12 -4
- package/libc/include/x86-netbsd-none/machine/byte_swap.h +2 -2
- package/libc/include/x86-netbsd-none/machine/cpu.h +15 -4
- package/libc/include/x86-netbsd-none/machine/elf_machdep.h +2 -1
- package/libc/include/x86-netbsd-none/machine/lwp_private.h +3 -0
- package/libc/include/x86-netbsd-none/machine/mcontext.h +6 -24
- package/libc/include/x86-netbsd-none/machine/param.h +9 -1
- package/libc/include/x86-netbsd-none/machine/pcb.h +6 -2
- package/libc/include/x86-netbsd-none/machine/ptrace.h +2 -2
- package/libc/include/x86-netbsd-none/machine/types.h +2 -1
- package/libc/include/x86-openbsd-none/i386/specialreg.h +3 -1
- package/libc/include/x86-openbsd-none/machine/specialreg.h +3 -1
- package/libc/include/x86_64-netbsd-none/amd64/asm.h +11 -3
- package/libc/include/x86_64-netbsd-none/amd64/byte_swap.h +2 -2
- package/libc/include/x86_64-netbsd-none/amd64/cpu.h +13 -3
- package/libc/include/x86_64-netbsd-none/amd64/frame.h +2 -2
- package/libc/include/x86_64-netbsd-none/amd64/lwp_private.h +3 -0
- package/libc/include/x86_64-netbsd-none/amd64/mcontext.h +5 -23
- package/libc/include/x86_64-netbsd-none/amd64/param.h +23 -4
- package/libc/include/x86_64-netbsd-none/amd64/pcb.h +14 -3
- package/libc/include/x86_64-netbsd-none/amd64/ptrace.h +2 -2
- package/libc/include/x86_64-netbsd-none/amd64/types.h +2 -1
- package/libc/include/x86_64-netbsd-none/machine/asm.h +11 -3
- package/libc/include/x86_64-netbsd-none/machine/byte_swap.h +2 -2
- package/libc/include/x86_64-netbsd-none/machine/cpu.h +13 -3
- package/libc/include/x86_64-netbsd-none/machine/frame.h +2 -2
- package/libc/include/x86_64-netbsd-none/machine/lwp_private.h +3 -0
- package/libc/include/x86_64-netbsd-none/machine/mcontext.h +5 -23
- package/libc/include/x86_64-netbsd-none/machine/param.h +23 -4
- package/libc/include/x86_64-netbsd-none/machine/pcb.h +14 -3
- package/libc/include/x86_64-netbsd-none/machine/ptrace.h +2 -2
- package/libc/include/x86_64-netbsd-none/machine/types.h +2 -1
- package/libc/include/x86_64-openbsd-none/amd64/conf.h +11 -2
- package/libc/include/x86_64-openbsd-none/amd64/cpu.h +14 -4
- package/libc/include/x86_64-openbsd-none/amd64/cpufunc.h +2 -3
- package/libc/include/x86_64-openbsd-none/amd64/ghcb.h +2 -1
- package/libc/include/x86_64-openbsd-none/amd64/i82489var.h +2 -4
- package/libc/include/x86_64-openbsd-none/amd64/i8259.h +1 -53
- package/libc/include/x86_64-openbsd-none/amd64/intr.h +5 -2
- package/libc/include/x86_64-openbsd-none/amd64/intrdefs.h +9 -7
- package/libc/include/x86_64-openbsd-none/amd64/kexec.h +48 -0
- package/libc/include/x86_64-openbsd-none/amd64/specialreg.h +4 -1
- package/libc/include/x86_64-openbsd-none/machine/conf.h +11 -2
- package/libc/include/x86_64-openbsd-none/machine/cpu.h +14 -4
- package/libc/include/x86_64-openbsd-none/machine/cpufunc.h +2 -3
- package/libc/include/x86_64-openbsd-none/machine/ghcb.h +2 -1
- package/libc/include/x86_64-openbsd-none/machine/i82489var.h +2 -4
- package/libc/include/x86_64-openbsd-none/machine/i8259.h +1 -53
- package/libc/include/x86_64-openbsd-none/machine/intr.h +5 -2
- package/libc/include/x86_64-openbsd-none/machine/intrdefs.h +9 -7
- package/libc/include/x86_64-openbsd-none/machine/kexec.h +48 -0
- package/libc/include/x86_64-openbsd-none/machine/specialreg.h +4 -1
- package/libc/include/xtensa-linux-any/asm/unistd_32.h +1 -0
- package/libc/netbsd/abilists +0 -0
- package/libc/netbsd/lib/csu/arch/riscv/crt0.S +62 -0
- package/libc/netbsd/lib/csu/common/crt0-common.c +32 -7
- package/libc/netbsd/lib/csu/common/csu-common.h +2 -0
- package/libc/openbsd/abilists +0 -0
- package/libcxx/include/__algorithm/all_of.h +11 -5
- package/libcxx/include/__algorithm/comp.h +4 -0
- package/libcxx/include/__algorithm/copy.h +28 -147
- package/libcxx/include/__algorithm/copy_backward.h +9 -24
- package/libcxx/include/__algorithm/copy_n.h +50 -16
- package/libcxx/include/__algorithm/count.h +2 -2
- package/libcxx/include/__algorithm/equal.h +43 -55
- package/libcxx/include/__algorithm/fill.h +26 -8
- package/libcxx/include/__algorithm/fill_n.h +32 -46
- package/libcxx/include/__algorithm/find.h +96 -39
- package/libcxx/include/__algorithm/find_end.h +105 -0
- package/libcxx/include/__algorithm/for_each.h +18 -24
- package/libcxx/include/__algorithm/for_each_n.h +20 -47
- package/libcxx/include/__algorithm/for_each_n_segment.h +1 -1
- package/libcxx/include/__algorithm/for_each_segment.h +26 -0
- package/libcxx/include/__algorithm/generate.h +4 -2
- package/libcxx/include/__algorithm/generate_n.h +19 -6
- package/libcxx/include/__algorithm/is_permutation.h +4 -4
- package/libcxx/include/__algorithm/iterator_operations.h +3 -0
- package/libcxx/include/__algorithm/lexicographical_compare.h +2 -2
- package/libcxx/include/__algorithm/lexicographical_compare_three_way.h +6 -6
- package/libcxx/include/__algorithm/make_heap.h +16 -4
- package/libcxx/include/__algorithm/mismatch.h +2 -2
- package/libcxx/include/__algorithm/move.h +8 -19
- package/libcxx/include/__algorithm/move_backward.h +9 -24
- package/libcxx/include/__algorithm/none_of.h +4 -4
- package/libcxx/include/__algorithm/partial_sort.h +1 -1
- package/libcxx/include/__algorithm/partial_sort_copy.h +1 -1
- package/libcxx/include/__algorithm/pstl.h +9 -9
- package/libcxx/include/__algorithm/radix_sort.h +27 -25
- package/libcxx/include/__algorithm/ranges_copy_n.h +3 -26
- package/libcxx/include/__algorithm/ranges_equal.h +17 -26
- package/libcxx/include/__algorithm/ranges_fill.h +7 -6
- package/libcxx/include/__algorithm/ranges_for_each.h +9 -1
- package/libcxx/include/__algorithm/ranges_generate_n.h +2 -6
- package/libcxx/include/__algorithm/ranges_search_n.h +2 -2
- package/libcxx/include/__algorithm/rotate.h +27 -44
- package/libcxx/include/__algorithm/search_n.h +49 -37
- package/libcxx/include/__algorithm/sift_down.h +19 -18
- package/libcxx/include/__algorithm/simd_utils.h +33 -4
- package/libcxx/include/__algorithm/specialized_algorithms.h +54 -0
- package/libcxx/include/__algorithm/stable_sort.h +1 -1
- package/libcxx/include/__assertion_handler +31 -4
- package/libcxx/include/__atomic/atomic.h +36 -60
- package/libcxx/include/__atomic/atomic_flag.h +19 -37
- package/libcxx/include/__atomic/atomic_ref.h +29 -12
- package/libcxx/include/__atomic/atomic_sync.h +127 -55
- package/libcxx/include/__atomic/atomic_sync_timed.h +144 -0
- package/libcxx/include/__atomic/atomic_waitable_traits.h +103 -0
- package/libcxx/include/__atomic/contention_t.h +27 -3
- package/libcxx/include/__atomic/floating_point_helper.h +55 -0
- package/libcxx/include/__bit/countl.h +1 -2
- package/libcxx/include/__bit/countr.h +1 -2
- package/libcxx/include/__bit/has_single_bit.h +1 -1
- package/libcxx/include/__bit/popcount.h +0 -1
- package/libcxx/include/__bit/rotate.h +15 -26
- package/libcxx/include/__bit_reference +207 -18
- package/libcxx/include/__charconv/from_chars_integral.h +1 -1
- package/libcxx/include/__charconv/from_chars_result.h +1 -1
- package/libcxx/include/__charconv/to_chars_integral.h +1 -0
- package/libcxx/include/__charconv/to_chars_result.h +1 -1
- package/libcxx/include/__charconv/traits.h +3 -24
- package/libcxx/include/__chrono/day.h +11 -0
- package/libcxx/include/__chrono/duration.h +58 -33
- package/libcxx/include/__chrono/file_clock.h +4 -2
- package/libcxx/include/__chrono/is_clock.h +72 -0
- package/libcxx/include/__chrono/leap_second.h +13 -0
- package/libcxx/include/__chrono/month.h +13 -0
- package/libcxx/include/__chrono/month_weekday.h +22 -0
- package/libcxx/include/__chrono/monthday.h +20 -0
- package/libcxx/include/__chrono/steady_clock.h +1 -1
- package/libcxx/include/__chrono/system_clock.h +3 -3
- package/libcxx/include/__chrono/time_point.h +37 -13
- package/libcxx/include/__chrono/weekday.h +25 -0
- package/libcxx/include/__chrono/year.h +11 -0
- package/libcxx/include/__chrono/year_month.h +13 -0
- package/libcxx/include/__chrono/year_month_day.h +23 -0
- package/libcxx/include/__chrono/year_month_weekday.h +26 -0
- package/libcxx/include/__chrono/zoned_time.h +16 -0
- package/libcxx/include/__compare/is_eq.h +6 -6
- package/libcxx/include/__compare/strong_order.h +12 -30
- package/libcxx/include/__compare/three_way_comparable.h +2 -2
- package/libcxx/include/__concepts/comparison_common_type.h +40 -0
- package/libcxx/include/__concepts/equality_comparable.h +2 -1
- package/libcxx/include/__condition_variable/condition_variable.h +1 -1
- package/libcxx/include/__config +63 -280
- package/libcxx/include/__configuration/abi.h +14 -24
- package/libcxx/include/__configuration/availability.h +65 -118
- package/libcxx/include/__configuration/compiler.h +6 -6
- package/libcxx/include/__configuration/experimental.h +38 -0
- package/libcxx/include/__configuration/hardening.h +215 -0
- package/libcxx/include/__configuration/language.h +3 -0
- package/libcxx/include/__configuration/platform.h +9 -16
- package/libcxx/include/__coroutine/coroutine_handle.h +9 -9
- package/libcxx/include/__coroutine/noop_coroutine_handle.h +11 -13
- package/libcxx/include/__debug_utils/strict_weak_ordering_check.h +1 -1
- package/libcxx/include/__exception/exception.h +6 -4
- package/libcxx/include/__exception/exception_ptr.h +27 -5
- package/libcxx/include/__exception/nested_exception.h +2 -2
- package/libcxx/include/__exception/operations.h +5 -5
- package/libcxx/include/__expected/bad_expected_access.h +8 -6
- package/libcxx/include/__expected/expected.h +62 -64
- package/libcxx/include/__expected/unexpected.h +4 -4
- package/libcxx/include/__filesystem/copy_options.h +4 -4
- package/libcxx/include/__filesystem/directory_entry.h +37 -33
- package/libcxx/include/__filesystem/directory_iterator.h +9 -11
- package/libcxx/include/__filesystem/directory_options.h +7 -4
- package/libcxx/include/__filesystem/file_status.h +3 -3
- package/libcxx/include/__filesystem/filesystem_error.h +9 -10
- package/libcxx/include/__filesystem/operations.h +97 -66
- package/libcxx/include/__filesystem/path.h +68 -64
- package/libcxx/include/__filesystem/path_iterator.h +1 -3
- package/libcxx/include/__filesystem/perm_options.h +4 -4
- package/libcxx/include/__filesystem/perms.h +4 -4
- package/libcxx/include/__filesystem/recursive_directory_iterator.h +9 -14
- package/libcxx/include/__filesystem/space_info.h +1 -1
- package/libcxx/include/__filesystem/u8path.h +12 -14
- package/libcxx/include/__flat_map/flat_map.h +88 -71
- package/libcxx/include/__flat_map/flat_multimap.h +251 -172
- package/libcxx/include/__flat_map/key_value_iterator.h +0 -1
- package/libcxx/include/__flat_map/utils.h +1 -0
- package/libcxx/include/__flat_set/flat_multiset.h +211 -143
- package/libcxx/include/__flat_set/flat_set.h +86 -68
- package/libcxx/include/__format/concepts.h +0 -14
- package/libcxx/include/__format/extended_grapheme_cluster_table.h +3 -2
- package/libcxx/include/__format/fmt_pair_like.h +42 -0
- package/libcxx/include/__format/format_arg.h +7 -10
- package/libcxx/include/__format/format_args.h +1 -1
- package/libcxx/include/__format/format_context.h +5 -5
- package/libcxx/include/__format/format_parse_context.h +2 -2
- package/libcxx/include/__format/formatter_output.h +30 -34
- package/libcxx/include/__format/indic_conjunct_break_table.h +3 -2
- package/libcxx/include/__format/range_default_formatter.h +2 -41
- package/libcxx/include/__format/range_format.h +71 -0
- package/libcxx/include/__format/range_formatter.h +1 -0
- package/libcxx/include/__format/width_estimation_table.h +4 -2
- package/libcxx/include/__functional/bind.h +10 -15
- package/libcxx/include/__functional/bind_back.h +1 -1
- package/libcxx/include/__functional/bind_front.h +1 -1
- package/libcxx/include/__functional/function.h +57 -75
- package/libcxx/include/__functional/hash.h +1 -10
- package/libcxx/include/__functional/identity.h +1 -1
- package/libcxx/include/__functional/is_transparent.h +8 -0
- package/libcxx/include/__functional/mem_fn.h +2 -1
- package/libcxx/include/__functional/operations.h +18 -0
- package/libcxx/include/__functional/ranges_operations.h +7 -0
- package/libcxx/include/__functional/reference_wrapper.h +7 -5
- package/libcxx/include/__functional/weak_result_type.h +14 -28
- package/libcxx/include/__fwd/ios.h +1 -1
- package/libcxx/include/__fwd/tuple.h +14 -0
- package/libcxx/include/__hash_table +371 -357
- package/libcxx/include/__ios/fpos.h +4 -4
- package/libcxx/include/__iterator/back_insert_iterator.h +1 -7
- package/libcxx/include/__iterator/bounded_iter.h +7 -8
- package/libcxx/include/__iterator/concepts.h +6 -9
- package/libcxx/include/__iterator/cpp17_iterator_concepts.h +13 -12
- package/libcxx/include/__iterator/distance.h +40 -18
- package/libcxx/include/__iterator/front_insert_iterator.h +1 -7
- package/libcxx/include/__iterator/insert_iterator.h +1 -7
- package/libcxx/include/__iterator/istream_iterator.h +6 -7
- package/libcxx/include/__iterator/istreambuf_iterator.h +6 -7
- package/libcxx/include/__iterator/iter_move.h +1 -1
- package/libcxx/include/__iterator/iterator.h +13 -0
- package/libcxx/include/__iterator/iterator_traits.h +13 -14
- package/libcxx/include/__iterator/ostream_iterator.h +1 -7
- package/libcxx/include/__iterator/ostreambuf_iterator.h +1 -7
- package/libcxx/include/__iterator/reverse_iterator.h +8 -13
- package/libcxx/include/__iterator/segmented_iterator.h +3 -8
- package/libcxx/include/__iterator/static_bounded_iter.h +3 -3
- package/libcxx/include/__iterator/wrap_iter.h +8 -6
- package/libcxx/include/__locale +3 -10
- package/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h +0 -10
- package/libcxx/include/__locale_dir/locale_base_api.h +5 -28
- package/libcxx/include/__locale_dir/messages.h +1 -1
- package/libcxx/include/__locale_dir/money.h +2 -2
- package/libcxx/include/__locale_dir/num.h +190 -243
- package/libcxx/include/__locale_dir/pad_and_output.h +5 -6
- package/libcxx/include/__locale_dir/support/bsd_like.h +0 -20
- package/libcxx/include/__locale_dir/support/fuchsia.h +0 -7
- package/libcxx/include/__locale_dir/support/linux.h +0 -37
- package/libcxx/include/__locale_dir/support/netbsd.h +0 -2
- package/libcxx/include/__locale_dir/support/newlib.h +243 -0
- package/libcxx/include/__locale_dir/support/no_locale/characters.h +0 -4
- package/libcxx/include/__locale_dir/support/no_locale/strtonum.h +0 -9
- package/libcxx/include/__locale_dir/support/windows.h +0 -29
- package/libcxx/include/__locale_dir/time.h +3 -7
- package/libcxx/include/__math/hypot.h +1 -1
- package/libcxx/include/__math/logarithms.h +1 -1
- package/libcxx/include/__math/traits.h +80 -11
- package/libcxx/include/__mdspan/extents.h +7 -4
- package/libcxx/include/__mdspan/layout_stride.h +4 -5
- package/libcxx/include/__mdspan/mdspan.h +29 -23
- package/libcxx/include/__memory/addressof.h +7 -5
- package/libcxx/include/__memory/align.h +18 -1
- package/libcxx/include/__memory/allocate_at_least.h +15 -10
- package/libcxx/include/__memory/allocator.h +14 -26
- package/libcxx/include/__memory/allocator_traits.h +6 -4
- package/libcxx/include/__memory/compressed_pair.h +15 -9
- package/libcxx/include/__memory/construct_at.h +12 -23
- package/libcxx/include/__memory/inout_ptr.h +1 -1
- package/libcxx/include/__memory/is_sufficiently_aligned.h +1 -1
- package/libcxx/include/__memory/out_ptr.h +1 -1
- package/libcxx/include/__memory/pointer_traits.h +1 -1
- package/libcxx/include/__memory/raw_storage_iterator.h +3 -9
- package/libcxx/include/__memory/shared_count.h +9 -30
- package/libcxx/include/__memory/shared_ptr.h +100 -145
- package/libcxx/include/__memory/temp_value.h +1 -2
- package/libcxx/include/__memory/uninitialized_algorithms.h +44 -115
- package/libcxx/include/__memory/unique_ptr.h +14 -16
- package/libcxx/include/__memory/uses_allocator_construction.h +1 -0
- package/libcxx/include/__memory_resource/memory_resource.h +4 -2
- package/libcxx/include/__memory_resource/monotonic_buffer_resource.h +1 -1
- package/libcxx/include/__memory_resource/polymorphic_allocator.h +13 -8
- package/libcxx/include/__memory_resource/pool_options.h +1 -1
- package/libcxx/include/__memory_resource/synchronized_pool_resource.h +4 -2
- package/libcxx/include/__memory_resource/unsynchronized_pool_resource.h +1 -1
- package/libcxx/include/__mutex/mutex.h +2 -2
- package/libcxx/include/__mutex/once_flag.h +14 -11
- package/libcxx/include/__mutex/tag_types.h +3 -3
- package/libcxx/include/__mutex/unique_lock.h +8 -7
- package/libcxx/include/__new/align_val_t.h +6 -0
- package/libcxx/include/__new/allocate.h +1 -2
- package/libcxx/include/__new/exceptions.h +8 -2
- package/libcxx/include/__new/global_new_delete.h +4 -11
- package/libcxx/include/__new/interference_size.h +0 -4
- package/libcxx/include/__new/launder.h +3 -5
- package/libcxx/include/__new/nothrow_t.h +1 -1
- package/libcxx/include/__numeric/gcd_lcm.h +24 -34
- package/libcxx/include/__numeric/midpoint.h +9 -14
- package/libcxx/include/__numeric/pstl.h +2 -2
- package/libcxx/include/__numeric/saturation_arithmetic.h +13 -5
- package/libcxx/include/__ostream/basic_ostream.h +8 -8
- package/libcxx/include/__pstl/backends/default.h +14 -14
- package/libcxx/include/__pstl/backends/libdispatch.h +2 -2
- package/libcxx/include/__pstl/cpu_algos/find_if.h +1 -1
- package/libcxx/include/__pstl/cpu_algos/transform.h +5 -6
- package/libcxx/include/__pstl/cpu_algos/transform_reduce.h +5 -4
- package/libcxx/include/__random/binomial_distribution.h +10 -4
- package/libcxx/include/__random/mersenne_twister_engine.h +50 -154
- package/libcxx/include/__random/piecewise_constant_distribution.h +3 -2
- package/libcxx/include/__random/piecewise_linear_distribution.h +3 -2
- package/libcxx/include/__ranges/adjacent_transform_view.h +406 -0
- package/libcxx/include/__ranges/adjacent_view.h +419 -0
- package/libcxx/include/__ranges/as_rvalue_view.h +9 -9
- package/libcxx/include/__ranges/chunk_by_view.h +6 -6
- package/libcxx/include/__ranges/common_view.h +7 -7
- package/libcxx/include/__ranges/drop_view.h +8 -8
- package/libcxx/include/__ranges/drop_while_view.h +5 -5
- package/libcxx/include/__ranges/elements_of.h +49 -0
- package/libcxx/include/__ranges/empty_view.h +5 -5
- package/libcxx/include/__ranges/filter_view.h +10 -10
- package/libcxx/include/__ranges/iota_view.h +41 -22
- package/libcxx/include/__ranges/owning_view.h +15 -15
- package/libcxx/include/__ranges/ref_view.h +6 -6
- package/libcxx/include/__ranges/repeat_view.h +17 -10
- package/libcxx/include/__ranges/single_view.h +8 -8
- package/libcxx/include/__ranges/take_view.h +9 -9
- package/libcxx/include/__ranges/transform_view.h +1 -2
- package/libcxx/include/__ranges/view_interface.h +10 -10
- package/libcxx/include/__ranges/zip_transform_view.h +357 -0
- package/libcxx/include/__ranges/zip_view.h +20 -20
- package/libcxx/include/__split_buffer +612 -240
- package/libcxx/include/__stop_token/atomic_unique_lock.h +1 -1
- package/libcxx/include/__stop_token/stop_callback.h +2 -2
- package/libcxx/include/__stop_token/stop_source.h +1 -1
- package/libcxx/include/__stop_token/stop_state.h +4 -4
- package/libcxx/include/__stop_token/stop_token.h +1 -1
- package/libcxx/include/__string/char_traits.h +51 -31
- package/libcxx/include/__string/constexpr_c_functions.h +5 -5
- package/libcxx/include/__support/xlocale/__strtonum_fallback.h +0 -8
- package/libcxx/include/__system_error/error_category.h +8 -8
- package/libcxx/include/__system_error/error_code.h +5 -5
- package/libcxx/include/__system_error/error_condition.h +4 -4
- package/libcxx/include/__system_error/system_error.h +1 -1
- package/libcxx/include/__thread/id.h +1 -1
- package/libcxx/include/__thread/jthread.h +1 -1
- package/libcxx/include/__thread/poll_with_backoff.h +27 -8
- package/libcxx/include/__thread/support/c11.h +8 -8
- package/libcxx/include/__thread/support/pthread.h +8 -8
- package/libcxx/include/__thread/support/windows.h +8 -8
- package/libcxx/include/__thread/thread.h +13 -8
- package/libcxx/include/__thread/timed_backoff_policy.h +3 -2
- package/libcxx/include/__tree +849 -701
- package/libcxx/include/__tuple/sfinae_helpers.h +1 -44
- package/libcxx/include/__tuple/tuple_element.h +0 -12
- package/libcxx/include/__tuple/tuple_size.h +0 -4
- package/libcxx/include/__tuple/tuple_transform.h +45 -0
- package/libcxx/include/__type_traits/aligned_storage.h +13 -40
- package/libcxx/include/__type_traits/desugars_to.h +4 -0
- package/libcxx/include/__type_traits/invoke.h +8 -0
- package/libcxx/include/__type_traits/is_allocator.h +6 -7
- package/libcxx/include/__type_traits/is_array.h +26 -0
- package/libcxx/include/__type_traits/is_equality_comparable.h +16 -21
- package/libcxx/include/__type_traits/is_final.h +1 -1
- package/libcxx/include/__type_traits/is_floating_point.h +7 -6
- package/libcxx/include/__type_traits/is_generic_transparent_comparator.h +30 -0
- package/libcxx/include/__type_traits/is_specialization.h +2 -6
- package/libcxx/include/__type_traits/is_within_lifetime.h +29 -0
- package/libcxx/include/__type_traits/make_transparent.h +52 -0
- package/libcxx/include/__type_traits/reference_constructs_from_temporary.h +1 -7
- package/libcxx/include/__type_traits/reference_converts_from_temporary.h +1 -1
- package/libcxx/include/__utility/cmp.h +19 -7
- package/libcxx/include/__utility/default_three_way_comparator.h +70 -0
- package/libcxx/include/__utility/in_place.h +1 -1
- package/libcxx/include/__utility/integer_sequence.h +56 -41
- package/libcxx/include/__utility/lazy_synth_three_way_comparator.h +120 -0
- package/libcxx/include/__utility/pair.h +22 -25
- package/libcxx/include/__utility/scope_guard.h +2 -0
- package/libcxx/include/__utility/try_key_extraction.h +114 -0
- package/libcxx/include/__vector/vector.h +187 -160
- package/libcxx/include/__vector/vector_bool.h +76 -83
- package/libcxx/include/any +118 -155
- package/libcxx/include/array +88 -56
- package/libcxx/include/atomic +2 -0
- package/libcxx/include/barrier +20 -24
- package/libcxx/include/bitset +49 -30
- package/libcxx/include/ccomplex +3 -11
- package/libcxx/include/chrono +47 -0
- package/libcxx/include/ciso646 +3 -6
- package/libcxx/include/complex +77 -65
- package/libcxx/include/complex.h +10 -10
- package/libcxx/include/condition_variable +3 -3
- package/libcxx/include/cstdalign +3 -10
- package/libcxx/include/cstdbool +3 -10
- package/libcxx/include/ctgmath +2 -11
- package/libcxx/include/ctype.h +24 -24
- package/libcxx/include/cwchar +2 -2
- package/libcxx/include/deque +109 -225
- package/libcxx/include/errno.h +269 -269
- package/libcxx/include/exception +4 -1
- package/libcxx/include/ext/hash_map +7 -48
- package/libcxx/include/ext/hash_set +2 -8
- package/libcxx/include/fenv.h +43 -43
- package/libcxx/include/flat_map +663 -11
- package/libcxx/include/flat_set +543 -8
- package/libcxx/include/float.h +16 -16
- package/libcxx/include/forward_list +33 -53
- package/libcxx/include/fstream +57 -42
- package/libcxx/include/future +41 -51
- package/libcxx/include/initializer_list +9 -3
- package/libcxx/include/inttypes.h +16 -16
- package/libcxx/include/ios +28 -28
- package/libcxx/include/istream +19 -13
- package/libcxx/include/iterator +10 -0
- package/libcxx/include/latch +7 -5
- package/libcxx/include/limits +4 -4
- package/libcxx/include/list +61 -79
- package/libcxx/include/map +386 -274
- package/libcxx/include/math.h +19 -0
- package/libcxx/include/mdspan +1 -5
- package/libcxx/include/mutex +29 -19
- package/libcxx/include/optional +644 -149
- package/libcxx/include/print +9 -5
- package/libcxx/include/queue +39 -37
- package/libcxx/include/ranges +48 -0
- package/libcxx/include/regex +33 -31
- package/libcxx/include/scoped_allocator +16 -11
- package/libcxx/include/semaphore +15 -18
- package/libcxx/include/set +220 -192
- package/libcxx/include/shared_mutex +3 -8
- package/libcxx/include/span +53 -37
- package/libcxx/include/sstream +34 -28
- package/libcxx/include/stack +13 -15
- package/libcxx/include/stddef.h +10 -10
- package/libcxx/include/stdexcept +2 -2
- package/libcxx/include/stdio.h +20 -21
- package/libcxx/include/streambuf +59 -19
- package/libcxx/include/string +574 -573
- package/libcxx/include/string_view +113 -89
- package/libcxx/include/strstream +10 -10
- package/libcxx/include/syncstream +4 -4
- package/libcxx/include/tgmath.h +12 -12
- package/libcxx/include/tuple +242 -212
- package/libcxx/include/type_traits +8 -2
- package/libcxx/include/typeindex +5 -3
- package/libcxx/include/typeinfo +92 -89
- package/libcxx/include/unordered_map +179 -304
- package/libcxx/include/unordered_set +168 -195
- package/libcxx/include/utility +12 -0
- package/libcxx/include/valarray +106 -161
- package/libcxx/include/variant +25 -33
- package/libcxx/include/version +41 -24
- package/libcxx/include/wctype.h +29 -29
- package/libcxx/libc/hdr/errno_macros.h +3 -1
- package/libcxx/libc/hdr/stdint_proxy.h +18 -0
- package/libcxx/libc/hdr/types/wchar_t.h +23 -0
- package/libcxx/libc/hdr/wchar_overlay.h +69 -0
- package/libcxx/libc/include/llvm-libc-macros/cfloat128-macros.h +41 -0
- package/libcxx/libc/include/llvm-libc-macros/cfloat16-macros.h +20 -0
- package/libcxx/libc/include/llvm-libc-macros/wchar-macros.h +18 -0
- package/libcxx/libc/include/llvm-libc-types/cfloat128.h +11 -28
- package/libcxx/libc/include/llvm-libc-types/cfloat16.h +4 -7
- package/libcxx/libc/include/llvm-libc-types/wint_t.h +14 -0
- package/libcxx/libc/shared/libc_common.h +5 -0
- package/libcxx/libc/src/__support/CPP/bit.h +50 -12
- package/libcxx/libc/src/__support/CPP/type_traits/is_complex.h +7 -0
- package/libcxx/libc/src/__support/CPP/type_traits/is_destructible.h +2 -1
- package/libcxx/libc/src/__support/CPP/type_traits/is_unsigned.h +6 -0
- package/libcxx/libc/src/__support/CPP/utility/integer_sequence.h +10 -0
- package/libcxx/libc/src/__support/FPUtil/FPBits.h +6 -7
- package/libcxx/libc/src/__support/FPUtil/rounding_mode.h +50 -4
- package/libcxx/libc/src/__support/big_int.h +14 -14
- package/libcxx/libc/src/__support/common.h +3 -2
- package/libcxx/libc/src/__support/ctype_utils.h +19 -12
- package/libcxx/libc/src/__support/detailed_powers_of_ten.h +1 -2
- package/libcxx/libc/src/__support/high_precision_decimal.h +33 -14
- package/libcxx/libc/src/__support/libc_assert.h +2 -0
- package/libcxx/libc/src/__support/macros/attributes.h +44 -1
- package/libcxx/libc/src/__support/macros/config.h +23 -0
- package/libcxx/libc/src/__support/macros/null_check.h +1 -2
- package/libcxx/libc/src/__support/macros/optimization.h +3 -0
- package/libcxx/libc/src/__support/macros/properties/architectures.h +5 -1
- package/libcxx/libc/src/__support/macros/properties/compiler.h +8 -3
- package/libcxx/libc/src/__support/macros/properties/cpu_features.h +17 -1
- package/libcxx/libc/src/__support/macros/properties/types.h +2 -3
- package/libcxx/libc/src/__support/macros/sanitizer.h +0 -10
- package/libcxx/libc/src/__support/math_extras.h +20 -4
- package/libcxx/libc/src/__support/str_to_float.h +98 -125
- package/libcxx/libc/src/__support/str_to_integer.h +39 -27
- package/libcxx/libc/src/__support/wctype_utils.h +588 -0
- package/libcxx/src/any.cpp +4 -0
- package/libcxx/src/atomic.cpp +365 -80
- package/libcxx/src/barrier.cpp +4 -3
- package/libcxx/src/charconv.cpp +6 -3
- package/libcxx/src/condition_variable_destructor.cpp +1 -1
- package/libcxx/src/error_category.cpp +3 -1
- package/libcxx/src/exception.cpp +2 -10
- package/libcxx/src/experimental/time_zone.cpp +1 -1
- package/libcxx/src/experimental/tzdb.cpp +4 -1
- package/libcxx/src/filesystem/error.h +4 -22
- package/libcxx/src/filesystem/format_string.h +9 -18
- package/libcxx/src/filesystem/int128_builtins.cpp +2 -0
- package/libcxx/src/filesystem/operations.cpp +2 -9
- package/libcxx/src/filesystem/path.cpp +3 -1
- package/libcxx/src/include/aligned_alloc.h +65 -0
- package/libcxx/src/include/config_elast.h +1 -1
- package/libcxx/src/include/from_chars_floating_point.h +11 -7
- package/libcxx/src/include/overridable_function.h +8 -10
- package/libcxx/src/iostream.cpp +56 -37
- package/libcxx/src/locale.cpp +213 -196
- package/libcxx/src/memory.cpp +12 -14
- package/libcxx/src/mutex_destructor.cpp +1 -1
- package/libcxx/src/new.cpp +5 -5
- package/libcxx/src/optional.cpp +4 -0
- package/libcxx/src/print.cpp +9 -1
- package/libcxx/src/random.cpp +0 -26
- package/libcxx/src/string.cpp +10 -25
- package/libcxx/src/support/runtime/exception_fallback.ipp +2 -0
- package/libcxx/src/support/runtime/exception_glibcxx.ipp +3 -0
- package/libcxx/src/support/runtime/exception_libcxxabi.ipp +6 -2
- package/libcxx/src/support/runtime/exception_libcxxrt.ipp +2 -0
- package/libcxx/src/support/runtime/exception_msvc.ipp +2 -0
- package/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp +9 -10
- package/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp +2 -0
- package/libcxx/src/support/runtime/exception_pointer_msvc.ipp +1 -0
- package/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp +1 -0
- package/libcxx/src/support/win32/locale_win32.cpp +1 -1
- package/libcxx/src/system_error.cpp +2 -0
- package/libcxx/src/thread.cpp +1 -3
- package/libcxx/src/valarray.cpp +1 -2
- package/libcxx/src/vector.cpp +2 -2
- package/libcxxabi/include/__cxxabi_config.h +42 -23
- package/libcxxabi/src/cxa_exception.cpp +4 -2
- package/libcxxabi/src/cxa_exception.h +16 -14
- package/libcxxabi/src/cxa_personality.cpp +126 -9
- package/libcxxabi/src/cxa_thread_atexit.cpp +2 -1
- package/libcxxabi/src/demangle/DemangleConfig.h +4 -0
- package/libcxxabi/src/demangle/ItaniumDemangle.h +9 -6
- package/libcxxabi/src/demangle/Utility.h +21 -7
- package/libcxxabi/src/fallback_malloc.cpp +1 -1
- package/libcxxabi/src/private_typeinfo.cpp +6 -0
- package/libcxxabi/src/stdlib_new_delete.cpp +5 -5
- package/libtsan/LICENSE.TXT +311 -0
- package/libtsan/builtins/assembly.h +41 -8
- package/libtsan/interception/interception_win.cpp +4 -0
- package/libtsan/sanitizer_common/sanitizer_allocator_primary32.h +1 -0
- package/libtsan/sanitizer_common/sanitizer_allocator_primary64.h +18 -0
- package/libtsan/sanitizer_common/sanitizer_common.h +15 -2
- package/libtsan/sanitizer_common/sanitizer_common_interceptors.inc +30 -4
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +4 -0
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S +2 -1
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S +2 -0
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S +2 -0
- package/libtsan/sanitizer_common/sanitizer_common_syscalls.inc +18 -0
- package/libtsan/sanitizer_common/sanitizer_file.cpp +40 -12
- package/libtsan/sanitizer_common/sanitizer_file.h +3 -0
- package/libtsan/sanitizer_common/sanitizer_flags.inc +7 -0
- package/libtsan/sanitizer_common/sanitizer_fuchsia.cpp +30 -3
- package/libtsan/sanitizer_common/sanitizer_haiku.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_internal_defs.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_libc.cpp +8 -0
- package/libtsan/sanitizer_common/sanitizer_libc.h +1 -0
- package/libtsan/sanitizer_common/sanitizer_linux.cpp +15 -7
- package/libtsan/sanitizer_common/sanitizer_linux.h +3 -3
- package/libtsan/sanitizer_common/sanitizer_linux_libcdep.cpp +1 -0
- package/libtsan/sanitizer_common/sanitizer_mac.cpp +255 -104
- package/libtsan/sanitizer_common/sanitizer_mac.h +5 -0
- package/libtsan/sanitizer_common/sanitizer_netbsd.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_platform.h +27 -1
- package/libtsan/sanitizer_common/sanitizer_platform_interceptors.h +5 -4
- package/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp +15 -17
- package/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h +32 -6
- package/libtsan/sanitizer_common/sanitizer_posix.cpp +3 -12
- package/libtsan/sanitizer_common/sanitizer_posix.h +2 -1
- package/libtsan/sanitizer_common/sanitizer_posix_libcdep.cpp +19 -0
- package/libtsan/sanitizer_common/sanitizer_procmaps_mac.cpp +102 -37
- package/libtsan/sanitizer_common/sanitizer_redefine_builtins.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_signal_interceptors.inc +40 -2
- package/libtsan/sanitizer_common/sanitizer_stoptheworld.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +83 -12
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_mac.cpp +3 -3
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp +7 -7
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_win.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_symbolizer_internal.h +5 -1
- package/libtsan/sanitizer_common/sanitizer_symbolizer_libcdep.cpp +11 -1
- package/libtsan/sanitizer_common/sanitizer_symbolizer_mac.cpp +86 -29
- package/libtsan/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp +27 -16
- package/libtsan/sanitizer_common/sanitizer_thread_registry.cpp +5 -4
- package/libtsan/sanitizer_common/sanitizer_thread_registry.h +4 -4
- package/libtsan/sanitizer_common/sanitizer_win.cpp +1 -3
- package/libtsan/tsan_debugging.cpp +2 -2
- package/libtsan/tsan_flags.cpp +37 -0
- package/libtsan/tsan_flags.h +8 -0
- package/libtsan/tsan_flags.inc +12 -0
- package/libtsan/tsan_interceptors.h +9 -1
- package/libtsan/tsan_interceptors_mac.cpp +19 -0
- package/libtsan/tsan_interceptors_posix.cpp +78 -32
- package/libtsan/tsan_interface.h +3 -3
- package/libtsan/tsan_interface_ann.cpp +23 -9
- package/libtsan/tsan_mman.cpp +18 -4
- package/libtsan/tsan_platform.h +44 -7
- package/libtsan/tsan_platform_linux.cpp +42 -14
- package/libtsan/tsan_platform_mac.cpp +16 -3
- package/libtsan/tsan_report.h +14 -1
- package/libtsan/tsan_rtl.cpp +14 -0
- package/libtsan/tsan_rtl.h +7 -2
- package/libtsan/tsan_rtl_aarch64.S +3 -5
- package/libtsan/tsan_rtl_access.cpp +8 -3
- package/libtsan/tsan_rtl_amd64.S +2 -0
- package/libtsan/tsan_rtl_mutex.cpp +94 -49
- package/libtsan/tsan_rtl_report.cpp +132 -65
- package/libtsan/tsan_rtl_thread.cpp +31 -9
- package/libtsan/tsan_symbolize.cpp +1 -1
- package/libtsan/tsan_symbolize.h +1 -1
- package/libtsan/tsan_trace.h +1 -1
- package/libunwind/include/__libunwind_config.h +11 -2
- package/libunwind/include/libunwind.h +117 -11
- package/libunwind/include/unwind_arm_ehabi.h +4 -1
- package/libunwind/src/AddressSpace.hpp +42 -20
- package/libunwind/src/CompactUnwinder.hpp +16 -5
- package/libunwind/src/DwarfInstructions.hpp +24 -13
- package/libunwind/src/DwarfParser.hpp +62 -23
- package/libunwind/src/EHHeaderParser.hpp +7 -4
- package/libunwind/src/Registers.hpp +226 -22
- package/libunwind/src/Unwind-seh.cpp +6 -7
- package/libunwind/src/Unwind-wasm.c +7 -7
- package/libunwind/src/UnwindCursor.hpp +167 -49
- package/libunwind/src/UnwindLevel1.c +46 -17
- package/libunwind/src/UnwindRegistersRestore.S +46 -5
- package/libunwind/src/UnwindRegistersSave.S +86 -2
- package/libunwind/src/assembly.h +5 -1
- package/libunwind/src/config.h +9 -0
- package/libunwind/src/gcc_personality_v0.c +79 -6
- package/libunwind/src/libunwind.cpp +104 -4
- package/libunwind/src/libunwind_ext.h +7 -1
- package/libunwind/src/shadow_stack_unwind.h +2 -2
- package/lldb/pretty_printers.py +948 -0
- package/package.json +1 -1
- package/std/Build/Cache/Path.zig +42 -43
- package/std/Build/Cache.zig +19 -9
- package/std/Build/Configuration.zig +3479 -0
- package/std/Build/Module.zig +99 -225
- package/std/Build/Step/CheckFile.zig +17 -63
- package/std/Build/Step/Compile.zig +97 -1426
- package/std/Build/Step/ConfigHeader.zig +56 -944
- package/std/Build/Step/Fail.zig +10 -20
- package/std/Build/Step/FindProgram.zig +31 -0
- package/std/Build/Step/Fmt.zig +22 -57
- package/std/Build/Step/InstallArtifact.zig +26 -141
- package/std/Build/Step/InstallDir.zig +14 -67
- package/std/Build/Step/InstallFile.zig +12 -21
- package/std/Build/Step/ObjCopy.zig +82 -199
- package/std/Build/Step/Options.zig +55 -284
- package/std/Build/Step/Run.zig +138 -2246
- package/std/Build/Step/TranslateC.zig +55 -164
- package/std/Build/Step/UpdateSourceFiles.zig +38 -91
- package/std/Build/Step/WriteFile.zig +113 -328
- package/std/Build/Step.zig +45 -916
- package/std/Build/abi.zig +1 -1
- package/std/Build.zig +725 -770
- package/std/Io/Dir.zig +12 -7
- package/std/Io/Dispatch.zig +5 -5
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +6 -9
- package/std/Io/Kqueue.zig +5 -5
- package/std/Io/Reader.zig +66 -23
- package/std/Io/RwLock.zig +2 -0
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +36 -30
- package/std/Io/Uring.zig +11 -9
- package/std/Io/Writer.zig +125 -37
- package/std/Io/net/HostName.zig +11 -6
- package/std/Io/net.zig +3 -1
- package/std/Io.zig +29 -19
- package/std/Progress.zig +2 -2
- package/std/Random/ChaCha.zig +2 -2
- package/std/Random/benchmark.zig +2 -2
- package/std/Random.zig +6 -6
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +4 -5
- package/std/Target/aarch64.zig +622 -79
- package/std/Target/alpha.zig +2 -2
- package/std/Target/amdgcn.zig +423 -23
- package/std/Target/arc.zig +2 -2
- package/std/Target/arm.zig +42 -8
- package/std/Target/avr.zig +2 -2
- package/std/Target/bpf.zig +8 -2
- package/std/Target/csky.zig +2 -2
- package/std/Target/hexagon.zig +43 -8
- package/std/Target/hppa.zig +2 -2
- package/std/Target/kvx.zig +2 -2
- package/std/Target/lanai.zig +2 -2
- package/std/Target/loongarch.zig +20 -2
- package/std/Target/m68k.zig +2 -2
- package/std/Target/mips.zig +8 -2
- package/std/Target/msp430.zig +2 -2
- package/std/Target/nvptx.zig +60 -37
- package/std/Target/powerpc.zig +29 -21
- package/std/Target/propeller.zig +2 -2
- package/std/Target/riscv.zig +514 -179
- package/std/Target/s390x.zig +2 -2
- package/std/Target/sparc.zig +19 -2
- package/std/Target/spirv.zig +3 -3
- package/std/Target/ve.zig +2 -2
- package/std/Target/wasm.zig +9 -2
- package/std/Target/x86.zig +202 -33
- package/std/Target/xcore.zig +2 -2
- package/std/Target/xtensa.zig +67 -2
- package/std/Target.zig +101 -62
- package/std/Thread.zig +39 -6
- package/std/array_hash_map.zig +104 -59
- package/std/array_list.zig +20 -35
- package/std/ascii.zig +0 -9
- package/std/atomic.zig +2 -0
- package/std/base64.zig +5 -5
- package/std/bit_set.zig +85 -93
- package/std/c/darwin.zig +7 -1
- package/std/c.zig +88 -29
- package/std/coff.zig +1 -1
- package/std/compress/flate/Compress.zig +4 -2
- package/std/compress/flate/Decompress.zig +3 -4
- package/std/compress/zstd/Decompress.zig +7 -9
- package/std/crypto/25519/curve25519.zig +2 -2
- package/std/crypto/25519/edwards25519.zig +3 -3
- package/std/crypto/25519/ristretto255.zig +2 -2
- package/std/crypto/25519/scalar.zig +6 -6
- package/std/crypto/25519/x25519.zig +1 -1
- package/std/crypto/Certificate.zig +14 -2
- package/std/crypto/Sha1.zig +1 -1
- package/std/crypto/aegis.zig +45 -39
- package/std/crypto/aes/aesni.zig +1 -1
- package/std/crypto/aes/armcrypto.zig +4 -4
- package/std/crypto/aes/soft.zig +4 -4
- package/std/crypto/aes.zig +12 -0
- package/std/crypto/aes_ccm.zig +22 -22
- package/std/crypto/aes_gcm.zig +10 -12
- package/std/crypto/aes_ocb.zig +9 -9
- package/std/crypto/aes_siv.zig +4 -2
- package/std/crypto/argon2.zig +15 -15
- package/std/crypto/ascon.zig +75 -35
- package/std/crypto/bcrypt.zig +20 -10
- package/std/crypto/benchmark.zig +7 -7
- package/std/crypto/blake2.zig +100 -64
- package/std/crypto/cbc_mac.zig +1 -1
- package/std/crypto/chacha20.zig +10 -10
- package/std/crypto/cmac.zig +3 -3
- package/std/crypto/codecs/asn1/Oid.zig +22 -11
- package/std/crypto/codecs/asn1/der/Decoder.zig +51 -20
- package/std/crypto/codecs/asn1/der/Encoder.zig +111 -46
- package/std/crypto/codecs/asn1/der.zig +42 -0
- package/std/crypto/codecs/asn1.zig +97 -38
- package/std/crypto/codecs/base64_hex_ct.zig +3 -5
- package/std/crypto/codecs.zig +6 -0
- package/std/crypto/ecdsa.zig +9 -9
- package/std/crypto/ff.zig +7 -6
- package/std/crypto/ghash_polyval.zig +4 -4
- package/std/crypto/hkdf.zig +1 -1
- package/std/crypto/isap.zig +3 -3
- package/std/crypto/kangarootwelve.zig +1 -1
- package/std/crypto/keccak_p.zig +8 -8
- package/std/crypto/md5.zig +1 -1
- package/std/crypto/ml_dsa.zig +39 -39
- package/std/crypto/ml_kem.zig +12 -34
- package/std/crypto/modes.zig +2 -2
- package/std/crypto/pbkdf2.zig +1 -1
- package/std/crypto/pcurves/common.zig +4 -5
- package/std/crypto/pcurves/p256/scalar.zig +3 -3
- package/std/crypto/pcurves/p384/scalar.zig +2 -2
- package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
- package/std/crypto/pcurves/tests/p256.zig +5 -5
- package/std/crypto/pcurves/tests/p384.zig +5 -5
- package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
- package/std/crypto/phc_encoding.zig +23 -20
- package/std/crypto/salsa20.zig +8 -14
- package/std/crypto/sha2.zig +2 -2
- package/std/crypto/sha3.zig +2 -4
- package/std/crypto/siphash.zig +1 -1
- package/std/crypto/timing_safe.zig +11 -10
- package/std/crypto/tls/Client.zig +107 -16
- package/std/crypto/tls.zig +2 -2
- package/std/crypto.zig +4 -3
- package/std/debug/Dwarf/Unwind/VirtualMachine.zig +11 -5
- package/std/debug/Dwarf.zig +21 -12
- package/std/debug/ElfFile.zig +12 -8
- package/std/debug/MachOFile.zig +2 -2
- package/std/debug/Pdb.zig +86 -51
- package/std/debug/SelfInfo/Elf.zig +13 -9
- package/std/debug/SelfInfo/MachO.zig +44 -17
- package/std/debug/SelfInfo/Windows.zig +5 -7
- package/std/debug/cpu_context.zig +231 -39
- package/std/debug.zig +16 -8
- package/std/deque.zig +1 -1
- package/std/elf.zig +29 -12
- package/std/enums.zig +74 -87
- package/std/fmt/float.zig +2 -0
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt/parse_float.zig +1 -1
- package/std/fmt.zig +7 -8
- package/std/fs/path.zig +7 -5
- package/std/gpu.zig +1 -1
- package/std/hash/Adler32.zig +3 -3
- package/std/hash/auto_hash.zig +8 -8
- package/std/hash/benchmark.zig +2 -2
- package/std/hash/verify.zig +3 -3
- package/std/hash/wyhash.zig +2 -2
- package/std/hash/xxhash.zig +0 -6
- package/std/hash_map.zig +22 -2
- package/std/heap/ArenaAllocator.zig +3 -5
- package/std/heap/BrkAllocator.zig +1 -1
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/SafeAllocator.zig +2180 -0
- package/std/heap/debug_allocator.zig +2 -2
- package/std/heap/memory_pool.zig +34 -197
- package/std/heap.zig +20 -133
- package/std/http/Client.zig +2 -2
- package/std/http.zig +4 -5
- package/std/json/Scanner.zig +2 -2
- package/std/json/Stringify.zig +14 -14
- package/std/json/static.zig +49 -32
- package/std/json.zig +1 -1
- package/std/{builtin → lang}/assembly.zig +71 -0
- package/std/{builtin.zig → lang.zig} +70 -100
- package/std/leb128.zig +2 -2
- package/std/math/acos.zig +6 -0
- package/std/math/asin.zig +6 -0
- package/std/math/atan.zig +5 -0
- package/std/math/big/int.zig +5 -5
- package/std/math/big.zig +4 -4
- package/std/math/copysign.zig +1 -1
- package/std/math/float.zig +62 -0
- package/std/math/frexp.zig +4 -4
- package/std/math/hypot.zig +4 -0
- package/std/math/ilogb.zig +1 -1
- package/std/math/isfinite.zig +1 -1
- package/std/math/isinf.zig +1 -1
- package/std/math/isnan.zig +6 -2
- package/std/math/isnormal.zig +2 -2
- package/std/math/iszero.zig +2 -2
- package/std/math/ldexp.zig +2 -2
- package/std/math/log10.zig +0 -2
- package/std/math/log1p.zig +13 -19
- package/std/math/modf.zig +1 -2
- package/std/math/nextafter.zig +3 -4
- package/std/math/pow.zig +1 -1
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +28 -28
- package/std/mem/Allocator.zig +14 -18
- package/std/mem.zig +137 -176
- package/std/meta/trailer_flags.zig +27 -20
- package/std/meta.zig +134 -215
- package/std/multi_array_list.zig +70 -54
- package/std/os/emscripten.zig +7 -6
- package/std/os/linux/IoUring.zig +2 -0
- package/std/os/linux/alpha.zig +358 -0
- package/std/os/linux/arm.zig +0 -26
- package/std/os/linux/bpf.zig +6 -0
- package/std/os/linux/csky.zig +165 -0
- package/std/os/linux/ioctl.zig +3 -2
- package/std/os/linux/microblaze.zig +170 -0
- package/std/os/linux/sh.zig +239 -0
- package/std/os/linux/sparc.zig +277 -0
- package/std/os/linux/sparc64.zig +44 -30
- package/std/os/linux/syscalls.zig +2246 -13
- package/std/os/linux/tls.zig +12 -1
- package/std/os/linux/x86.zig +2 -2
- package/std/os/linux/xtensa.zig +193 -0
- package/std/os/linux.zig +829 -58
- package/std/os/plan9.zig +1 -1
- package/std/os/uefi/hii.zig +1 -1
- package/std/os/uefi/protocol/device_path.zig +8 -7
- package/std/os/uefi/protocol/file.zig +16 -0
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/uefi/tables/runtime_services.zig +1 -1
- package/std/os/windows.zig +139 -16
- package/std/os.zig +0 -15
- package/std/pie.zig +19 -0
- package/std/posix.zig +2 -2
- package/std/process/Child.zig +20 -0
- package/std/process/Environ.zig +28 -4
- package/std/process.zig +13 -5
- package/std/simd.zig +4 -21
- package/std/sort/pdq.zig +91 -13
- package/std/start.zig +63 -22
- package/std/static_string_map.zig +59 -1
- package/std/std.zig +8 -1
- package/std/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- package/std/testing/Smith.zig +35 -21
- package/std/testing.zig +83 -30
- package/std/unicode.zig +13 -8
- package/std/zig/Ast/Render.zig +6 -30
- package/std/zig/Ast.zig +16 -41
- package/std/zig/AstGen.zig +216 -300
- package/std/zig/AstRlAnnotate.zig +1 -11
- package/std/zig/AstSmith.zig +5 -11
- package/std/zig/ErrorBundle.zig +22 -15
- package/std/zig/LibCDirs.zig +14 -7
- package/std/zig/LibCInstallation.zig +61 -26
- package/std/zig/Parse.zig +18 -83
- package/std/zig/PkgConfig.zig +151 -0
- package/std/zig/TokenSmith.zig +0 -6
- package/std/zig/WindowsSdk.zig +18 -18
- package/std/zig/Zir.zig +22 -76
- package/std/zig/ZonGen.zig +19 -27
- package/std/zig/c_translation/helpers.zig +2 -2
- package/std/zig/llvm/BitcodeReader.zig +3 -3
- package/std/zig/llvm/Builder.zig +163 -126
- package/std/zig/llvm/bitcode_writer.zig +7 -7
- package/std/zig/llvm/ir.zig +8 -8
- package/std/zig/system/arm.zig +56 -2
- package/std/zig/system/darwin/macos.zig +11 -7
- package/std/zig/system/linux.zig +4 -0
- package/std/zig/system/loongarch.zig +25 -9
- package/std/zig/system/windows.zig +45 -12
- package/std/zig/system/x86.zig +60 -16
- package/std/zig/system.zig +23 -30
- package/std/zig/target.zig +3 -5
- package/std/zig/tokenizer.zig +4 -43
- package/std/zig.zig +114 -26
- package/std/zip.zig +5 -5
- package/std/zon/Serializer.zig +34 -25
- package/std/zon/parse.zig +84 -62
- package/ubsan_rt.zig +3 -3
- package/zig.h +61 -11
- package/compiler/build_runner.zig +0 -1857
- package/compiler_rt/long_double.zig +0 -37
- package/include/amxbf16transposeintrin.h +0 -94
- package/include/amxcomplextransposeintrin.h +0 -303
- package/include/amxfp16transposeintrin.h +0 -94
- package/include/amxmovrstransposeintrin.h +0 -200
- package/include/amxtf32transposeintrin.h +0 -105
- package/include/amxtransposeintrin.h +0 -248
- package/libc/include/arm-netbsd-eabi/machine/frame.h +0 -130
- package/libc/include/generic-netbsd/powerpc/bswap.h +0 -8
- package/libc/include/hexagon-linux-any/asm/signal.h +0 -29
- package/libc/include/mips-netbsd-eabi/machine/psl.h +0 -3
- package/libc/include/mips-netbsd-eabi/machine/reloc.h +0 -3
- package/libc/include/mips-netbsd-eabi/machine/trap.h +0 -3
- package/libc/include/mips64el-openbsd-none/loongson/hibernate.h +0 -33
- package/libc/include/mips64el-openbsd-none/loongson/hibernate_var.h +0 -39
- package/libc/include/mips64el-openbsd-none/machine/hibernate.h +0 -33
- package/libc/include/mips64el-openbsd-none/machine/hibernate_var.h +0 -39
- package/libc/include/s390x-linux-any/asm/tape390.h +0 -103
- package/libc/mingw/math/lrintl.c +0 -18
- package/libc/mingw/math/rintl.c +0 -16
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/i386/log1p.s +0 -25
- package/libc/musl/src/math/i386/log1pf.s +0 -26
- package/libc/musl/src/math/i386/lrintl.c +0 -8
- package/libc/musl/src/math/i386/rintl.c +0 -7
- package/libc/musl/src/math/log1p.c +0 -122
- package/libc/musl/src/math/log1pf.c +0 -77
- package/libc/musl/src/math/lrintl.c +0 -36
- package/libc/musl/src/math/rintl.c +0 -29
- package/libc/musl/src/math/s390x/rintl.c +0 -15
- package/libc/musl/src/math/x32/lrintl.s +0 -7
- package/libc/musl/src/math/x32/rintl.s +0 -6
- package/libc/musl/src/math/x86_64/lrintl.c +0 -8
- package/libc/musl/src/math/x86_64/rintl.c +0 -7
- package/libc/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
- package/libtsan/sanitizer_common/sanitizer_coverage_interface.inc +0 -43
- package/std/Build/Step/CheckObject.zig +0 -2764
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/ansi.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/aout_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/asm.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/bswap.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/cdefs.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/cpu.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/disklabel.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/elf_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/endian.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/endian_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/fenv.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/float.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/fpu.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/frame.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/ieee.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/ieeefp.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/int_const.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/int_fmtio.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/int_limits.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/int_mwgwtypes.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/int_types.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/intr.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/kcore.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/limits.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/lock.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/math.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/mcontext.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/mutex.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/param.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/pcb.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/pmap.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/proc.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/profile.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/psl.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/pte.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/ptrace.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/reg.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/reloc.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/rwlock.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/setjmp.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/signal.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/sljit_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/trap.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/types.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/vmparam.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/evbppc/wchar_limits.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/machine/fpu.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/machine/intr.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ansi.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/aout_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/cdefs.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/elf_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/endian.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/endian_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/float.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/fpu.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/frame.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ibm4xx/cpu.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ibm4xx/spr.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ibm4xx/tlb.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ieeefp.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/int_const.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/int_fmtio.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/int_limits.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/int_mwgwtypes.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/int_types.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/kcore.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/lock.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/math.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/bat.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/hid_601.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/pte.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/spr.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/sr_601.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/oea/vmparam.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/param.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/pcb.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/proc.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/profile.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/pte.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/ptrace.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/reg.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/reloc.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/rwlock.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/setjmp.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/signal.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/sljit_machdep.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/spr.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/trap.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/types.h +0 -0
- /package/libc/include/{generic-netbsd → powerpc-netbsd-eabi}/powerpc/wchar_limits.h +0 -0
|
@@ -1,2764 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
const assert = std.debug.assert;
|
|
3
|
-
const elf = std.elf;
|
|
4
|
-
const fs = std.fs;
|
|
5
|
-
const macho = std.macho;
|
|
6
|
-
const math = std.math;
|
|
7
|
-
const mem = std.mem;
|
|
8
|
-
const testing = std.testing;
|
|
9
|
-
const Writer = std.Io.Writer;
|
|
10
|
-
|
|
11
|
-
const CheckObject = @This();
|
|
12
|
-
|
|
13
|
-
const Allocator = mem.Allocator;
|
|
14
|
-
const Step = std.Build.Step;
|
|
15
|
-
|
|
16
|
-
pub const base_id: Step.Id = .check_object;
|
|
17
|
-
|
|
18
|
-
step: Step,
|
|
19
|
-
source: std.Build.LazyPath,
|
|
20
|
-
max_bytes: usize = 20 * 1024 * 1024,
|
|
21
|
-
checks: std.array_list.Managed(Check),
|
|
22
|
-
obj_format: std.Target.ObjectFormat,
|
|
23
|
-
|
|
24
|
-
pub fn create(
|
|
25
|
-
owner: *std.Build,
|
|
26
|
-
source: std.Build.LazyPath,
|
|
27
|
-
obj_format: std.Target.ObjectFormat,
|
|
28
|
-
) *CheckObject {
|
|
29
|
-
const gpa = owner.allocator;
|
|
30
|
-
const check_object = gpa.create(CheckObject) catch @panic("OOM");
|
|
31
|
-
check_object.* = .{
|
|
32
|
-
.step = .init(.{
|
|
33
|
-
.id = base_id,
|
|
34
|
-
.name = "CheckObject",
|
|
35
|
-
.owner = owner,
|
|
36
|
-
.makeFn = make,
|
|
37
|
-
}),
|
|
38
|
-
.source = source.dupe(owner),
|
|
39
|
-
.checks = std.array_list.Managed(Check).init(gpa),
|
|
40
|
-
.obj_format = obj_format,
|
|
41
|
-
};
|
|
42
|
-
check_object.source.addStepDependencies(&check_object.step);
|
|
43
|
-
return check_object;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const SearchPhrase = struct {
|
|
47
|
-
string: []const u8,
|
|
48
|
-
lazy_path: ?std.Build.LazyPath = null,
|
|
49
|
-
|
|
50
|
-
fn resolve(phrase: SearchPhrase, b: *std.Build, step: *Step) []const u8 {
|
|
51
|
-
const lazy_path = phrase.lazy_path orelse return phrase.string;
|
|
52
|
-
return b.fmt("{s} {s}", .{ phrase.string, lazy_path.getPath2(b, step) });
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/// There five types of actions currently supported:
|
|
57
|
-
/// .exact - will do an exact match against the haystack
|
|
58
|
-
/// .contains - will check for existence within the haystack
|
|
59
|
-
/// .not_present - will check for non-existence within the haystack
|
|
60
|
-
/// .extract - will do an exact match and extract into a variable enclosed within `{name}` braces
|
|
61
|
-
/// .compute_cmp - will perform an operation on the extracted global variables
|
|
62
|
-
/// using the MatchAction. It currently only supports an addition. The operation is required
|
|
63
|
-
/// to be specified in Reverse Polish Notation to ease in operator-precedence parsing (well,
|
|
64
|
-
/// to avoid any parsing really).
|
|
65
|
-
/// For example, if the two extracted values were saved as `vmaddr` and `entryoff` respectively
|
|
66
|
-
/// they could then be added with this simple program `vmaddr entryoff +`.
|
|
67
|
-
const Action = struct {
|
|
68
|
-
tag: enum { exact, contains, not_present, extract, compute_cmp },
|
|
69
|
-
phrase: SearchPhrase,
|
|
70
|
-
expected: ?ComputeCompareExpected = null,
|
|
71
|
-
|
|
72
|
-
/// Returns true if the `phrase` is an exact match with the haystack and variable was successfully extracted.
|
|
73
|
-
fn extract(
|
|
74
|
-
act: Action,
|
|
75
|
-
b: *std.Build,
|
|
76
|
-
step: *Step,
|
|
77
|
-
haystack: []const u8,
|
|
78
|
-
global_vars: anytype,
|
|
79
|
-
) !bool {
|
|
80
|
-
assert(act.tag == .extract);
|
|
81
|
-
const hay = mem.trim(u8, haystack, " ");
|
|
82
|
-
const phrase = mem.trim(u8, act.phrase.resolve(b, step), " ");
|
|
83
|
-
|
|
84
|
-
var candidate_vars: std.array_list.Managed(struct { name: []const u8, value: u64 }) = .init(b.allocator);
|
|
85
|
-
var hay_it = mem.tokenizeScalar(u8, hay, ' ');
|
|
86
|
-
var needle_it = mem.tokenizeScalar(u8, phrase, ' ');
|
|
87
|
-
|
|
88
|
-
while (needle_it.next()) |needle_tok| {
|
|
89
|
-
const hay_tok = hay_it.next() orelse break;
|
|
90
|
-
if (mem.startsWith(u8, needle_tok, "{")) {
|
|
91
|
-
const closing_brace = mem.find(u8, needle_tok, "}") orelse return error.MissingClosingBrace;
|
|
92
|
-
if (closing_brace != needle_tok.len - 1) return error.ClosingBraceNotLast;
|
|
93
|
-
|
|
94
|
-
const name = needle_tok[1..closing_brace];
|
|
95
|
-
if (name.len == 0) return error.MissingBraceValue;
|
|
96
|
-
const value = std.fmt.parseInt(u64, hay_tok, 16) catch return false;
|
|
97
|
-
try candidate_vars.append(.{
|
|
98
|
-
.name = name,
|
|
99
|
-
.value = value,
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
if (!mem.eql(u8, hay_tok, needle_tok)) return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (candidate_vars.items.len == 0) return false;
|
|
107
|
-
|
|
108
|
-
for (candidate_vars.items) |cv| try global_vars.putNoClobber(cv.name, cv.value);
|
|
109
|
-
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/// Returns true if the `phrase` is an exact match with the haystack.
|
|
114
|
-
fn exact(
|
|
115
|
-
act: Action,
|
|
116
|
-
b: *std.Build,
|
|
117
|
-
step: *Step,
|
|
118
|
-
haystack: []const u8,
|
|
119
|
-
) bool {
|
|
120
|
-
assert(act.tag == .exact);
|
|
121
|
-
const hay = mem.trim(u8, haystack, " ");
|
|
122
|
-
const phrase = mem.trim(u8, act.phrase.resolve(b, step), " ");
|
|
123
|
-
return mem.eql(u8, hay, phrase);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/// Returns true if the `phrase` exists within the haystack.
|
|
127
|
-
fn contains(
|
|
128
|
-
act: Action,
|
|
129
|
-
b: *std.Build,
|
|
130
|
-
step: *Step,
|
|
131
|
-
haystack: []const u8,
|
|
132
|
-
) bool {
|
|
133
|
-
assert(act.tag == .contains);
|
|
134
|
-
const hay = mem.trim(u8, haystack, " ");
|
|
135
|
-
const phrase = mem.trim(u8, act.phrase.resolve(b, step), " ");
|
|
136
|
-
return mem.find(u8, hay, phrase) != null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/// Returns true if the `phrase` does not exist within the haystack.
|
|
140
|
-
fn notPresent(
|
|
141
|
-
act: Action,
|
|
142
|
-
b: *std.Build,
|
|
143
|
-
step: *Step,
|
|
144
|
-
haystack: []const u8,
|
|
145
|
-
) bool {
|
|
146
|
-
assert(act.tag == .not_present);
|
|
147
|
-
return !contains(.{
|
|
148
|
-
.tag = .contains,
|
|
149
|
-
.phrase = act.phrase,
|
|
150
|
-
.expected = act.expected,
|
|
151
|
-
}, b, step, haystack);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/// Will return true if the `phrase` is correctly parsed into an RPN program and
|
|
155
|
-
/// its reduced, computed value compares using `op` with the expected value, either
|
|
156
|
-
/// a literal or another extracted variable.
|
|
157
|
-
fn computeCmp(act: Action, b: *std.Build, step: *Step, global_vars: anytype) !bool {
|
|
158
|
-
const gpa = step.owner.allocator;
|
|
159
|
-
const phrase = act.phrase.resolve(b, step);
|
|
160
|
-
var op_stack = std.array_list.Managed(enum { add, sub, mod, mul }).init(gpa);
|
|
161
|
-
var values = std.array_list.Managed(u64).init(gpa);
|
|
162
|
-
|
|
163
|
-
var it = mem.tokenizeScalar(u8, phrase, ' ');
|
|
164
|
-
while (it.next()) |next| {
|
|
165
|
-
if (mem.eql(u8, next, "+")) {
|
|
166
|
-
try op_stack.append(.add);
|
|
167
|
-
} else if (mem.eql(u8, next, "-")) {
|
|
168
|
-
try op_stack.append(.sub);
|
|
169
|
-
} else if (mem.eql(u8, next, "%")) {
|
|
170
|
-
try op_stack.append(.mod);
|
|
171
|
-
} else if (mem.eql(u8, next, "*")) {
|
|
172
|
-
try op_stack.append(.mul);
|
|
173
|
-
} else {
|
|
174
|
-
const val = std.fmt.parseInt(u64, next, 0) catch blk: {
|
|
175
|
-
break :blk global_vars.get(next) orelse {
|
|
176
|
-
try step.addError(
|
|
177
|
-
\\
|
|
178
|
-
\\========= variable was not extracted: ===========
|
|
179
|
-
\\{s}
|
|
180
|
-
\\=================================================
|
|
181
|
-
, .{next});
|
|
182
|
-
return error.UnknownVariable;
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
try values.append(val);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
var op_i: usize = 1;
|
|
190
|
-
var reduced: u64 = values.items[0];
|
|
191
|
-
for (op_stack.items) |op| {
|
|
192
|
-
const other = values.items[op_i];
|
|
193
|
-
switch (op) {
|
|
194
|
-
.add => {
|
|
195
|
-
reduced += other;
|
|
196
|
-
},
|
|
197
|
-
.sub => {
|
|
198
|
-
reduced -= other;
|
|
199
|
-
},
|
|
200
|
-
.mod => {
|
|
201
|
-
reduced %= other;
|
|
202
|
-
},
|
|
203
|
-
.mul => {
|
|
204
|
-
reduced *= other;
|
|
205
|
-
},
|
|
206
|
-
}
|
|
207
|
-
op_i += 1;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const exp_value = switch (act.expected.?.value) {
|
|
211
|
-
.variable => |name| global_vars.get(name) orelse {
|
|
212
|
-
try step.addError(
|
|
213
|
-
\\
|
|
214
|
-
\\========= variable was not extracted: ===========
|
|
215
|
-
\\{s}
|
|
216
|
-
\\=================================================
|
|
217
|
-
, .{name});
|
|
218
|
-
return error.UnknownVariable;
|
|
219
|
-
},
|
|
220
|
-
.literal => |x| x,
|
|
221
|
-
};
|
|
222
|
-
return math.compare(reduced, act.expected.?.op, exp_value);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const ComputeCompareExpected = struct {
|
|
227
|
-
op: math.CompareOperator,
|
|
228
|
-
value: union(enum) {
|
|
229
|
-
variable: []const u8,
|
|
230
|
-
literal: u64,
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
pub fn format(value: ComputeCompareExpected, w: *Writer) Writer.Error!void {
|
|
234
|
-
try w.print("{t} ", .{value.op});
|
|
235
|
-
switch (value.value) {
|
|
236
|
-
.variable => |name| try w.writeAll(name),
|
|
237
|
-
.literal => |x| try w.print("{x}", .{x}),
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
const Check = struct {
|
|
243
|
-
kind: Kind,
|
|
244
|
-
payload: Payload,
|
|
245
|
-
data: std.array_list.Managed(u8),
|
|
246
|
-
actions: std.array_list.Managed(Action),
|
|
247
|
-
|
|
248
|
-
fn create(allocator: Allocator, kind: Kind) Check {
|
|
249
|
-
return .{
|
|
250
|
-
.kind = kind,
|
|
251
|
-
.payload = .{ .none = {} },
|
|
252
|
-
.data = std.array_list.Managed(u8).init(allocator),
|
|
253
|
-
.actions = std.array_list.Managed(Action).init(allocator),
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
fn dumpSection(allocator: Allocator, name: [:0]const u8) Check {
|
|
258
|
-
var check = Check.create(allocator, .dump_section);
|
|
259
|
-
const off: u32 = @intCast(check.data.items.len);
|
|
260
|
-
check.data.print("{s}\x00", .{name}) catch @panic("OOM");
|
|
261
|
-
check.payload = .{ .dump_section = off };
|
|
262
|
-
return check;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
fn extract(check: *Check, phrase: SearchPhrase) void {
|
|
266
|
-
check.actions.append(.{
|
|
267
|
-
.tag = .extract,
|
|
268
|
-
.phrase = phrase,
|
|
269
|
-
}) catch @panic("OOM");
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
fn exact(check: *Check, phrase: SearchPhrase) void {
|
|
273
|
-
check.actions.append(.{
|
|
274
|
-
.tag = .exact,
|
|
275
|
-
.phrase = phrase,
|
|
276
|
-
}) catch @panic("OOM");
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
fn contains(check: *Check, phrase: SearchPhrase) void {
|
|
280
|
-
check.actions.append(.{
|
|
281
|
-
.tag = .contains,
|
|
282
|
-
.phrase = phrase,
|
|
283
|
-
}) catch @panic("OOM");
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
fn notPresent(check: *Check, phrase: SearchPhrase) void {
|
|
287
|
-
check.actions.append(.{
|
|
288
|
-
.tag = .not_present,
|
|
289
|
-
.phrase = phrase,
|
|
290
|
-
}) catch @panic("OOM");
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
fn computeCmp(check: *Check, phrase: SearchPhrase, expected: ComputeCompareExpected) void {
|
|
294
|
-
check.actions.append(.{
|
|
295
|
-
.tag = .compute_cmp,
|
|
296
|
-
.phrase = phrase,
|
|
297
|
-
.expected = expected,
|
|
298
|
-
}) catch @panic("OOM");
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const Kind = enum {
|
|
302
|
-
headers,
|
|
303
|
-
symtab,
|
|
304
|
-
indirect_symtab,
|
|
305
|
-
dynamic_symtab,
|
|
306
|
-
archive_symtab,
|
|
307
|
-
dynamic_section,
|
|
308
|
-
dyld_rebase,
|
|
309
|
-
dyld_bind,
|
|
310
|
-
dyld_weak_bind,
|
|
311
|
-
dyld_lazy_bind,
|
|
312
|
-
exports,
|
|
313
|
-
compute_compare,
|
|
314
|
-
dump_section,
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
const Payload = union {
|
|
318
|
-
none: void,
|
|
319
|
-
/// Null-delimited string in the 'data' buffer.
|
|
320
|
-
dump_section: u32,
|
|
321
|
-
};
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
/// Creates a new empty sequence of actions.
|
|
325
|
-
fn checkStart(check_object: *CheckObject, kind: Check.Kind) void {
|
|
326
|
-
const check = Check.create(check_object.step.owner.allocator, kind);
|
|
327
|
-
check_object.checks.append(check) catch @panic("OOM");
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/// Adds an exact match phrase to the latest created Check.
|
|
331
|
-
pub fn checkExact(check_object: *CheckObject, phrase: []const u8) void {
|
|
332
|
-
check_object.checkExactInner(phrase, null);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/// Like `checkExact()` but takes an additional argument `LazyPath` which will be
|
|
336
|
-
/// resolved to a full search query in `make()`.
|
|
337
|
-
pub fn checkExactPath(check_object: *CheckObject, phrase: []const u8, lazy_path: std.Build.LazyPath) void {
|
|
338
|
-
check_object.checkExactInner(phrase, lazy_path);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
fn checkExactInner(check_object: *CheckObject, phrase: []const u8, lazy_path: ?std.Build.LazyPath) void {
|
|
342
|
-
assert(check_object.checks.items.len > 0);
|
|
343
|
-
const last = &check_object.checks.items[check_object.checks.items.len - 1];
|
|
344
|
-
last.exact(.{ .string = check_object.step.owner.dupe(phrase), .lazy_path = lazy_path });
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/// Adds a fuzzy match phrase to the latest created Check.
|
|
348
|
-
pub fn checkContains(check_object: *CheckObject, phrase: []const u8) void {
|
|
349
|
-
check_object.checkContainsInner(phrase, null);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/// Like `checkContains()` but takes an additional argument `lazy_path` which will be
|
|
353
|
-
/// resolved to a full search query in `make()`.
|
|
354
|
-
pub fn checkContainsPath(
|
|
355
|
-
check_object: *CheckObject,
|
|
356
|
-
phrase: []const u8,
|
|
357
|
-
lazy_path: std.Build.LazyPath,
|
|
358
|
-
) void {
|
|
359
|
-
check_object.checkContainsInner(phrase, lazy_path);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
fn checkContainsInner(check_object: *CheckObject, phrase: []const u8, lazy_path: ?std.Build.LazyPath) void {
|
|
363
|
-
assert(check_object.checks.items.len > 0);
|
|
364
|
-
const last = &check_object.checks.items[check_object.checks.items.len - 1];
|
|
365
|
-
last.contains(.{ .string = check_object.step.owner.dupe(phrase), .lazy_path = lazy_path });
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/// Adds an exact match phrase with variable extractor to the latest created Check.
|
|
369
|
-
pub fn checkExtract(check_object: *CheckObject, phrase: []const u8) void {
|
|
370
|
-
check_object.checkExtractInner(phrase, null);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/// Like `checkExtract()` but takes an additional argument `LazyPath` which will be
|
|
374
|
-
/// resolved to a full search query in `make()`.
|
|
375
|
-
pub fn checkExtractLazyPath(check_object: *CheckObject, phrase: []const u8, lazy_path: std.Build.LazyPath) void {
|
|
376
|
-
check_object.checkExtractInner(phrase, lazy_path);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
fn checkExtractInner(check_object: *CheckObject, phrase: []const u8, lazy_path: ?std.Build.LazyPath) void {
|
|
380
|
-
assert(check_object.checks.items.len > 0);
|
|
381
|
-
const last = &check_object.checks.items[check_object.checks.items.len - 1];
|
|
382
|
-
last.extract(.{ .string = check_object.step.owner.dupe(phrase), .lazy_path = lazy_path });
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/// Adds another searched phrase to the latest created Check
|
|
386
|
-
/// however ensures there is no matching phrase in the output.
|
|
387
|
-
pub fn checkNotPresent(check_object: *CheckObject, phrase: []const u8) void {
|
|
388
|
-
check_object.checkNotPresentInner(phrase, null);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/// Like `checkExtract()` but takes an additional argument `LazyPath` which will be
|
|
392
|
-
/// resolved to a full search query in `make()`.
|
|
393
|
-
pub fn checkNotPresentLazyPath(check_object: *CheckObject, phrase: []const u8, lazy_path: std.Build.LazyPath) void {
|
|
394
|
-
check_object.checkNotPresentInner(phrase, lazy_path);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
fn checkNotPresentInner(check_object: *CheckObject, phrase: []const u8, lazy_path: ?std.Build.LazyPath) void {
|
|
398
|
-
assert(check_object.checks.items.len > 0);
|
|
399
|
-
const last = &check_object.checks.items[check_object.checks.items.len - 1];
|
|
400
|
-
last.notPresent(.{ .string = check_object.step.owner.dupe(phrase), .lazy_path = lazy_path });
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/// Creates a new check checking in the file headers (section, program headers, etc.).
|
|
404
|
-
pub fn checkInHeaders(check_object: *CheckObject) void {
|
|
405
|
-
check_object.checkStart(.headers);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/// Creates a new check checking specifically symbol table parsed and dumped from the object
|
|
409
|
-
/// file.
|
|
410
|
-
pub fn checkInSymtab(check_object: *CheckObject) void {
|
|
411
|
-
const label = switch (check_object.obj_format) {
|
|
412
|
-
.macho => MachODumper.symtab_label,
|
|
413
|
-
.elf => ElfDumper.symtab_label,
|
|
414
|
-
.wasm => WasmDumper.symtab_label,
|
|
415
|
-
.coff => @panic("TODO symtab for coff"),
|
|
416
|
-
else => @panic("TODO other file formats"),
|
|
417
|
-
};
|
|
418
|
-
check_object.checkStart(.symtab);
|
|
419
|
-
check_object.checkExact(label);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/// Creates a new check checking specifically dyld rebase opcodes contents parsed and dumped
|
|
423
|
-
/// from the object file.
|
|
424
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
425
|
-
pub fn checkInDyldRebase(check_object: *CheckObject) void {
|
|
426
|
-
const label = switch (check_object.obj_format) {
|
|
427
|
-
.macho => MachODumper.dyld_rebase_label,
|
|
428
|
-
else => @panic("Unsupported target platform"),
|
|
429
|
-
};
|
|
430
|
-
check_object.checkStart(.dyld_rebase);
|
|
431
|
-
check_object.checkExact(label);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/// Creates a new check checking specifically dyld bind opcodes contents parsed and dumped
|
|
435
|
-
/// from the object file.
|
|
436
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
437
|
-
pub fn checkInDyldBind(check_object: *CheckObject) void {
|
|
438
|
-
const label = switch (check_object.obj_format) {
|
|
439
|
-
.macho => MachODumper.dyld_bind_label,
|
|
440
|
-
else => @panic("Unsupported target platform"),
|
|
441
|
-
};
|
|
442
|
-
check_object.checkStart(.dyld_bind);
|
|
443
|
-
check_object.checkExact(label);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/// Creates a new check checking specifically dyld weak bind opcodes contents parsed and dumped
|
|
447
|
-
/// from the object file.
|
|
448
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
449
|
-
pub fn checkInDyldWeakBind(check_object: *CheckObject) void {
|
|
450
|
-
const label = switch (check_object.obj_format) {
|
|
451
|
-
.macho => MachODumper.dyld_weak_bind_label,
|
|
452
|
-
else => @panic("Unsupported target platform"),
|
|
453
|
-
};
|
|
454
|
-
check_object.checkStart(.dyld_weak_bind);
|
|
455
|
-
check_object.checkExact(label);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/// Creates a new check checking specifically dyld lazy bind opcodes contents parsed and dumped
|
|
459
|
-
/// from the object file.
|
|
460
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
461
|
-
pub fn checkInDyldLazyBind(check_object: *CheckObject) void {
|
|
462
|
-
const label = switch (check_object.obj_format) {
|
|
463
|
-
.macho => MachODumper.dyld_lazy_bind_label,
|
|
464
|
-
else => @panic("Unsupported target platform"),
|
|
465
|
-
};
|
|
466
|
-
check_object.checkStart(.dyld_lazy_bind);
|
|
467
|
-
check_object.checkExact(label);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/// Creates a new check checking specifically exports info contents parsed and dumped
|
|
471
|
-
/// from the object file.
|
|
472
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
473
|
-
pub fn checkInExports(check_object: *CheckObject) void {
|
|
474
|
-
const label = switch (check_object.obj_format) {
|
|
475
|
-
.macho => MachODumper.exports_label,
|
|
476
|
-
else => @panic("Unsupported target platform"),
|
|
477
|
-
};
|
|
478
|
-
check_object.checkStart(.exports);
|
|
479
|
-
check_object.checkExact(label);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/// Creates a new check checking specifically indirect symbol table parsed and dumped
|
|
483
|
-
/// from the object file.
|
|
484
|
-
/// This check is target-dependent and applicable to MachO only.
|
|
485
|
-
pub fn checkInIndirectSymtab(check_object: *CheckObject) void {
|
|
486
|
-
const label = switch (check_object.obj_format) {
|
|
487
|
-
.macho => MachODumper.indirect_symtab_label,
|
|
488
|
-
else => @panic("Unsupported target platform"),
|
|
489
|
-
};
|
|
490
|
-
check_object.checkStart(.indirect_symtab);
|
|
491
|
-
check_object.checkExact(label);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/// Creates a new check checking specifically dynamic symbol table parsed and dumped from the object
|
|
495
|
-
/// file.
|
|
496
|
-
/// This check is target-dependent and applicable to ELF only.
|
|
497
|
-
pub fn checkInDynamicSymtab(check_object: *CheckObject) void {
|
|
498
|
-
const label = switch (check_object.obj_format) {
|
|
499
|
-
.elf => ElfDumper.dynamic_symtab_label,
|
|
500
|
-
else => @panic("Unsupported target platform"),
|
|
501
|
-
};
|
|
502
|
-
check_object.checkStart(.dynamic_symtab);
|
|
503
|
-
check_object.checkExact(label);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/// Creates a new check checking specifically dynamic section parsed and dumped from the object
|
|
507
|
-
/// file.
|
|
508
|
-
/// This check is target-dependent and applicable to ELF only.
|
|
509
|
-
pub fn checkInDynamicSection(check_object: *CheckObject) void {
|
|
510
|
-
const label = switch (check_object.obj_format) {
|
|
511
|
-
.elf => ElfDumper.dynamic_section_label,
|
|
512
|
-
else => @panic("Unsupported target platform"),
|
|
513
|
-
};
|
|
514
|
-
check_object.checkStart(.dynamic_section);
|
|
515
|
-
check_object.checkExact(label);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/// Creates a new check checking specifically symbol table parsed and dumped from the archive
|
|
519
|
-
/// file.
|
|
520
|
-
pub fn checkInArchiveSymtab(check_object: *CheckObject) void {
|
|
521
|
-
const label = switch (check_object.obj_format) {
|
|
522
|
-
.elf => ElfDumper.archive_symtab_label,
|
|
523
|
-
else => @panic("TODO other file formats"),
|
|
524
|
-
};
|
|
525
|
-
check_object.checkStart(.archive_symtab);
|
|
526
|
-
check_object.checkExact(label);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
pub fn dumpSection(check_object: *CheckObject, name: [:0]const u8) void {
|
|
530
|
-
const check = Check.dumpSection(check_object.step.owner.allocator, name);
|
|
531
|
-
check_object.checks.append(check) catch @panic("OOM");
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/// Creates a new standalone, singular check which allows running simple binary operations
|
|
535
|
-
/// on the extracted variables. It will then compare the reduced program with the value of
|
|
536
|
-
/// the expected variable.
|
|
537
|
-
pub fn checkComputeCompare(
|
|
538
|
-
check_object: *CheckObject,
|
|
539
|
-
program: []const u8,
|
|
540
|
-
expected: ComputeCompareExpected,
|
|
541
|
-
) void {
|
|
542
|
-
var check = Check.create(check_object.step.owner.allocator, .compute_compare);
|
|
543
|
-
check.computeCmp(.{ .string = check_object.step.owner.dupe(program) }, expected);
|
|
544
|
-
check_object.checks.append(check) catch @panic("OOM");
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
fn make(step: *Step, make_options: Step.MakeOptions) !void {
|
|
548
|
-
_ = make_options;
|
|
549
|
-
const b = step.owner;
|
|
550
|
-
const io = b.graph.io;
|
|
551
|
-
const gpa = b.allocator;
|
|
552
|
-
const check_object: *CheckObject = @fieldParentPtr("step", step);
|
|
553
|
-
try step.singleUnchangingWatchInput(check_object.source);
|
|
554
|
-
|
|
555
|
-
const src_path = check_object.source.getPath3(b, step);
|
|
556
|
-
const contents = src_path.root_dir.handle.readFileAllocOptions(
|
|
557
|
-
io,
|
|
558
|
-
src_path.sub_path,
|
|
559
|
-
gpa,
|
|
560
|
-
.limited(check_object.max_bytes),
|
|
561
|
-
.of(u64),
|
|
562
|
-
null,
|
|
563
|
-
) catch |err| return step.fail("unable to read '{f}': {t}", .{
|
|
564
|
-
std.fmt.alt(src_path, .formatEscapeChar), err,
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
var vars: std.StringHashMap(u64) = .init(gpa);
|
|
568
|
-
for (check_object.checks.items) |chk| {
|
|
569
|
-
if (chk.kind == .compute_compare) {
|
|
570
|
-
assert(chk.actions.items.len == 1);
|
|
571
|
-
const act = chk.actions.items[0];
|
|
572
|
-
assert(act.tag == .compute_cmp);
|
|
573
|
-
const res = act.computeCmp(b, step, vars) catch |err| switch (err) {
|
|
574
|
-
error.UnknownVariable => return step.fail("Unknown variable", .{}),
|
|
575
|
-
else => |e| return e,
|
|
576
|
-
};
|
|
577
|
-
if (!res) {
|
|
578
|
-
return step.fail(
|
|
579
|
-
\\
|
|
580
|
-
\\========= comparison failed for action: ===========
|
|
581
|
-
\\{s} {f}
|
|
582
|
-
\\===================================================
|
|
583
|
-
, .{ act.phrase.resolve(b, step), act.expected.? });
|
|
584
|
-
}
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
const output = switch (check_object.obj_format) {
|
|
589
|
-
.macho => try MachODumper.parseAndDump(step, chk, contents),
|
|
590
|
-
.elf => try ElfDumper.parseAndDump(step, chk, contents),
|
|
591
|
-
.coff => return step.fail("TODO coff parser", .{}),
|
|
592
|
-
.wasm => try WasmDumper.parseAndDump(step, chk, contents),
|
|
593
|
-
else => unreachable,
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
// Depending on whether we requested dumping section verbatim or not,
|
|
597
|
-
// we either format message string with escaped codes, or not to aid debugging
|
|
598
|
-
// the failed test.
|
|
599
|
-
const fmtMessageString = struct {
|
|
600
|
-
fn fmtMessageString(kind: Check.Kind, msg: []const u8) std.fmt.Alt(Ctx, formatMessageString) {
|
|
601
|
-
return .{ .data = .{
|
|
602
|
-
.kind = kind,
|
|
603
|
-
.msg = msg,
|
|
604
|
-
} };
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
const Ctx = struct {
|
|
608
|
-
kind: Check.Kind,
|
|
609
|
-
msg: []const u8,
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
fn formatMessageString(ctx: Ctx, w: *Writer) !void {
|
|
613
|
-
switch (ctx.kind) {
|
|
614
|
-
.dump_section => try w.print("{f}", .{std.ascii.hexEscape(ctx.msg, .lower)}),
|
|
615
|
-
else => try w.writeAll(ctx.msg),
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}.fmtMessageString;
|
|
619
|
-
|
|
620
|
-
var it = mem.tokenizeAny(u8, output, "\r\n");
|
|
621
|
-
for (chk.actions.items) |act| {
|
|
622
|
-
switch (act.tag) {
|
|
623
|
-
.exact => {
|
|
624
|
-
while (it.next()) |line| {
|
|
625
|
-
if (act.exact(b, step, line)) break;
|
|
626
|
-
} else {
|
|
627
|
-
return step.fail(
|
|
628
|
-
\\
|
|
629
|
-
\\========= expected to find: ==========================
|
|
630
|
-
\\{f}
|
|
631
|
-
\\========= but parsed file does not contain it: =======
|
|
632
|
-
\\{f}
|
|
633
|
-
\\========= file path: =================================
|
|
634
|
-
\\{f}
|
|
635
|
-
, .{
|
|
636
|
-
fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
|
|
637
|
-
fmtMessageString(chk.kind, output),
|
|
638
|
-
src_path,
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
|
|
643
|
-
.contains => {
|
|
644
|
-
while (it.next()) |line| {
|
|
645
|
-
if (act.contains(b, step, line)) break;
|
|
646
|
-
} else {
|
|
647
|
-
return step.fail(
|
|
648
|
-
\\
|
|
649
|
-
\\========= expected to find: ==========================
|
|
650
|
-
\\*{f}*
|
|
651
|
-
\\========= but parsed file does not contain it: =======
|
|
652
|
-
\\{f}
|
|
653
|
-
\\========= file path: =================================
|
|
654
|
-
\\{f}
|
|
655
|
-
, .{
|
|
656
|
-
fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
|
|
657
|
-
fmtMessageString(chk.kind, output),
|
|
658
|
-
src_path,
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
|
|
663
|
-
.not_present => {
|
|
664
|
-
while (it.next()) |line| {
|
|
665
|
-
if (act.notPresent(b, step, line)) continue;
|
|
666
|
-
return step.fail(
|
|
667
|
-
\\
|
|
668
|
-
\\========= expected not to find: ===================
|
|
669
|
-
\\{f}
|
|
670
|
-
\\========= but parsed file does contain it: ========
|
|
671
|
-
\\{f}
|
|
672
|
-
\\========= file path: ==============================
|
|
673
|
-
\\{f}
|
|
674
|
-
, .{
|
|
675
|
-
fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
|
|
676
|
-
fmtMessageString(chk.kind, output),
|
|
677
|
-
src_path,
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
|
|
682
|
-
.extract => {
|
|
683
|
-
while (it.next()) |line| {
|
|
684
|
-
if (try act.extract(b, step, line, &vars)) break;
|
|
685
|
-
} else {
|
|
686
|
-
return step.fail(
|
|
687
|
-
\\
|
|
688
|
-
\\========= expected to find and extract: ==============
|
|
689
|
-
\\{f}
|
|
690
|
-
\\========= but parsed file does not contain it: =======
|
|
691
|
-
\\{f}
|
|
692
|
-
\\========= file path: ==============================
|
|
693
|
-
\\{f}
|
|
694
|
-
, .{
|
|
695
|
-
fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
|
|
696
|
-
fmtMessageString(chk.kind, output),
|
|
697
|
-
src_path,
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
|
|
702
|
-
.compute_cmp => unreachable,
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
const MachODumper = struct {
|
|
709
|
-
const dyld_rebase_label = "dyld rebase data";
|
|
710
|
-
const dyld_bind_label = "dyld bind data";
|
|
711
|
-
const dyld_weak_bind_label = "dyld weak bind data";
|
|
712
|
-
const dyld_lazy_bind_label = "dyld lazy bind data";
|
|
713
|
-
const exports_label = "exports data";
|
|
714
|
-
const symtab_label = "symbol table";
|
|
715
|
-
const indirect_symtab_label = "indirect symbol table";
|
|
716
|
-
|
|
717
|
-
fn parseAndDump(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
718
|
-
// TODO: handle archives and fat files
|
|
719
|
-
return parseAndDumpObject(step, check, bytes);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
const ObjectContext = struct {
|
|
723
|
-
gpa: Allocator,
|
|
724
|
-
data: []const u8,
|
|
725
|
-
header: macho.mach_header_64,
|
|
726
|
-
segments: std.ArrayList(macho.segment_command_64) = .empty,
|
|
727
|
-
sections: std.ArrayList(macho.section_64) = .empty,
|
|
728
|
-
symtab: std.ArrayList(macho.nlist_64) = .empty,
|
|
729
|
-
strtab: std.ArrayList(u8) = .empty,
|
|
730
|
-
indsymtab: std.ArrayList(u32) = .empty,
|
|
731
|
-
imports: std.ArrayList([]const u8) = .empty,
|
|
732
|
-
|
|
733
|
-
fn parse(ctx: *ObjectContext) !void {
|
|
734
|
-
var it = try ctx.getLoadCommandIterator();
|
|
735
|
-
var i: usize = 0;
|
|
736
|
-
while (try it.next()) |cmd| {
|
|
737
|
-
switch (cmd.hdr.cmd) {
|
|
738
|
-
.SEGMENT_64 => {
|
|
739
|
-
const seg = cmd.cast(macho.segment_command_64).?;
|
|
740
|
-
try ctx.segments.append(ctx.gpa, seg);
|
|
741
|
-
try ctx.sections.ensureUnusedCapacity(ctx.gpa, seg.nsects);
|
|
742
|
-
for (cmd.getSections()) |sect| {
|
|
743
|
-
ctx.sections.appendAssumeCapacity(sect);
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
.SYMTAB => {
|
|
747
|
-
const lc = cmd.cast(macho.symtab_command).?;
|
|
748
|
-
const symtab = @as([*]align(1) const macho.nlist_64, @ptrCast(ctx.data.ptr + lc.symoff))[0..lc.nsyms];
|
|
749
|
-
const strtab = ctx.data[lc.stroff..][0..lc.strsize];
|
|
750
|
-
try ctx.symtab.appendUnalignedSlice(ctx.gpa, symtab);
|
|
751
|
-
try ctx.strtab.appendSlice(ctx.gpa, strtab);
|
|
752
|
-
},
|
|
753
|
-
.DYSYMTAB => {
|
|
754
|
-
const lc = cmd.cast(macho.dysymtab_command).?;
|
|
755
|
-
const indexes = @as([*]align(1) const u32, @ptrCast(ctx.data.ptr + lc.indirectsymoff))[0..lc.nindirectsyms];
|
|
756
|
-
try ctx.indsymtab.appendUnalignedSlice(ctx.gpa, indexes);
|
|
757
|
-
},
|
|
758
|
-
.LOAD_DYLIB,
|
|
759
|
-
.LOAD_WEAK_DYLIB,
|
|
760
|
-
.REEXPORT_DYLIB,
|
|
761
|
-
=> {
|
|
762
|
-
try ctx.imports.append(ctx.gpa, cmd.getDylibPathName());
|
|
763
|
-
},
|
|
764
|
-
else => {},
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
i += 1;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
fn getString(ctx: ObjectContext, off: u32) [:0]const u8 {
|
|
772
|
-
assert(off < ctx.strtab.items.len);
|
|
773
|
-
return mem.sliceTo(@as([*:0]const u8, @ptrCast(ctx.strtab.items.ptr + off)), 0);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
fn getLoadCommandIterator(ctx: ObjectContext) !macho.LoadCommandIterator {
|
|
777
|
-
return .init(&ctx.header, ctx.data[@sizeOf(macho.mach_header_64)..]);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
fn getLoadCommand(ctx: ObjectContext, cmd: macho.LC) !?macho.LoadCommandIterator.LoadCommand {
|
|
781
|
-
var it = try ctx.getLoadCommandIterator();
|
|
782
|
-
while (try it.next()) |lc| if (lc.hdr.cmd == cmd) {
|
|
783
|
-
return lc;
|
|
784
|
-
};
|
|
785
|
-
return null;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
fn getSegmentByName(ctx: ObjectContext, name: []const u8) ?macho.segment_command_64 {
|
|
789
|
-
for (ctx.segments.items) |seg| {
|
|
790
|
-
if (mem.eql(u8, seg.segName(), name)) return seg;
|
|
791
|
-
}
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
fn getSectionByName(ctx: ObjectContext, segname: []const u8, sectname: []const u8) ?macho.section_64 {
|
|
796
|
-
for (ctx.sections.items) |sect| {
|
|
797
|
-
if (mem.eql(u8, sect.segName(), segname) and mem.eql(u8, sect.sectName(), sectname)) return sect;
|
|
798
|
-
}
|
|
799
|
-
return null;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
fn dumpHeader(hdr: macho.mach_header_64, writer: anytype) !void {
|
|
803
|
-
const cputype = switch (hdr.cputype) {
|
|
804
|
-
macho.CPU_TYPE_ARM64 => "ARM64",
|
|
805
|
-
macho.CPU_TYPE_X86_64 => "X86_64",
|
|
806
|
-
else => "Unknown",
|
|
807
|
-
};
|
|
808
|
-
const filetype = switch (hdr.filetype) {
|
|
809
|
-
macho.MH_OBJECT => "MH_OBJECT",
|
|
810
|
-
macho.MH_EXECUTE => "MH_EXECUTE",
|
|
811
|
-
macho.MH_FVMLIB => "MH_FVMLIB",
|
|
812
|
-
macho.MH_CORE => "MH_CORE",
|
|
813
|
-
macho.MH_PRELOAD => "MH_PRELOAD",
|
|
814
|
-
macho.MH_DYLIB => "MH_DYLIB",
|
|
815
|
-
macho.MH_DYLINKER => "MH_DYLINKER",
|
|
816
|
-
macho.MH_BUNDLE => "MH_BUNDLE",
|
|
817
|
-
macho.MH_DYLIB_STUB => "MH_DYLIB_STUB",
|
|
818
|
-
macho.MH_DSYM => "MH_DSYM",
|
|
819
|
-
macho.MH_KEXT_BUNDLE => "MH_KEXT_BUNDLE",
|
|
820
|
-
else => "Unknown",
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
try writer.print(
|
|
824
|
-
\\header
|
|
825
|
-
\\cputype {s}
|
|
826
|
-
\\filetype {s}
|
|
827
|
-
\\ncmds {d}
|
|
828
|
-
\\sizeofcmds {x}
|
|
829
|
-
\\flags
|
|
830
|
-
, .{
|
|
831
|
-
cputype,
|
|
832
|
-
filetype,
|
|
833
|
-
hdr.ncmds,
|
|
834
|
-
hdr.sizeofcmds,
|
|
835
|
-
});
|
|
836
|
-
|
|
837
|
-
if (hdr.flags > 0) {
|
|
838
|
-
if (hdr.flags & macho.MH_NOUNDEFS != 0) try writer.writeAll(" NOUNDEFS");
|
|
839
|
-
if (hdr.flags & macho.MH_INCRLINK != 0) try writer.writeAll(" INCRLINK");
|
|
840
|
-
if (hdr.flags & macho.MH_DYLDLINK != 0) try writer.writeAll(" DYLDLINK");
|
|
841
|
-
if (hdr.flags & macho.MH_BINDATLOAD != 0) try writer.writeAll(" BINDATLOAD");
|
|
842
|
-
if (hdr.flags & macho.MH_PREBOUND != 0) try writer.writeAll(" PREBOUND");
|
|
843
|
-
if (hdr.flags & macho.MH_SPLIT_SEGS != 0) try writer.writeAll(" SPLIT_SEGS");
|
|
844
|
-
if (hdr.flags & macho.MH_LAZY_INIT != 0) try writer.writeAll(" LAZY_INIT");
|
|
845
|
-
if (hdr.flags & macho.MH_TWOLEVEL != 0) try writer.writeAll(" TWOLEVEL");
|
|
846
|
-
if (hdr.flags & macho.MH_FORCE_FLAT != 0) try writer.writeAll(" FORCE_FLAT");
|
|
847
|
-
if (hdr.flags & macho.MH_NOMULTIDEFS != 0) try writer.writeAll(" NOMULTIDEFS");
|
|
848
|
-
if (hdr.flags & macho.MH_NOFIXPREBINDING != 0) try writer.writeAll(" NOFIXPREBINDING");
|
|
849
|
-
if (hdr.flags & macho.MH_PREBINDABLE != 0) try writer.writeAll(" PREBINDABLE");
|
|
850
|
-
if (hdr.flags & macho.MH_ALLMODSBOUND != 0) try writer.writeAll(" ALLMODSBOUND");
|
|
851
|
-
if (hdr.flags & macho.MH_SUBSECTIONS_VIA_SYMBOLS != 0) try writer.writeAll(" SUBSECTIONS_VIA_SYMBOLS");
|
|
852
|
-
if (hdr.flags & macho.MH_CANONICAL != 0) try writer.writeAll(" CANONICAL");
|
|
853
|
-
if (hdr.flags & macho.MH_WEAK_DEFINES != 0) try writer.writeAll(" WEAK_DEFINES");
|
|
854
|
-
if (hdr.flags & macho.MH_BINDS_TO_WEAK != 0) try writer.writeAll(" BINDS_TO_WEAK");
|
|
855
|
-
if (hdr.flags & macho.MH_ALLOW_STACK_EXECUTION != 0) try writer.writeAll(" ALLOW_STACK_EXECUTION");
|
|
856
|
-
if (hdr.flags & macho.MH_ROOT_SAFE != 0) try writer.writeAll(" ROOT_SAFE");
|
|
857
|
-
if (hdr.flags & macho.MH_SETUID_SAFE != 0) try writer.writeAll(" SETUID_SAFE");
|
|
858
|
-
if (hdr.flags & macho.MH_NO_REEXPORTED_DYLIBS != 0) try writer.writeAll(" NO_REEXPORTED_DYLIBS");
|
|
859
|
-
if (hdr.flags & macho.MH_PIE != 0) try writer.writeAll(" PIE");
|
|
860
|
-
if (hdr.flags & macho.MH_DEAD_STRIPPABLE_DYLIB != 0) try writer.writeAll(" DEAD_STRIPPABLE_DYLIB");
|
|
861
|
-
if (hdr.flags & macho.MH_HAS_TLV_DESCRIPTORS != 0) try writer.writeAll(" HAS_TLV_DESCRIPTORS");
|
|
862
|
-
if (hdr.flags & macho.MH_NO_HEAP_EXECUTION != 0) try writer.writeAll(" NO_HEAP_EXECUTION");
|
|
863
|
-
if (hdr.flags & macho.MH_APP_EXTENSION_SAFE != 0) try writer.writeAll(" APP_EXTENSION_SAFE");
|
|
864
|
-
if (hdr.flags & macho.MH_NLIST_OUTOFSYNC_WITH_DYLDINFO != 0) try writer.writeAll(" NLIST_OUTOFSYNC_WITH_DYLDINFO");
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
try writer.writeByte('\n');
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
fn dumpLoadCommand(lc: macho.LoadCommandIterator.LoadCommand, index: usize, writer: anytype) !void {
|
|
871
|
-
// print header first
|
|
872
|
-
try writer.print(
|
|
873
|
-
\\LC {d}
|
|
874
|
-
\\cmd {s}
|
|
875
|
-
\\cmdsize {d}
|
|
876
|
-
, .{ index, @tagName(lc.hdr.cmd), lc.hdr.cmdsize });
|
|
877
|
-
|
|
878
|
-
switch (lc.hdr.cmd) {
|
|
879
|
-
.SEGMENT_64 => {
|
|
880
|
-
const seg = lc.cast(macho.segment_command_64).?;
|
|
881
|
-
try writer.writeByte('\n');
|
|
882
|
-
try writer.print(
|
|
883
|
-
\\segname {s}
|
|
884
|
-
\\vmaddr {x}
|
|
885
|
-
\\vmsize {x}
|
|
886
|
-
\\fileoff {x}
|
|
887
|
-
\\filesz {x}
|
|
888
|
-
, .{
|
|
889
|
-
seg.segName(),
|
|
890
|
-
seg.vmaddr,
|
|
891
|
-
seg.vmsize,
|
|
892
|
-
seg.fileoff,
|
|
893
|
-
seg.filesize,
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
for (lc.getSections()) |sect| {
|
|
897
|
-
try writer.writeByte('\n');
|
|
898
|
-
try writer.print(
|
|
899
|
-
\\sectname {s}
|
|
900
|
-
\\addr {x}
|
|
901
|
-
\\size {x}
|
|
902
|
-
\\offset {x}
|
|
903
|
-
\\align {x}
|
|
904
|
-
, .{
|
|
905
|
-
sect.sectName(),
|
|
906
|
-
sect.addr,
|
|
907
|
-
sect.size,
|
|
908
|
-
sect.offset,
|
|
909
|
-
sect.@"align",
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
},
|
|
913
|
-
|
|
914
|
-
.ID_DYLIB,
|
|
915
|
-
.LOAD_DYLIB,
|
|
916
|
-
.LOAD_WEAK_DYLIB,
|
|
917
|
-
.REEXPORT_DYLIB,
|
|
918
|
-
=> {
|
|
919
|
-
const dylib = lc.cast(macho.dylib_command).?;
|
|
920
|
-
try writer.writeByte('\n');
|
|
921
|
-
try writer.print(
|
|
922
|
-
\\name {s}
|
|
923
|
-
\\timestamp {d}
|
|
924
|
-
\\current version {x}
|
|
925
|
-
\\compatibility version {x}
|
|
926
|
-
, .{
|
|
927
|
-
lc.getDylibPathName(),
|
|
928
|
-
dylib.dylib.timestamp,
|
|
929
|
-
dylib.dylib.current_version,
|
|
930
|
-
dylib.dylib.compatibility_version,
|
|
931
|
-
});
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
.MAIN => {
|
|
935
|
-
const main = lc.cast(macho.entry_point_command).?;
|
|
936
|
-
try writer.writeByte('\n');
|
|
937
|
-
try writer.print(
|
|
938
|
-
\\entryoff {x}
|
|
939
|
-
\\stacksize {x}
|
|
940
|
-
, .{ main.entryoff, main.stacksize });
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
.RPATH => {
|
|
944
|
-
try writer.writeByte('\n');
|
|
945
|
-
try writer.print(
|
|
946
|
-
\\path {s}
|
|
947
|
-
, .{
|
|
948
|
-
lc.getRpathPathName(),
|
|
949
|
-
});
|
|
950
|
-
},
|
|
951
|
-
|
|
952
|
-
.UUID => {
|
|
953
|
-
const uuid = lc.cast(macho.uuid_command).?;
|
|
954
|
-
try writer.writeByte('\n');
|
|
955
|
-
try writer.print("uuid {x}", .{&uuid.uuid});
|
|
956
|
-
},
|
|
957
|
-
|
|
958
|
-
.DATA_IN_CODE,
|
|
959
|
-
.FUNCTION_STARTS,
|
|
960
|
-
.CODE_SIGNATURE,
|
|
961
|
-
=> {
|
|
962
|
-
const llc = lc.cast(macho.linkedit_data_command).?;
|
|
963
|
-
try writer.writeByte('\n');
|
|
964
|
-
try writer.print(
|
|
965
|
-
\\dataoff {x}
|
|
966
|
-
\\datasize {x}
|
|
967
|
-
, .{ llc.dataoff, llc.datasize });
|
|
968
|
-
},
|
|
969
|
-
|
|
970
|
-
.DYLD_INFO_ONLY => {
|
|
971
|
-
const dlc = lc.cast(macho.dyld_info_command).?;
|
|
972
|
-
try writer.writeByte('\n');
|
|
973
|
-
try writer.print(
|
|
974
|
-
\\rebaseoff {x}
|
|
975
|
-
\\rebasesize {x}
|
|
976
|
-
\\bindoff {x}
|
|
977
|
-
\\bindsize {x}
|
|
978
|
-
\\weakbindoff {x}
|
|
979
|
-
\\weakbindsize {x}
|
|
980
|
-
\\lazybindoff {x}
|
|
981
|
-
\\lazybindsize {x}
|
|
982
|
-
\\exportoff {x}
|
|
983
|
-
\\exportsize {x}
|
|
984
|
-
, .{
|
|
985
|
-
dlc.rebase_off,
|
|
986
|
-
dlc.rebase_size,
|
|
987
|
-
dlc.bind_off,
|
|
988
|
-
dlc.bind_size,
|
|
989
|
-
dlc.weak_bind_off,
|
|
990
|
-
dlc.weak_bind_size,
|
|
991
|
-
dlc.lazy_bind_off,
|
|
992
|
-
dlc.lazy_bind_size,
|
|
993
|
-
dlc.export_off,
|
|
994
|
-
dlc.export_size,
|
|
995
|
-
});
|
|
996
|
-
},
|
|
997
|
-
|
|
998
|
-
.SYMTAB => {
|
|
999
|
-
const slc = lc.cast(macho.symtab_command).?;
|
|
1000
|
-
try writer.writeByte('\n');
|
|
1001
|
-
try writer.print(
|
|
1002
|
-
\\symoff {x}
|
|
1003
|
-
\\nsyms {x}
|
|
1004
|
-
\\stroff {x}
|
|
1005
|
-
\\strsize {x}
|
|
1006
|
-
, .{
|
|
1007
|
-
slc.symoff,
|
|
1008
|
-
slc.nsyms,
|
|
1009
|
-
slc.stroff,
|
|
1010
|
-
slc.strsize,
|
|
1011
|
-
});
|
|
1012
|
-
},
|
|
1013
|
-
|
|
1014
|
-
.DYSYMTAB => {
|
|
1015
|
-
const dlc = lc.cast(macho.dysymtab_command).?;
|
|
1016
|
-
try writer.writeByte('\n');
|
|
1017
|
-
try writer.print(
|
|
1018
|
-
\\ilocalsym {x}
|
|
1019
|
-
\\nlocalsym {x}
|
|
1020
|
-
\\iextdefsym {x}
|
|
1021
|
-
\\nextdefsym {x}
|
|
1022
|
-
\\iundefsym {x}
|
|
1023
|
-
\\nundefsym {x}
|
|
1024
|
-
\\indirectsymoff {x}
|
|
1025
|
-
\\nindirectsyms {x}
|
|
1026
|
-
, .{
|
|
1027
|
-
dlc.ilocalsym,
|
|
1028
|
-
dlc.nlocalsym,
|
|
1029
|
-
dlc.iextdefsym,
|
|
1030
|
-
dlc.nextdefsym,
|
|
1031
|
-
dlc.iundefsym,
|
|
1032
|
-
dlc.nundefsym,
|
|
1033
|
-
dlc.indirectsymoff,
|
|
1034
|
-
dlc.nindirectsyms,
|
|
1035
|
-
});
|
|
1036
|
-
},
|
|
1037
|
-
|
|
1038
|
-
.BUILD_VERSION => {
|
|
1039
|
-
const blc = lc.cast(macho.build_version_command).?;
|
|
1040
|
-
try writer.writeByte('\n');
|
|
1041
|
-
try writer.print(
|
|
1042
|
-
\\platform {s}
|
|
1043
|
-
\\minos {d}.{d}.{d}
|
|
1044
|
-
\\sdk {d}.{d}.{d}
|
|
1045
|
-
\\ntools {d}
|
|
1046
|
-
, .{
|
|
1047
|
-
@tagName(blc.platform),
|
|
1048
|
-
blc.minos >> 16,
|
|
1049
|
-
@as(u8, @truncate(blc.minos >> 8)),
|
|
1050
|
-
@as(u8, @truncate(blc.minos)),
|
|
1051
|
-
blc.sdk >> 16,
|
|
1052
|
-
@as(u8, @truncate(blc.sdk >> 8)),
|
|
1053
|
-
@as(u8, @truncate(blc.sdk)),
|
|
1054
|
-
blc.ntools,
|
|
1055
|
-
});
|
|
1056
|
-
for (lc.getBuildVersionTools()) |tool| {
|
|
1057
|
-
try writer.writeByte('\n');
|
|
1058
|
-
switch (tool.tool) {
|
|
1059
|
-
.CLANG, .SWIFT, .LD, .LLD, .ZIG => try writer.print("tool {s}\n", .{@tagName(tool.tool)}),
|
|
1060
|
-
else => |x| try writer.print("tool {d}\n", .{@intFromEnum(x)}),
|
|
1061
|
-
}
|
|
1062
|
-
try writer.print(
|
|
1063
|
-
\\version {d}.{d}.{d}
|
|
1064
|
-
, .{
|
|
1065
|
-
tool.version >> 16,
|
|
1066
|
-
@as(u8, @truncate(tool.version >> 8)),
|
|
1067
|
-
@as(u8, @truncate(tool.version)),
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
|
|
1072
|
-
.VERSION_MIN_MACOSX,
|
|
1073
|
-
.VERSION_MIN_IPHONEOS,
|
|
1074
|
-
.VERSION_MIN_WATCHOS,
|
|
1075
|
-
.VERSION_MIN_TVOS,
|
|
1076
|
-
=> {
|
|
1077
|
-
const vlc = lc.cast(macho.version_min_command).?;
|
|
1078
|
-
try writer.writeByte('\n');
|
|
1079
|
-
try writer.print(
|
|
1080
|
-
\\version {d}.{d}.{d}
|
|
1081
|
-
\\sdk {d}.{d}.{d}
|
|
1082
|
-
, .{
|
|
1083
|
-
vlc.version >> 16,
|
|
1084
|
-
@as(u8, @truncate(vlc.version >> 8)),
|
|
1085
|
-
@as(u8, @truncate(vlc.version)),
|
|
1086
|
-
vlc.sdk >> 16,
|
|
1087
|
-
@as(u8, @truncate(vlc.sdk >> 8)),
|
|
1088
|
-
@as(u8, @truncate(vlc.sdk)),
|
|
1089
|
-
});
|
|
1090
|
-
},
|
|
1091
|
-
|
|
1092
|
-
else => {},
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
fn dumpSymtab(ctx: ObjectContext, writer: anytype) !void {
|
|
1097
|
-
try writer.writeAll(symtab_label ++ "\n");
|
|
1098
|
-
|
|
1099
|
-
for (ctx.symtab.items) |sym| {
|
|
1100
|
-
const sym_name = ctx.getString(sym.n_strx);
|
|
1101
|
-
if (sym.n_type.bits.is_stab != 0) {
|
|
1102
|
-
const tt = switch (sym.n_type.stab) {
|
|
1103
|
-
_ => "UNKNOWN STAB",
|
|
1104
|
-
else => @tagName(sym.n_type.stab),
|
|
1105
|
-
};
|
|
1106
|
-
try writer.print("{x}", .{sym.n_value});
|
|
1107
|
-
if (sym.n_sect > 0) {
|
|
1108
|
-
const sect = ctx.sections.items[sym.n_sect - 1];
|
|
1109
|
-
try writer.print(" ({s},{s})", .{ sect.segName(), sect.sectName() });
|
|
1110
|
-
}
|
|
1111
|
-
try writer.print(" {s} (stab) {s}\n", .{ tt, sym_name });
|
|
1112
|
-
} else if (sym.n_type.bits.type == .sect) {
|
|
1113
|
-
const sect = ctx.sections.items[sym.n_sect - 1];
|
|
1114
|
-
try writer.print("{x} ({s},{s})", .{
|
|
1115
|
-
sym.n_value,
|
|
1116
|
-
sect.segName(),
|
|
1117
|
-
sect.sectName(),
|
|
1118
|
-
});
|
|
1119
|
-
if (sym.n_desc.referenced_dynamically) try writer.writeAll(" [referenced dynamically]");
|
|
1120
|
-
if (sym.n_desc.weak_def_or_ref_to_weak) try writer.writeAll(" weak");
|
|
1121
|
-
if (sym.n_desc.weak_ref) try writer.writeAll(" weakref");
|
|
1122
|
-
if (sym.n_type.bits.ext) {
|
|
1123
|
-
if (sym.n_type.bits.pext) try writer.writeAll(" private");
|
|
1124
|
-
try writer.writeAll(" external");
|
|
1125
|
-
} else if (sym.n_type.bits.pext) try writer.writeAll(" (was private external)");
|
|
1126
|
-
try writer.print(" {s}\n", .{sym_name});
|
|
1127
|
-
} else if (sym.tentative()) {
|
|
1128
|
-
const alignment = (@as(u16, @bitCast(sym.n_desc)) >> 8) & 0x0F;
|
|
1129
|
-
try writer.print(" 0x{x:0>16} (common) (alignment 2^{d})", .{ sym.n_value, alignment });
|
|
1130
|
-
if (sym.n_type.bits.ext) try writer.writeAll(" external");
|
|
1131
|
-
try writer.print(" {s}\n", .{sym_name});
|
|
1132
|
-
} else if (sym.n_type.bits.type == .undf) {
|
|
1133
|
-
const ordinal = @divFloor(@as(i16, @bitCast(sym.n_desc)), macho.N_SYMBOL_RESOLVER);
|
|
1134
|
-
const import_name = blk: {
|
|
1135
|
-
if (ordinal <= 0) {
|
|
1136
|
-
if (ordinal == macho.BIND_SPECIAL_DYLIB_SELF)
|
|
1137
|
-
break :blk "self import";
|
|
1138
|
-
if (ordinal == macho.BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE)
|
|
1139
|
-
break :blk "main executable";
|
|
1140
|
-
if (ordinal == macho.BIND_SPECIAL_DYLIB_FLAT_LOOKUP)
|
|
1141
|
-
break :blk "flat lookup";
|
|
1142
|
-
unreachable;
|
|
1143
|
-
}
|
|
1144
|
-
const full_path = ctx.imports.items[@as(u16, @bitCast(ordinal)) - 1];
|
|
1145
|
-
const basename = fs.path.basename(full_path);
|
|
1146
|
-
assert(basename.len > 0);
|
|
1147
|
-
const ext = mem.lastIndexOfScalar(u8, basename, '.') orelse basename.len;
|
|
1148
|
-
break :blk basename[0..ext];
|
|
1149
|
-
};
|
|
1150
|
-
try writer.writeAll("(undefined)");
|
|
1151
|
-
if (sym.n_desc.weak_ref) try writer.writeAll(" weakref");
|
|
1152
|
-
if (sym.n_type.bits.ext) try writer.writeAll(" external");
|
|
1153
|
-
try writer.print(" {s} (from {s})\n", .{
|
|
1154
|
-
sym_name,
|
|
1155
|
-
import_name,
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
fn dumpIndirectSymtab(ctx: ObjectContext, writer: anytype) !void {
|
|
1162
|
-
try writer.writeAll(indirect_symtab_label ++ "\n");
|
|
1163
|
-
|
|
1164
|
-
var sects_buffer: [3]macho.section_64 = undefined;
|
|
1165
|
-
const sects = blk: {
|
|
1166
|
-
var count: usize = 0;
|
|
1167
|
-
if (ctx.getSectionByName("__TEXT", "__stubs")) |sect| {
|
|
1168
|
-
sects_buffer[count] = sect;
|
|
1169
|
-
count += 1;
|
|
1170
|
-
}
|
|
1171
|
-
if (ctx.getSectionByName("__DATA_CONST", "__got")) |sect| {
|
|
1172
|
-
sects_buffer[count] = sect;
|
|
1173
|
-
count += 1;
|
|
1174
|
-
}
|
|
1175
|
-
if (ctx.getSectionByName("__DATA", "__la_symbol_ptr")) |sect| {
|
|
1176
|
-
sects_buffer[count] = sect;
|
|
1177
|
-
count += 1;
|
|
1178
|
-
}
|
|
1179
|
-
break :blk sects_buffer[0..count];
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
const sortFn = struct {
|
|
1183
|
-
fn sortFn(c: void, lhs: macho.section_64, rhs: macho.section_64) bool {
|
|
1184
|
-
_ = c;
|
|
1185
|
-
return lhs.reserved1 < rhs.reserved1;
|
|
1186
|
-
}
|
|
1187
|
-
}.sortFn;
|
|
1188
|
-
mem.sort(macho.section_64, sects, {}, sortFn);
|
|
1189
|
-
|
|
1190
|
-
var i: usize = 0;
|
|
1191
|
-
while (i < sects.len) : (i += 1) {
|
|
1192
|
-
const sect = sects[i];
|
|
1193
|
-
const start = sect.reserved1;
|
|
1194
|
-
const end = if (i + 1 >= sects.len) ctx.indsymtab.items.len else sects[i + 1].reserved1;
|
|
1195
|
-
const entry_size = blk: {
|
|
1196
|
-
if (mem.eql(u8, sect.sectName(), "__stubs")) break :blk sect.reserved2;
|
|
1197
|
-
break :blk @sizeOf(u64);
|
|
1198
|
-
};
|
|
1199
|
-
|
|
1200
|
-
try writer.print("{s},{s}\n", .{ sect.segName(), sect.sectName() });
|
|
1201
|
-
try writer.print("nentries {d}\n", .{end - start});
|
|
1202
|
-
for (ctx.indsymtab.items[start..end], 0..) |index, j| {
|
|
1203
|
-
const sym = ctx.symtab.items[index];
|
|
1204
|
-
const addr = sect.addr + entry_size * j;
|
|
1205
|
-
try writer.print("0x{x} {d} {s}\n", .{ addr, index, ctx.getString(sym.n_strx) });
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
fn dumpRebaseInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void {
|
|
1211
|
-
var rebases = std.array_list.Managed(u64).init(ctx.gpa);
|
|
1212
|
-
defer rebases.deinit();
|
|
1213
|
-
try ctx.parseRebaseInfo(data, &rebases);
|
|
1214
|
-
mem.sort(u64, rebases.items, {}, std.sort.asc(u64));
|
|
1215
|
-
for (rebases.items) |addr| {
|
|
1216
|
-
try writer.print("0x{x}\n", .{addr});
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
fn parseRebaseInfo(ctx: ObjectContext, data: []const u8, rebases: *std.array_list.Managed(u64)) !void {
|
|
1221
|
-
var reader: std.Io.Reader = .fixed(data);
|
|
1222
|
-
|
|
1223
|
-
var seg_id: ?u8 = null;
|
|
1224
|
-
var offset: u64 = 0;
|
|
1225
|
-
while (true) {
|
|
1226
|
-
const byte = reader.takeByte() catch break;
|
|
1227
|
-
const opc = byte & macho.REBASE_OPCODE_MASK;
|
|
1228
|
-
const imm = byte & macho.REBASE_IMMEDIATE_MASK;
|
|
1229
|
-
switch (opc) {
|
|
1230
|
-
macho.REBASE_OPCODE_DONE => break,
|
|
1231
|
-
macho.REBASE_OPCODE_SET_TYPE_IMM => {},
|
|
1232
|
-
macho.REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB => {
|
|
1233
|
-
seg_id = imm;
|
|
1234
|
-
offset = try reader.takeLeb128(u64);
|
|
1235
|
-
},
|
|
1236
|
-
macho.REBASE_OPCODE_ADD_ADDR_IMM_SCALED => {
|
|
1237
|
-
offset += imm * @sizeOf(u64);
|
|
1238
|
-
},
|
|
1239
|
-
macho.REBASE_OPCODE_ADD_ADDR_ULEB => {
|
|
1240
|
-
const addend = try reader.takeLeb128(u64);
|
|
1241
|
-
offset += addend;
|
|
1242
|
-
},
|
|
1243
|
-
macho.REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB => {
|
|
1244
|
-
const addend = try reader.takeLeb128(u64);
|
|
1245
|
-
const seg = ctx.segments.items[seg_id.?];
|
|
1246
|
-
const addr = seg.vmaddr + offset;
|
|
1247
|
-
try rebases.append(addr);
|
|
1248
|
-
offset += addend + @sizeOf(u64);
|
|
1249
|
-
},
|
|
1250
|
-
macho.REBASE_OPCODE_DO_REBASE_IMM_TIMES,
|
|
1251
|
-
macho.REBASE_OPCODE_DO_REBASE_ULEB_TIMES,
|
|
1252
|
-
macho.REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB,
|
|
1253
|
-
=> {
|
|
1254
|
-
var ntimes: u64 = 1;
|
|
1255
|
-
var skip: u64 = 0;
|
|
1256
|
-
switch (opc) {
|
|
1257
|
-
macho.REBASE_OPCODE_DO_REBASE_IMM_TIMES => {
|
|
1258
|
-
ntimes = imm;
|
|
1259
|
-
},
|
|
1260
|
-
macho.REBASE_OPCODE_DO_REBASE_ULEB_TIMES => {
|
|
1261
|
-
ntimes = try reader.takeLeb128(u64);
|
|
1262
|
-
},
|
|
1263
|
-
macho.REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB => {
|
|
1264
|
-
ntimes = try reader.takeLeb128(u64);
|
|
1265
|
-
skip = try reader.takeLeb128(u64);
|
|
1266
|
-
},
|
|
1267
|
-
else => unreachable,
|
|
1268
|
-
}
|
|
1269
|
-
const seg = ctx.segments.items[seg_id.?];
|
|
1270
|
-
const base_addr = seg.vmaddr;
|
|
1271
|
-
var count: usize = 0;
|
|
1272
|
-
while (count < ntimes) : (count += 1) {
|
|
1273
|
-
const addr = base_addr + offset;
|
|
1274
|
-
try rebases.append(addr);
|
|
1275
|
-
offset += skip + @sizeOf(u64);
|
|
1276
|
-
}
|
|
1277
|
-
},
|
|
1278
|
-
else => break,
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
const Binding = struct {
|
|
1284
|
-
address: u64,
|
|
1285
|
-
addend: i64,
|
|
1286
|
-
ordinal: u16,
|
|
1287
|
-
tag: Tag,
|
|
1288
|
-
name: []const u8,
|
|
1289
|
-
|
|
1290
|
-
fn deinit(binding: *Binding, gpa: Allocator) void {
|
|
1291
|
-
gpa.free(binding.name);
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
fn lessThan(ctx: void, lhs: Binding, rhs: Binding) bool {
|
|
1295
|
-
_ = ctx;
|
|
1296
|
-
return lhs.address < rhs.address;
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
const Tag = enum {
|
|
1300
|
-
ord,
|
|
1301
|
-
self,
|
|
1302
|
-
exe,
|
|
1303
|
-
flat,
|
|
1304
|
-
};
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
fn dumpBindInfo(ctx: ObjectContext, data: []const u8, writer: anytype) !void {
|
|
1308
|
-
var bindings = std.array_list.Managed(Binding).init(ctx.gpa);
|
|
1309
|
-
defer {
|
|
1310
|
-
for (bindings.items) |*b| {
|
|
1311
|
-
b.deinit(ctx.gpa);
|
|
1312
|
-
}
|
|
1313
|
-
bindings.deinit();
|
|
1314
|
-
}
|
|
1315
|
-
var data_reader: std.Io.Reader = .fixed(data);
|
|
1316
|
-
try ctx.parseBindInfo(&data_reader, &bindings);
|
|
1317
|
-
mem.sort(Binding, bindings.items, {}, Binding.lessThan);
|
|
1318
|
-
for (bindings.items) |binding| {
|
|
1319
|
-
try writer.print("0x{x} [addend: {d}]", .{ binding.address, binding.addend });
|
|
1320
|
-
try writer.writeAll(" (");
|
|
1321
|
-
switch (binding.tag) {
|
|
1322
|
-
.self => try writer.writeAll("self"),
|
|
1323
|
-
.exe => try writer.writeAll("main executable"),
|
|
1324
|
-
.flat => try writer.writeAll("flat lookup"),
|
|
1325
|
-
.ord => try writer.writeAll(std.fs.path.basename(ctx.imports.items[binding.ordinal - 1])),
|
|
1326
|
-
}
|
|
1327
|
-
try writer.print(") {s}\n", .{binding.name});
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
fn parseBindInfo(ctx: ObjectContext, reader: *std.Io.Reader, bindings: *std.array_list.Managed(Binding)) !void {
|
|
1332
|
-
var seg_id: ?u8 = null;
|
|
1333
|
-
var tag: Binding.Tag = .self;
|
|
1334
|
-
var ordinal: u16 = 0;
|
|
1335
|
-
var offset: u64 = 0;
|
|
1336
|
-
var addend: i64 = 0;
|
|
1337
|
-
|
|
1338
|
-
var name_buf = std.array_list.Managed(u8).init(ctx.gpa);
|
|
1339
|
-
defer name_buf.deinit();
|
|
1340
|
-
|
|
1341
|
-
while (true) {
|
|
1342
|
-
const byte = reader.takeByte() catch break;
|
|
1343
|
-
const opc = byte & macho.BIND_OPCODE_MASK;
|
|
1344
|
-
const imm = byte & macho.BIND_IMMEDIATE_MASK;
|
|
1345
|
-
switch (opc) {
|
|
1346
|
-
macho.BIND_OPCODE_DONE,
|
|
1347
|
-
macho.BIND_OPCODE_SET_TYPE_IMM,
|
|
1348
|
-
=> {},
|
|
1349
|
-
macho.BIND_OPCODE_SET_DYLIB_ORDINAL_IMM => {
|
|
1350
|
-
tag = .ord;
|
|
1351
|
-
ordinal = imm;
|
|
1352
|
-
},
|
|
1353
|
-
macho.BIND_OPCODE_SET_DYLIB_SPECIAL_IMM => {
|
|
1354
|
-
switch (imm) {
|
|
1355
|
-
0 => tag = .self,
|
|
1356
|
-
0xf => tag = .exe,
|
|
1357
|
-
0xe => tag = .flat,
|
|
1358
|
-
else => unreachable,
|
|
1359
|
-
}
|
|
1360
|
-
},
|
|
1361
|
-
macho.BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB => {
|
|
1362
|
-
seg_id = imm;
|
|
1363
|
-
offset = try reader.takeLeb128(u64);
|
|
1364
|
-
},
|
|
1365
|
-
macho.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM => {
|
|
1366
|
-
name_buf.clearRetainingCapacity();
|
|
1367
|
-
try name_buf.appendSlice(try reader.takeDelimiterInclusive(0));
|
|
1368
|
-
},
|
|
1369
|
-
macho.BIND_OPCODE_SET_ADDEND_SLEB => {
|
|
1370
|
-
addend = try reader.takeLeb128(i64);
|
|
1371
|
-
},
|
|
1372
|
-
macho.BIND_OPCODE_ADD_ADDR_ULEB => {
|
|
1373
|
-
const x = try reader.takeLeb128(u64);
|
|
1374
|
-
offset = @intCast(@as(i64, @intCast(offset)) + @as(i64, @bitCast(x)));
|
|
1375
|
-
},
|
|
1376
|
-
macho.BIND_OPCODE_DO_BIND,
|
|
1377
|
-
macho.BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB,
|
|
1378
|
-
macho.BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED,
|
|
1379
|
-
macho.BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB,
|
|
1380
|
-
=> {
|
|
1381
|
-
var add_addr: u64 = 0;
|
|
1382
|
-
var count: u64 = 1;
|
|
1383
|
-
var skip: u64 = 0;
|
|
1384
|
-
|
|
1385
|
-
switch (opc) {
|
|
1386
|
-
macho.BIND_OPCODE_DO_BIND => {},
|
|
1387
|
-
macho.BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB => {
|
|
1388
|
-
add_addr = try reader.takeLeb128(u64);
|
|
1389
|
-
},
|
|
1390
|
-
macho.BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED => {
|
|
1391
|
-
add_addr = imm * @sizeOf(u64);
|
|
1392
|
-
},
|
|
1393
|
-
macho.BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB => {
|
|
1394
|
-
count = try reader.takeLeb128(u64);
|
|
1395
|
-
skip = try reader.takeLeb128(u64);
|
|
1396
|
-
},
|
|
1397
|
-
else => unreachable,
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
const seg = ctx.segments.items[seg_id.?];
|
|
1401
|
-
var i: u64 = 0;
|
|
1402
|
-
while (i < count) : (i += 1) {
|
|
1403
|
-
const addr: u64 = @intCast(@as(i64, @intCast(seg.vmaddr + offset)));
|
|
1404
|
-
try bindings.append(.{
|
|
1405
|
-
.address = addr,
|
|
1406
|
-
.addend = addend,
|
|
1407
|
-
.tag = tag,
|
|
1408
|
-
.ordinal = ordinal,
|
|
1409
|
-
.name = try ctx.gpa.dupe(u8, name_buf.items),
|
|
1410
|
-
});
|
|
1411
|
-
offset += skip + @sizeOf(u64) + add_addr;
|
|
1412
|
-
}
|
|
1413
|
-
},
|
|
1414
|
-
else => break,
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
fn dumpExportsTrie(ctx: ObjectContext, data: []const u8, writer: anytype) !void {
|
|
1420
|
-
const seg = ctx.getSegmentByName("__TEXT") orelse return;
|
|
1421
|
-
|
|
1422
|
-
var arena = std.heap.ArenaAllocator.init(ctx.gpa);
|
|
1423
|
-
defer arena.deinit();
|
|
1424
|
-
|
|
1425
|
-
var exports = std.array_list.Managed(Export).init(arena.allocator());
|
|
1426
|
-
var it: TrieIterator = .{ .stream = .fixed(data) };
|
|
1427
|
-
try parseTrieNode(arena.allocator(), &it, "", &exports);
|
|
1428
|
-
|
|
1429
|
-
mem.sort(Export, exports.items, {}, Export.lessThan);
|
|
1430
|
-
|
|
1431
|
-
for (exports.items) |exp| {
|
|
1432
|
-
switch (exp.tag) {
|
|
1433
|
-
.@"export" => {
|
|
1434
|
-
const info = exp.data.@"export";
|
|
1435
|
-
if (info.kind != .regular or info.weak) {
|
|
1436
|
-
try writer.writeByte('[');
|
|
1437
|
-
}
|
|
1438
|
-
switch (info.kind) {
|
|
1439
|
-
.regular => {},
|
|
1440
|
-
.absolute => try writer.writeAll("ABS, "),
|
|
1441
|
-
.tlv => try writer.writeAll("THREAD_LOCAL, "),
|
|
1442
|
-
}
|
|
1443
|
-
if (info.weak) try writer.writeAll("WEAK");
|
|
1444
|
-
if (info.kind != .regular or info.weak) {
|
|
1445
|
-
try writer.writeAll("] ");
|
|
1446
|
-
}
|
|
1447
|
-
try writer.print("{x} ", .{seg.vmaddr + info.vmoffset});
|
|
1448
|
-
},
|
|
1449
|
-
else => {},
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
try writer.print("{s}\n", .{exp.name});
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
const TrieIterator = struct {
|
|
1457
|
-
stream: std.Io.Reader,
|
|
1458
|
-
|
|
1459
|
-
fn takeLeb128(it: *TrieIterator) !u64 {
|
|
1460
|
-
return it.stream.takeLeb128(u64);
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
fn readString(it: *TrieIterator) ![:0]const u8 {
|
|
1464
|
-
return it.stream.takeSentinel(0);
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
fn takeByte(it: *TrieIterator) !u8 {
|
|
1468
|
-
return it.stream.takeByte();
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
|
-
|
|
1472
|
-
const Export = struct {
|
|
1473
|
-
name: []const u8,
|
|
1474
|
-
tag: enum { @"export", reexport, stub_resolver },
|
|
1475
|
-
data: union {
|
|
1476
|
-
@"export": struct {
|
|
1477
|
-
kind: enum { regular, absolute, tlv },
|
|
1478
|
-
weak: bool = false,
|
|
1479
|
-
vmoffset: u64,
|
|
1480
|
-
},
|
|
1481
|
-
reexport: u64,
|
|
1482
|
-
stub_resolver: struct {
|
|
1483
|
-
stub_offset: u64,
|
|
1484
|
-
resolver_offset: u64,
|
|
1485
|
-
},
|
|
1486
|
-
},
|
|
1487
|
-
|
|
1488
|
-
inline fn rankByTag(@"export": Export) u3 {
|
|
1489
|
-
return switch (@"export".tag) {
|
|
1490
|
-
.@"export" => 1,
|
|
1491
|
-
.reexport => 2,
|
|
1492
|
-
.stub_resolver => 3,
|
|
1493
|
-
};
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
fn lessThan(ctx: void, lhs: Export, rhs: Export) bool {
|
|
1497
|
-
_ = ctx;
|
|
1498
|
-
if (lhs.rankByTag() == rhs.rankByTag()) {
|
|
1499
|
-
return switch (lhs.tag) {
|
|
1500
|
-
.@"export" => lhs.data.@"export".vmoffset < rhs.data.@"export".vmoffset,
|
|
1501
|
-
.reexport => lhs.data.reexport < rhs.data.reexport,
|
|
1502
|
-
.stub_resolver => lhs.data.stub_resolver.stub_offset < rhs.data.stub_resolver.stub_offset,
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
return lhs.rankByTag() < rhs.rankByTag();
|
|
1506
|
-
}
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
|
-
fn parseTrieNode(
|
|
1510
|
-
arena: Allocator,
|
|
1511
|
-
it: *TrieIterator,
|
|
1512
|
-
prefix: []const u8,
|
|
1513
|
-
exports: *std.array_list.Managed(Export),
|
|
1514
|
-
) !void {
|
|
1515
|
-
const size = try it.takeLeb128();
|
|
1516
|
-
if (size > 0) {
|
|
1517
|
-
const flags = try it.takeLeb128();
|
|
1518
|
-
switch (flags) {
|
|
1519
|
-
macho.EXPORT_SYMBOL_FLAGS_REEXPORT => {
|
|
1520
|
-
const ord = try it.takeLeb128();
|
|
1521
|
-
const name = try arena.dupe(u8, try it.readString());
|
|
1522
|
-
try exports.append(.{
|
|
1523
|
-
.name = if (name.len > 0) name else prefix,
|
|
1524
|
-
.tag = .reexport,
|
|
1525
|
-
.data = .{ .reexport = ord },
|
|
1526
|
-
});
|
|
1527
|
-
},
|
|
1528
|
-
macho.EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER => {
|
|
1529
|
-
const stub_offset = try it.takeLeb128();
|
|
1530
|
-
const resolver_offset = try it.takeLeb128();
|
|
1531
|
-
try exports.append(.{
|
|
1532
|
-
.name = prefix,
|
|
1533
|
-
.tag = .stub_resolver,
|
|
1534
|
-
.data = .{ .stub_resolver = .{
|
|
1535
|
-
.stub_offset = stub_offset,
|
|
1536
|
-
.resolver_offset = resolver_offset,
|
|
1537
|
-
} },
|
|
1538
|
-
});
|
|
1539
|
-
},
|
|
1540
|
-
else => {
|
|
1541
|
-
const vmoff = try it.takeLeb128();
|
|
1542
|
-
try exports.append(.{
|
|
1543
|
-
.name = prefix,
|
|
1544
|
-
.tag = .@"export",
|
|
1545
|
-
.data = .{ .@"export" = .{
|
|
1546
|
-
.kind = switch (flags & macho.EXPORT_SYMBOL_FLAGS_KIND_MASK) {
|
|
1547
|
-
macho.EXPORT_SYMBOL_FLAGS_KIND_REGULAR => .regular,
|
|
1548
|
-
macho.EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE => .absolute,
|
|
1549
|
-
macho.EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL => .tlv,
|
|
1550
|
-
else => unreachable,
|
|
1551
|
-
},
|
|
1552
|
-
.weak = flags & macho.EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION != 0,
|
|
1553
|
-
.vmoffset = vmoff,
|
|
1554
|
-
} },
|
|
1555
|
-
});
|
|
1556
|
-
},
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
const nedges = try it.takeByte();
|
|
1561
|
-
for (0..nedges) |_| {
|
|
1562
|
-
const label = try it.readString();
|
|
1563
|
-
const off = try it.takeLeb128();
|
|
1564
|
-
const prefix_label = try std.fmt.allocPrint(arena, "{s}{s}", .{ prefix, label });
|
|
1565
|
-
const curr = it.stream.seek;
|
|
1566
|
-
it.stream.seek = off;
|
|
1567
|
-
try parseTrieNode(arena, it, prefix_label, exports);
|
|
1568
|
-
it.stream.seek = curr;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
fn dumpSection(ctx: ObjectContext, sect: macho.section_64, writer: anytype) !void {
|
|
1573
|
-
const data = ctx.data[sect.offset..][0..sect.size];
|
|
1574
|
-
try writer.print("{s}", .{data});
|
|
1575
|
-
}
|
|
1576
|
-
};
|
|
1577
|
-
|
|
1578
|
-
fn parseAndDumpObject(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
1579
|
-
const gpa = step.owner.allocator;
|
|
1580
|
-
const hdr = @as(*align(1) const macho.mach_header_64, @ptrCast(bytes.ptr)).*;
|
|
1581
|
-
if (hdr.magic != macho.MH_MAGIC_64) {
|
|
1582
|
-
return error.InvalidMagicNumber;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
var ctx = ObjectContext{ .gpa = gpa, .data = bytes, .header = hdr };
|
|
1586
|
-
try ctx.parse();
|
|
1587
|
-
|
|
1588
|
-
var output: std.Io.Writer.Allocating = .init(gpa);
|
|
1589
|
-
defer output.deinit();
|
|
1590
|
-
const writer = &output.writer;
|
|
1591
|
-
|
|
1592
|
-
switch (check.kind) {
|
|
1593
|
-
.headers => {
|
|
1594
|
-
try ObjectContext.dumpHeader(ctx.header, writer);
|
|
1595
|
-
|
|
1596
|
-
var it = try ctx.getLoadCommandIterator();
|
|
1597
|
-
var i: usize = 0;
|
|
1598
|
-
while (try it.next()) |cmd| {
|
|
1599
|
-
try ObjectContext.dumpLoadCommand(cmd, i, writer);
|
|
1600
|
-
try writer.writeByte('\n');
|
|
1601
|
-
|
|
1602
|
-
i += 1;
|
|
1603
|
-
}
|
|
1604
|
-
},
|
|
1605
|
-
|
|
1606
|
-
.symtab => if (ctx.symtab.items.len > 0) {
|
|
1607
|
-
try ctx.dumpSymtab(writer);
|
|
1608
|
-
} else return step.fail("no symbol table found", .{}),
|
|
1609
|
-
|
|
1610
|
-
.indirect_symtab => if (ctx.symtab.items.len > 0 and ctx.indsymtab.items.len > 0) {
|
|
1611
|
-
try ctx.dumpIndirectSymtab(writer);
|
|
1612
|
-
} else return step.fail("no indirect symbol table found", .{}),
|
|
1613
|
-
|
|
1614
|
-
.dyld_rebase,
|
|
1615
|
-
.dyld_bind,
|
|
1616
|
-
.dyld_weak_bind,
|
|
1617
|
-
.dyld_lazy_bind,
|
|
1618
|
-
=> {
|
|
1619
|
-
const cmd = try ctx.getLoadCommand(.DYLD_INFO_ONLY) orelse
|
|
1620
|
-
return step.fail("no dyld info found", .{});
|
|
1621
|
-
const lc = cmd.cast(macho.dyld_info_command).?;
|
|
1622
|
-
|
|
1623
|
-
switch (check.kind) {
|
|
1624
|
-
.dyld_rebase => if (lc.rebase_size > 0) {
|
|
1625
|
-
const data = ctx.data[lc.rebase_off..][0..lc.rebase_size];
|
|
1626
|
-
try writer.writeAll(dyld_rebase_label ++ "\n");
|
|
1627
|
-
try ctx.dumpRebaseInfo(data, writer);
|
|
1628
|
-
} else return step.fail("no rebase data found", .{}),
|
|
1629
|
-
|
|
1630
|
-
.dyld_bind => if (lc.bind_size > 0) {
|
|
1631
|
-
const data = ctx.data[lc.bind_off..][0..lc.bind_size];
|
|
1632
|
-
try writer.writeAll(dyld_bind_label ++ "\n");
|
|
1633
|
-
try ctx.dumpBindInfo(data, writer);
|
|
1634
|
-
} else return step.fail("no bind data found", .{}),
|
|
1635
|
-
|
|
1636
|
-
.dyld_weak_bind => if (lc.weak_bind_size > 0) {
|
|
1637
|
-
const data = ctx.data[lc.weak_bind_off..][0..lc.weak_bind_size];
|
|
1638
|
-
try writer.writeAll(dyld_weak_bind_label ++ "\n");
|
|
1639
|
-
try ctx.dumpBindInfo(data, writer);
|
|
1640
|
-
} else return step.fail("no weak bind data found", .{}),
|
|
1641
|
-
|
|
1642
|
-
.dyld_lazy_bind => if (lc.lazy_bind_size > 0) {
|
|
1643
|
-
const data = ctx.data[lc.lazy_bind_off..][0..lc.lazy_bind_size];
|
|
1644
|
-
try writer.writeAll(dyld_lazy_bind_label ++ "\n");
|
|
1645
|
-
try ctx.dumpBindInfo(data, writer);
|
|
1646
|
-
} else return step.fail("no lazy bind data found", .{}),
|
|
1647
|
-
|
|
1648
|
-
else => unreachable,
|
|
1649
|
-
}
|
|
1650
|
-
},
|
|
1651
|
-
|
|
1652
|
-
.exports => blk: {
|
|
1653
|
-
if (try ctx.getLoadCommand(.DYLD_INFO_ONLY)) |cmd| {
|
|
1654
|
-
const lc = cmd.cast(macho.dyld_info_command).?;
|
|
1655
|
-
if (lc.export_size > 0) {
|
|
1656
|
-
const data = ctx.data[lc.export_off..][0..lc.export_size];
|
|
1657
|
-
try writer.writeAll(exports_label ++ "\n");
|
|
1658
|
-
try ctx.dumpExportsTrie(data, writer);
|
|
1659
|
-
break :blk;
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
return step.fail("no exports data found", .{});
|
|
1663
|
-
},
|
|
1664
|
-
|
|
1665
|
-
.dump_section => {
|
|
1666
|
-
const name = mem.sliceTo(@as([*:0]const u8, @ptrCast(check.data.items.ptr + check.payload.dump_section)), 0);
|
|
1667
|
-
const sep_index = mem.findScalar(u8, name, ',') orelse
|
|
1668
|
-
return step.fail("invalid section name: {s}", .{name});
|
|
1669
|
-
const segname = name[0..sep_index];
|
|
1670
|
-
const sectname = name[sep_index + 1 ..];
|
|
1671
|
-
const sect = ctx.getSectionByName(segname, sectname) orelse
|
|
1672
|
-
return step.fail("section '{s}' not found", .{name});
|
|
1673
|
-
try ctx.dumpSection(sect, writer);
|
|
1674
|
-
},
|
|
1675
|
-
|
|
1676
|
-
else => return step.fail("invalid check kind for MachO file format: {s}", .{@tagName(check.kind)}),
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
return output.toOwnedSlice();
|
|
1680
|
-
}
|
|
1681
|
-
};
|
|
1682
|
-
|
|
1683
|
-
const ElfDumper = struct {
|
|
1684
|
-
const symtab_label = "symbol table";
|
|
1685
|
-
const dynamic_symtab_label = "dynamic symbol table";
|
|
1686
|
-
const dynamic_section_label = "dynamic section";
|
|
1687
|
-
const archive_symtab_label = "archive symbol table";
|
|
1688
|
-
|
|
1689
|
-
fn parseAndDump(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
1690
|
-
return parseAndDumpArchive(step, check, bytes) catch |err| switch (err) {
|
|
1691
|
-
error.InvalidArchiveMagicNumber => try parseAndDumpObject(step, check, bytes),
|
|
1692
|
-
else => |e| return e,
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
fn parseAndDumpArchive(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
1697
|
-
const gpa = step.owner.allocator;
|
|
1698
|
-
var reader: std.Io.Reader = .fixed(bytes);
|
|
1699
|
-
|
|
1700
|
-
const magic = try reader.takeArray(elf.ARMAG.len);
|
|
1701
|
-
if (!mem.eql(u8, magic, elf.ARMAG)) {
|
|
1702
|
-
return error.InvalidArchiveMagicNumber;
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
if (!mem.isAligned(bytes.len, 2)) {
|
|
1706
|
-
return error.InvalidArchivePadding;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
var ctx = ArchiveContext{
|
|
1710
|
-
.gpa = gpa,
|
|
1711
|
-
.data = bytes,
|
|
1712
|
-
.strtab = &[0]u8{},
|
|
1713
|
-
};
|
|
1714
|
-
defer {
|
|
1715
|
-
for (ctx.objects.items) |*object| {
|
|
1716
|
-
gpa.free(object.name);
|
|
1717
|
-
}
|
|
1718
|
-
ctx.objects.deinit(gpa);
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
while (true) {
|
|
1722
|
-
if (!mem.isAligned(reader.seek, 2)) reader.seek += 1;
|
|
1723
|
-
if (reader.seek >= ctx.data.len) break;
|
|
1724
|
-
|
|
1725
|
-
const hdr = try reader.takeStruct(elf.ar_hdr, .little);
|
|
1726
|
-
|
|
1727
|
-
if (!mem.eql(u8, &hdr.ar_fmag, elf.ARFMAG)) return error.InvalidArchiveHeaderMagicNumber;
|
|
1728
|
-
|
|
1729
|
-
const size = try hdr.size();
|
|
1730
|
-
defer reader.seek += size;
|
|
1731
|
-
|
|
1732
|
-
if (hdr.isSymtab()) {
|
|
1733
|
-
try ctx.parseSymtab(ctx.data[reader.seek..][0..size], .p32);
|
|
1734
|
-
continue;
|
|
1735
|
-
}
|
|
1736
|
-
if (hdr.isSymtab64()) {
|
|
1737
|
-
try ctx.parseSymtab(ctx.data[reader.seek..][0..size], .p64);
|
|
1738
|
-
continue;
|
|
1739
|
-
}
|
|
1740
|
-
if (hdr.isStrtab()) {
|
|
1741
|
-
ctx.strtab = ctx.data[reader.seek..][0..size];
|
|
1742
|
-
continue;
|
|
1743
|
-
}
|
|
1744
|
-
if (hdr.isSymdef() or hdr.isSymdefSorted()) continue;
|
|
1745
|
-
|
|
1746
|
-
const name = if (hdr.name()) |name|
|
|
1747
|
-
try gpa.dupe(u8, name)
|
|
1748
|
-
else if (try hdr.nameOffset()) |off|
|
|
1749
|
-
try gpa.dupe(u8, ctx.getString(off))
|
|
1750
|
-
else
|
|
1751
|
-
unreachable;
|
|
1752
|
-
|
|
1753
|
-
try ctx.objects.append(gpa, .{ .name = name, .off = reader.seek, .len = size });
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
var output: std.Io.Writer.Allocating = .init(gpa);
|
|
1757
|
-
defer output.deinit();
|
|
1758
|
-
const writer = &output.writer;
|
|
1759
|
-
|
|
1760
|
-
switch (check.kind) {
|
|
1761
|
-
.archive_symtab => if (ctx.symtab.items.len > 0) {
|
|
1762
|
-
try ctx.dumpSymtab(writer);
|
|
1763
|
-
} else return step.fail("no archive symbol table found", .{}),
|
|
1764
|
-
|
|
1765
|
-
else => if (ctx.objects.items.len > 0) {
|
|
1766
|
-
try ctx.dumpObjects(step, check, writer);
|
|
1767
|
-
} else return step.fail("empty archive", .{}),
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
return output.toOwnedSlice();
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
const ArchiveContext = struct {
|
|
1774
|
-
gpa: Allocator,
|
|
1775
|
-
data: []const u8,
|
|
1776
|
-
symtab: std.ArrayList(ArSymtabEntry) = .empty,
|
|
1777
|
-
strtab: []const u8,
|
|
1778
|
-
objects: std.ArrayList(struct { name: []const u8, off: usize, len: usize }) = .empty,
|
|
1779
|
-
|
|
1780
|
-
fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void {
|
|
1781
|
-
var reader: std.Io.Reader = .fixed(raw);
|
|
1782
|
-
const num = switch (ptr_width) {
|
|
1783
|
-
.p32 => try reader.takeInt(u32, .big),
|
|
1784
|
-
.p64 => try reader.takeInt(u64, .big),
|
|
1785
|
-
};
|
|
1786
|
-
const ptr_size: usize = switch (ptr_width) {
|
|
1787
|
-
.p32 => @sizeOf(u32),
|
|
1788
|
-
.p64 => @sizeOf(u64),
|
|
1789
|
-
};
|
|
1790
|
-
const strtab_off = (num + 1) * ptr_size;
|
|
1791
|
-
const strtab_len = raw.len - strtab_off;
|
|
1792
|
-
const strtab = raw[strtab_off..][0..strtab_len];
|
|
1793
|
-
|
|
1794
|
-
try ctx.symtab.ensureTotalCapacityPrecise(ctx.gpa, num);
|
|
1795
|
-
|
|
1796
|
-
var stroff: usize = 0;
|
|
1797
|
-
for (0..num) |_| {
|
|
1798
|
-
const off = switch (ptr_width) {
|
|
1799
|
-
.p32 => try reader.takeInt(u32, .big),
|
|
1800
|
-
.p64 => try reader.takeInt(u64, .big),
|
|
1801
|
-
};
|
|
1802
|
-
const name = mem.sliceTo(@as([*:0]const u8, @ptrCast(strtab.ptr + stroff)), 0);
|
|
1803
|
-
stroff += name.len + 1;
|
|
1804
|
-
ctx.symtab.appendAssumeCapacity(.{ .off = off, .name = name });
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
fn dumpSymtab(ctx: ArchiveContext, writer: anytype) !void {
|
|
1809
|
-
var files = std.AutoHashMap(usize, []const u8).init(ctx.gpa);
|
|
1810
|
-
defer files.deinit();
|
|
1811
|
-
try files.ensureUnusedCapacity(@intCast(ctx.objects.items.len));
|
|
1812
|
-
|
|
1813
|
-
for (ctx.objects.items) |object| {
|
|
1814
|
-
files.putAssumeCapacityNoClobber(object.off - @sizeOf(elf.ar_hdr), object.name);
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
var symbols: std.array_hash_map.Auto(usize, std.array_list.Managed([]const u8)) = .empty;
|
|
1818
|
-
defer {
|
|
1819
|
-
for (symbols.values()) |*value| {
|
|
1820
|
-
value.deinit();
|
|
1821
|
-
}
|
|
1822
|
-
symbols.deinit(ctx.gpa);
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
for (ctx.symtab.items) |entry| {
|
|
1826
|
-
const gop = try symbols.getOrPut(ctx.gpa, @intCast(entry.off));
|
|
1827
|
-
if (!gop.found_existing) {
|
|
1828
|
-
gop.value_ptr.* = std.array_list.Managed([]const u8).init(ctx.gpa);
|
|
1829
|
-
}
|
|
1830
|
-
try gop.value_ptr.append(entry.name);
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
try writer.print("{s}\n", .{archive_symtab_label});
|
|
1834
|
-
for (symbols.keys(), symbols.values()) |off, values| {
|
|
1835
|
-
try writer.print("in object {s}\n", .{files.get(off).?});
|
|
1836
|
-
for (values.items) |value| {
|
|
1837
|
-
try writer.print("{s}\n", .{value});
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
fn dumpObjects(ctx: ArchiveContext, step: *Step, check: Check, writer: anytype) !void {
|
|
1843
|
-
for (ctx.objects.items) |object| {
|
|
1844
|
-
try writer.print("object {s}\n", .{object.name});
|
|
1845
|
-
const output = try parseAndDumpObject(step, check, ctx.data[object.off..][0..object.len]);
|
|
1846
|
-
defer ctx.gpa.free(output);
|
|
1847
|
-
try writer.print("{s}\n", .{output});
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
fn getString(ctx: ArchiveContext, off: u32) []const u8 {
|
|
1852
|
-
assert(off < ctx.strtab.len);
|
|
1853
|
-
const name = mem.sliceTo(@as([*:'\n']const u8, @ptrCast(ctx.strtab.ptr + off)), 0);
|
|
1854
|
-
return name[0 .. name.len - 1];
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
const ArSymtabEntry = struct {
|
|
1858
|
-
name: [:0]const u8,
|
|
1859
|
-
off: u64,
|
|
1860
|
-
};
|
|
1861
|
-
};
|
|
1862
|
-
|
|
1863
|
-
fn parseAndDumpObject(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
1864
|
-
const gpa = step.owner.allocator;
|
|
1865
|
-
|
|
1866
|
-
// `std.elf.Header` takes care of endianness issues for us.
|
|
1867
|
-
var reader: std.Io.Reader = .fixed(bytes);
|
|
1868
|
-
const hdr = try elf.Header.read(&reader);
|
|
1869
|
-
|
|
1870
|
-
var shdrs = try gpa.alloc(elf.Elf64_Shdr, hdr.shnum);
|
|
1871
|
-
defer gpa.free(shdrs);
|
|
1872
|
-
{
|
|
1873
|
-
var shdr_it = hdr.iterateSectionHeadersBuffer(bytes);
|
|
1874
|
-
var shdr_i: usize = 0;
|
|
1875
|
-
while (try shdr_it.next()) |shdr| : (shdr_i += 1) shdrs[shdr_i] = shdr;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
var phdrs = try gpa.alloc(elf.Elf64_Phdr, hdr.shnum);
|
|
1879
|
-
defer gpa.free(phdrs);
|
|
1880
|
-
{
|
|
1881
|
-
var phdr_it = hdr.iterateProgramHeadersBuffer(bytes);
|
|
1882
|
-
var phdr_i: usize = 0;
|
|
1883
|
-
while (try phdr_it.next()) |phdr| : (phdr_i += 1) phdrs[phdr_i] = phdr;
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
var ctx = ObjectContext{
|
|
1887
|
-
.gpa = gpa,
|
|
1888
|
-
.data = bytes,
|
|
1889
|
-
.hdr = hdr,
|
|
1890
|
-
.shdrs = shdrs,
|
|
1891
|
-
.phdrs = phdrs,
|
|
1892
|
-
.shstrtab = undefined,
|
|
1893
|
-
};
|
|
1894
|
-
ctx.shstrtab = ctx.getSectionContents(ctx.hdr.shstrndx);
|
|
1895
|
-
|
|
1896
|
-
defer gpa.free(ctx.symtab.symbols);
|
|
1897
|
-
defer gpa.free(ctx.dysymtab.symbols);
|
|
1898
|
-
defer gpa.free(ctx.dyns);
|
|
1899
|
-
|
|
1900
|
-
for (ctx.shdrs, 0..) |shdr, i| switch (shdr.sh_type) {
|
|
1901
|
-
elf.SHT_SYMTAB, elf.SHT_DYNSYM => {
|
|
1902
|
-
const raw = ctx.getSectionContents(i);
|
|
1903
|
-
const nsyms = @divExact(raw.len, @sizeOf(elf.Elf64_Sym));
|
|
1904
|
-
const symbols = try gpa.alloc(elf.Elf64_Sym, nsyms);
|
|
1905
|
-
|
|
1906
|
-
var r: std.Io.Reader = .fixed(raw);
|
|
1907
|
-
for (0..nsyms) |si| symbols[si] = r.takeStruct(elf.Elf64_Sym, ctx.hdr.endian) catch unreachable;
|
|
1908
|
-
|
|
1909
|
-
const strings = ctx.getSectionContents(shdr.sh_link);
|
|
1910
|
-
|
|
1911
|
-
switch (shdr.sh_type) {
|
|
1912
|
-
elf.SHT_SYMTAB => {
|
|
1913
|
-
ctx.symtab = .{
|
|
1914
|
-
.symbols = symbols,
|
|
1915
|
-
.strings = strings,
|
|
1916
|
-
};
|
|
1917
|
-
},
|
|
1918
|
-
elf.SHT_DYNSYM => {
|
|
1919
|
-
ctx.dysymtab = .{
|
|
1920
|
-
.symbols = symbols,
|
|
1921
|
-
.strings = strings,
|
|
1922
|
-
};
|
|
1923
|
-
},
|
|
1924
|
-
else => unreachable,
|
|
1925
|
-
}
|
|
1926
|
-
},
|
|
1927
|
-
elf.SHT_DYNAMIC => {
|
|
1928
|
-
const raw = ctx.getSectionContents(i);
|
|
1929
|
-
const ndyns = @divExact(raw.len, @sizeOf(elf.Elf64_Dyn));
|
|
1930
|
-
const dyns = try gpa.alloc(elf.Elf64_Dyn, ndyns);
|
|
1931
|
-
|
|
1932
|
-
var r: std.Io.Reader = .fixed(raw);
|
|
1933
|
-
for (0..ndyns) |si| dyns[si] = r.takeStruct(elf.Elf64_Dyn, ctx.hdr.endian) catch unreachable;
|
|
1934
|
-
|
|
1935
|
-
ctx.dyns = dyns;
|
|
1936
|
-
ctx.dyns_strings = ctx.getSectionContents(shdr.sh_link);
|
|
1937
|
-
},
|
|
1938
|
-
|
|
1939
|
-
else => {},
|
|
1940
|
-
};
|
|
1941
|
-
|
|
1942
|
-
var output: std.Io.Writer.Allocating = .init(gpa);
|
|
1943
|
-
defer output.deinit();
|
|
1944
|
-
const writer = &output.writer;
|
|
1945
|
-
|
|
1946
|
-
switch (check.kind) {
|
|
1947
|
-
.headers => {
|
|
1948
|
-
try ctx.dumpHeader(writer);
|
|
1949
|
-
try ctx.dumpShdrs(writer);
|
|
1950
|
-
try ctx.dumpPhdrs(writer);
|
|
1951
|
-
},
|
|
1952
|
-
|
|
1953
|
-
.symtab => if (ctx.symtab.symbols.len > 0) {
|
|
1954
|
-
try ctx.dumpSymtab(.symtab, writer);
|
|
1955
|
-
} else return step.fail("no symbol table found", .{}),
|
|
1956
|
-
|
|
1957
|
-
.dynamic_symtab => if (ctx.dysymtab.symbols.len > 0) {
|
|
1958
|
-
try ctx.dumpSymtab(.dysymtab, writer);
|
|
1959
|
-
} else return step.fail("no dynamic symbol table found", .{}),
|
|
1960
|
-
|
|
1961
|
-
.dynamic_section => if (ctx.dyns.len > 0) {
|
|
1962
|
-
try ctx.dumpDynamicSection(writer);
|
|
1963
|
-
} else return step.fail("no dynamic section found", .{}),
|
|
1964
|
-
|
|
1965
|
-
.dump_section => {
|
|
1966
|
-
const name = mem.sliceTo(@as([*:0]const u8, @ptrCast(check.data.items.ptr + check.payload.dump_section)), 0);
|
|
1967
|
-
const shndx = ctx.getSectionByName(name) orelse return step.fail("no '{s}' section found", .{name});
|
|
1968
|
-
try ctx.dumpSection(shndx, writer);
|
|
1969
|
-
},
|
|
1970
|
-
|
|
1971
|
-
else => return step.fail("invalid check kind for ELF file format: {s}", .{@tagName(check.kind)}),
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
|
-
return output.toOwnedSlice();
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
const ObjectContext = struct {
|
|
1978
|
-
gpa: Allocator,
|
|
1979
|
-
data: []const u8,
|
|
1980
|
-
hdr: elf.Header,
|
|
1981
|
-
shdrs: []const elf.Elf64_Shdr,
|
|
1982
|
-
phdrs: []const elf.Elf64_Phdr,
|
|
1983
|
-
shstrtab: []const u8,
|
|
1984
|
-
symtab: Symtab = .{},
|
|
1985
|
-
dysymtab: Symtab = .{},
|
|
1986
|
-
dyns: []const elf.Elf64_Dyn = &.{},
|
|
1987
|
-
dyns_strings: []const u8 = &.{},
|
|
1988
|
-
|
|
1989
|
-
fn dumpHeader(ctx: ObjectContext, writer: anytype) !void {
|
|
1990
|
-
try writer.writeAll("header\n");
|
|
1991
|
-
try writer.print("type {s}\n", .{@tagName(ctx.hdr.type)});
|
|
1992
|
-
try writer.print("entry {x}\n", .{ctx.hdr.entry});
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
fn dumpPhdrs(ctx: ObjectContext, writer: anytype) !void {
|
|
1996
|
-
if (ctx.phdrs.len == 0) return;
|
|
1997
|
-
|
|
1998
|
-
try writer.writeAll("program headers\n");
|
|
1999
|
-
|
|
2000
|
-
for (ctx.phdrs, 0..) |phdr, phndx| {
|
|
2001
|
-
try writer.print("phdr {d}\n", .{phndx});
|
|
2002
|
-
try writer.print("type {f}\n", .{fmtPhType(phdr.p_type)});
|
|
2003
|
-
try writer.print("vaddr {x}\n", .{phdr.p_vaddr});
|
|
2004
|
-
try writer.print("paddr {x}\n", .{phdr.p_paddr});
|
|
2005
|
-
try writer.print("offset {x}\n", .{phdr.p_offset});
|
|
2006
|
-
try writer.print("memsz {x}\n", .{phdr.p_memsz});
|
|
2007
|
-
try writer.print("filesz {x}\n", .{phdr.p_filesz});
|
|
2008
|
-
try writer.print("align {x}\n", .{phdr.p_align});
|
|
2009
|
-
|
|
2010
|
-
{
|
|
2011
|
-
const flags = phdr.p_flags;
|
|
2012
|
-
try writer.writeAll("flags");
|
|
2013
|
-
if (flags > 0) try writer.writeByte(' ');
|
|
2014
|
-
if (flags & elf.PF_R != 0) {
|
|
2015
|
-
try writer.writeByte('R');
|
|
2016
|
-
}
|
|
2017
|
-
if (flags & elf.PF_W != 0) {
|
|
2018
|
-
try writer.writeByte('W');
|
|
2019
|
-
}
|
|
2020
|
-
if (flags & elf.PF_X != 0) {
|
|
2021
|
-
try writer.writeByte('E');
|
|
2022
|
-
}
|
|
2023
|
-
if (flags & elf.PF_MASKOS != 0) {
|
|
2024
|
-
try writer.writeAll("OS");
|
|
2025
|
-
}
|
|
2026
|
-
if (flags & elf.PF_MASKPROC != 0) {
|
|
2027
|
-
try writer.writeAll("PROC");
|
|
2028
|
-
}
|
|
2029
|
-
try writer.writeByte('\n');
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
fn dumpShdrs(ctx: ObjectContext, writer: anytype) !void {
|
|
2035
|
-
if (ctx.shdrs.len == 0) return;
|
|
2036
|
-
|
|
2037
|
-
try writer.writeAll("section headers\n");
|
|
2038
|
-
|
|
2039
|
-
for (ctx.shdrs, 0..) |shdr, shndx| {
|
|
2040
|
-
try writer.print("shdr {d}\n", .{shndx});
|
|
2041
|
-
try writer.print("name {s}\n", .{ctx.getSectionName(shndx)});
|
|
2042
|
-
try writer.print("type {f}\n", .{fmtShType(shdr.sh_type)});
|
|
2043
|
-
try writer.print("addr {x}\n", .{shdr.sh_addr});
|
|
2044
|
-
try writer.print("offset {x}\n", .{shdr.sh_offset});
|
|
2045
|
-
try writer.print("size {x}\n", .{shdr.sh_size});
|
|
2046
|
-
try writer.print("addralign {x}\n", .{shdr.sh_addralign});
|
|
2047
|
-
// TODO dump formatted sh_flags
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
fn dumpDynamicSection(ctx: ObjectContext, writer: anytype) !void {
|
|
2052
|
-
try writer.writeAll(ElfDumper.dynamic_section_label ++ "\n");
|
|
2053
|
-
|
|
2054
|
-
for (ctx.dyns) |entry| {
|
|
2055
|
-
const key = @as(u64, @bitCast(entry.d_tag));
|
|
2056
|
-
const value = entry.d_val;
|
|
2057
|
-
|
|
2058
|
-
const key_str = switch (key) {
|
|
2059
|
-
elf.DT_NEEDED => "NEEDED",
|
|
2060
|
-
elf.DT_SONAME => "SONAME",
|
|
2061
|
-
elf.DT_INIT_ARRAY => "INIT_ARRAY",
|
|
2062
|
-
elf.DT_INIT_ARRAYSZ => "INIT_ARRAYSZ",
|
|
2063
|
-
elf.DT_FINI_ARRAY => "FINI_ARRAY",
|
|
2064
|
-
elf.DT_FINI_ARRAYSZ => "FINI_ARRAYSZ",
|
|
2065
|
-
elf.DT_HASH => "HASH",
|
|
2066
|
-
elf.DT_GNU_HASH => "GNU_HASH",
|
|
2067
|
-
elf.DT_STRTAB => "STRTAB",
|
|
2068
|
-
elf.DT_SYMTAB => "SYMTAB",
|
|
2069
|
-
elf.DT_STRSZ => "STRSZ",
|
|
2070
|
-
elf.DT_SYMENT => "SYMENT",
|
|
2071
|
-
elf.DT_PLTGOT => "PLTGOT",
|
|
2072
|
-
elf.DT_PLTRELSZ => "PLTRELSZ",
|
|
2073
|
-
elf.DT_PLTREL => "PLTREL",
|
|
2074
|
-
elf.DT_JMPREL => "JMPREL",
|
|
2075
|
-
elf.DT_RELA => "RELA",
|
|
2076
|
-
elf.DT_RELASZ => "RELASZ",
|
|
2077
|
-
elf.DT_RELAENT => "RELAENT",
|
|
2078
|
-
elf.DT_VERDEF => "VERDEF",
|
|
2079
|
-
elf.DT_VERDEFNUM => "VERDEFNUM",
|
|
2080
|
-
elf.DT_FLAGS => "FLAGS",
|
|
2081
|
-
elf.DT_FLAGS_1 => "FLAGS_1",
|
|
2082
|
-
elf.DT_VERNEED => "VERNEED",
|
|
2083
|
-
elf.DT_VERNEEDNUM => "VERNEEDNUM",
|
|
2084
|
-
elf.DT_VERSYM => "VERSYM",
|
|
2085
|
-
elf.DT_RELACOUNT => "RELACOUNT",
|
|
2086
|
-
elf.DT_RPATH => "RPATH",
|
|
2087
|
-
elf.DT_RUNPATH => "RUNPATH",
|
|
2088
|
-
elf.DT_INIT => "INIT",
|
|
2089
|
-
elf.DT_FINI => "FINI",
|
|
2090
|
-
elf.DT_NULL => "NULL",
|
|
2091
|
-
else => "UNKNOWN",
|
|
2092
|
-
};
|
|
2093
|
-
try writer.print("{s}", .{key_str});
|
|
2094
|
-
|
|
2095
|
-
switch (key) {
|
|
2096
|
-
elf.DT_NEEDED,
|
|
2097
|
-
elf.DT_SONAME,
|
|
2098
|
-
elf.DT_RPATH,
|
|
2099
|
-
elf.DT_RUNPATH,
|
|
2100
|
-
=> {
|
|
2101
|
-
const name = getString(ctx.dyns_strings, @intCast(value));
|
|
2102
|
-
try writer.print(" {s}", .{name});
|
|
2103
|
-
},
|
|
2104
|
-
|
|
2105
|
-
elf.DT_INIT_ARRAY,
|
|
2106
|
-
elf.DT_FINI_ARRAY,
|
|
2107
|
-
elf.DT_HASH,
|
|
2108
|
-
elf.DT_GNU_HASH,
|
|
2109
|
-
elf.DT_STRTAB,
|
|
2110
|
-
elf.DT_SYMTAB,
|
|
2111
|
-
elf.DT_PLTGOT,
|
|
2112
|
-
elf.DT_JMPREL,
|
|
2113
|
-
elf.DT_RELA,
|
|
2114
|
-
elf.DT_VERDEF,
|
|
2115
|
-
elf.DT_VERNEED,
|
|
2116
|
-
elf.DT_VERSYM,
|
|
2117
|
-
elf.DT_INIT,
|
|
2118
|
-
elf.DT_FINI,
|
|
2119
|
-
elf.DT_NULL,
|
|
2120
|
-
=> try writer.print(" {x}", .{value}),
|
|
2121
|
-
|
|
2122
|
-
elf.DT_INIT_ARRAYSZ,
|
|
2123
|
-
elf.DT_FINI_ARRAYSZ,
|
|
2124
|
-
elf.DT_STRSZ,
|
|
2125
|
-
elf.DT_SYMENT,
|
|
2126
|
-
elf.DT_PLTRELSZ,
|
|
2127
|
-
elf.DT_RELASZ,
|
|
2128
|
-
elf.DT_RELAENT,
|
|
2129
|
-
elf.DT_RELACOUNT,
|
|
2130
|
-
=> try writer.print(" {d}", .{value}),
|
|
2131
|
-
|
|
2132
|
-
elf.DT_PLTREL => try writer.writeAll(switch (value) {
|
|
2133
|
-
elf.DT_REL => " REL",
|
|
2134
|
-
elf.DT_RELA => " RELA",
|
|
2135
|
-
else => " UNKNOWN",
|
|
2136
|
-
}),
|
|
2137
|
-
|
|
2138
|
-
elf.DT_FLAGS => if (value > 0) {
|
|
2139
|
-
if (value & elf.DF_ORIGIN != 0) try writer.writeAll(" ORIGIN");
|
|
2140
|
-
if (value & elf.DF_SYMBOLIC != 0) try writer.writeAll(" SYMBOLIC");
|
|
2141
|
-
if (value & elf.DF_TEXTREL != 0) try writer.writeAll(" TEXTREL");
|
|
2142
|
-
if (value & elf.DF_BIND_NOW != 0) try writer.writeAll(" BIND_NOW");
|
|
2143
|
-
if (value & elf.DF_STATIC_TLS != 0) try writer.writeAll(" STATIC_TLS");
|
|
2144
|
-
},
|
|
2145
|
-
|
|
2146
|
-
elf.DT_FLAGS_1 => if (value > 0) {
|
|
2147
|
-
if (value & elf.DF_1_NOW != 0) try writer.writeAll(" NOW");
|
|
2148
|
-
if (value & elf.DF_1_GLOBAL != 0) try writer.writeAll(" GLOBAL");
|
|
2149
|
-
if (value & elf.DF_1_GROUP != 0) try writer.writeAll(" GROUP");
|
|
2150
|
-
if (value & elf.DF_1_NODELETE != 0) try writer.writeAll(" NODELETE");
|
|
2151
|
-
if (value & elf.DF_1_LOADFLTR != 0) try writer.writeAll(" LOADFLTR");
|
|
2152
|
-
if (value & elf.DF_1_INITFIRST != 0) try writer.writeAll(" INITFIRST");
|
|
2153
|
-
if (value & elf.DF_1_NOOPEN != 0) try writer.writeAll(" NOOPEN");
|
|
2154
|
-
if (value & elf.DF_1_ORIGIN != 0) try writer.writeAll(" ORIGIN");
|
|
2155
|
-
if (value & elf.DF_1_DIRECT != 0) try writer.writeAll(" DIRECT");
|
|
2156
|
-
if (value & elf.DF_1_TRANS != 0) try writer.writeAll(" TRANS");
|
|
2157
|
-
if (value & elf.DF_1_INTERPOSE != 0) try writer.writeAll(" INTERPOSE");
|
|
2158
|
-
if (value & elf.DF_1_NODEFLIB != 0) try writer.writeAll(" NODEFLIB");
|
|
2159
|
-
if (value & elf.DF_1_NODUMP != 0) try writer.writeAll(" NODUMP");
|
|
2160
|
-
if (value & elf.DF_1_CONFALT != 0) try writer.writeAll(" CONFALT");
|
|
2161
|
-
if (value & elf.DF_1_ENDFILTEE != 0) try writer.writeAll(" ENDFILTEE");
|
|
2162
|
-
if (value & elf.DF_1_DISPRELDNE != 0) try writer.writeAll(" DISPRELDNE");
|
|
2163
|
-
if (value & elf.DF_1_DISPRELPND != 0) try writer.writeAll(" DISPRELPND");
|
|
2164
|
-
if (value & elf.DF_1_NODIRECT != 0) try writer.writeAll(" NODIRECT");
|
|
2165
|
-
if (value & elf.DF_1_IGNMULDEF != 0) try writer.writeAll(" IGNMULDEF");
|
|
2166
|
-
if (value & elf.DF_1_NOKSYMS != 0) try writer.writeAll(" NOKSYMS");
|
|
2167
|
-
if (value & elf.DF_1_NOHDR != 0) try writer.writeAll(" NOHDR");
|
|
2168
|
-
if (value & elf.DF_1_EDITED != 0) try writer.writeAll(" EDITED");
|
|
2169
|
-
if (value & elf.DF_1_NORELOC != 0) try writer.writeAll(" NORELOC");
|
|
2170
|
-
if (value & elf.DF_1_SYMINTPOSE != 0) try writer.writeAll(" SYMINTPOSE");
|
|
2171
|
-
if (value & elf.DF_1_GLOBAUDIT != 0) try writer.writeAll(" GLOBAUDIT");
|
|
2172
|
-
if (value & elf.DF_1_SINGLETON != 0) try writer.writeAll(" SINGLETON");
|
|
2173
|
-
if (value & elf.DF_1_STUB != 0) try writer.writeAll(" STUB");
|
|
2174
|
-
if (value & elf.DF_1_PIE != 0) try writer.writeAll(" PIE");
|
|
2175
|
-
},
|
|
2176
|
-
|
|
2177
|
-
else => try writer.print(" {x}", .{value}),
|
|
2178
|
-
}
|
|
2179
|
-
try writer.writeByte('\n');
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
|
-
fn dumpSymtab(ctx: ObjectContext, comptime @"type": enum { symtab, dysymtab }, writer: anytype) !void {
|
|
2184
|
-
const symtab = switch (@"type") {
|
|
2185
|
-
.symtab => ctx.symtab,
|
|
2186
|
-
.dysymtab => ctx.dysymtab,
|
|
2187
|
-
};
|
|
2188
|
-
|
|
2189
|
-
try writer.writeAll(switch (@"type") {
|
|
2190
|
-
.symtab => symtab_label,
|
|
2191
|
-
.dysymtab => dynamic_symtab_label,
|
|
2192
|
-
} ++ "\n");
|
|
2193
|
-
|
|
2194
|
-
for (symtab.symbols, 0..) |sym, index| {
|
|
2195
|
-
try writer.print("{x} {x}", .{ sym.st_value, sym.st_size });
|
|
2196
|
-
|
|
2197
|
-
{
|
|
2198
|
-
if (elf.SHN_LORESERVE <= sym.st_shndx and sym.st_shndx < elf.SHN_HIRESERVE) {
|
|
2199
|
-
if (elf.SHN_LOPROC <= sym.st_shndx and sym.st_shndx < elf.SHN_HIPROC) {
|
|
2200
|
-
try writer.print(" LO+{d}", .{sym.st_shndx - elf.SHN_LOPROC});
|
|
2201
|
-
} else {
|
|
2202
|
-
const sym_ndx = switch (sym.st_shndx) {
|
|
2203
|
-
elf.SHN_ABS => "ABS",
|
|
2204
|
-
elf.SHN_COMMON => "COM",
|
|
2205
|
-
elf.SHN_LIVEPATCH => "LIV",
|
|
2206
|
-
else => "UNK",
|
|
2207
|
-
};
|
|
2208
|
-
try writer.print(" {s}", .{sym_ndx});
|
|
2209
|
-
}
|
|
2210
|
-
} else if (sym.st_shndx == elf.SHN_UNDEF) {
|
|
2211
|
-
try writer.writeAll(" UND");
|
|
2212
|
-
} else {
|
|
2213
|
-
try writer.print(" {x}", .{sym.st_shndx});
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
blk: {
|
|
2218
|
-
const tt = sym.st_type();
|
|
2219
|
-
const sym_type = switch (tt) {
|
|
2220
|
-
elf.STT_NOTYPE => "NOTYPE",
|
|
2221
|
-
elf.STT_OBJECT => "OBJECT",
|
|
2222
|
-
elf.STT_FUNC => "FUNC",
|
|
2223
|
-
elf.STT_SECTION => "SECTION",
|
|
2224
|
-
elf.STT_FILE => "FILE",
|
|
2225
|
-
elf.STT_COMMON => "COMMON",
|
|
2226
|
-
elf.STT_TLS => "TLS",
|
|
2227
|
-
elf.STT_NUM => "NUM",
|
|
2228
|
-
elf.STT_GNU_IFUNC => "IFUNC",
|
|
2229
|
-
else => if (elf.STT_LOPROC <= tt and tt < elf.STT_HIPROC) {
|
|
2230
|
-
break :blk try writer.print(" LOPROC+{d}", .{tt - elf.STT_LOPROC});
|
|
2231
|
-
} else if (elf.STT_LOOS <= tt and tt < elf.STT_HIOS) {
|
|
2232
|
-
break :blk try writer.print(" LOOS+{d}", .{tt - elf.STT_LOOS});
|
|
2233
|
-
} else "UNK",
|
|
2234
|
-
};
|
|
2235
|
-
try writer.print(" {s}", .{sym_type});
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
blk: {
|
|
2239
|
-
const bind = sym.st_bind();
|
|
2240
|
-
const sym_bind = switch (bind) {
|
|
2241
|
-
elf.STB_LOCAL => "LOCAL",
|
|
2242
|
-
elf.STB_GLOBAL => "GLOBAL",
|
|
2243
|
-
elf.STB_WEAK => "WEAK",
|
|
2244
|
-
elf.STB_NUM => "NUM",
|
|
2245
|
-
else => if (elf.STB_LOPROC <= bind and bind < elf.STB_HIPROC) {
|
|
2246
|
-
break :blk try writer.print(" LOPROC+{d}", .{bind - elf.STB_LOPROC});
|
|
2247
|
-
} else if (elf.STB_LOOS <= bind and bind < elf.STB_HIOS) {
|
|
2248
|
-
break :blk try writer.print(" LOOS+{d}", .{bind - elf.STB_LOOS});
|
|
2249
|
-
} else "UNKNOWN",
|
|
2250
|
-
};
|
|
2251
|
-
try writer.print(" {s}", .{sym_bind});
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
const sym_vis = @as(elf.STV, @enumFromInt(@as(u3, @truncate(sym.st_other))));
|
|
2255
|
-
try writer.print(" {s}", .{@tagName(sym_vis)});
|
|
2256
|
-
|
|
2257
|
-
const sym_name = switch (sym.st_type()) {
|
|
2258
|
-
elf.STT_SECTION => ctx.getSectionName(sym.st_shndx),
|
|
2259
|
-
else => symtab.getName(index).?,
|
|
2260
|
-
};
|
|
2261
|
-
try writer.print(" {s}\n", .{sym_name});
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
fn dumpSection(ctx: ObjectContext, shndx: usize, writer: anytype) !void {
|
|
2266
|
-
const data = ctx.getSectionContents(shndx);
|
|
2267
|
-
try writer.print("{s}", .{data});
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
inline fn getSectionName(ctx: ObjectContext, shndx: usize) []const u8 {
|
|
2271
|
-
const shdr = ctx.shdrs[shndx];
|
|
2272
|
-
return getString(ctx.shstrtab, shdr.sh_name);
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
fn getSectionContents(ctx: ObjectContext, shndx: usize) []const u8 {
|
|
2276
|
-
const shdr = ctx.shdrs[shndx];
|
|
2277
|
-
assert(shdr.sh_offset < ctx.data.len);
|
|
2278
|
-
assert(shdr.sh_offset + shdr.sh_size <= ctx.data.len);
|
|
2279
|
-
return ctx.data[shdr.sh_offset..][0..shdr.sh_size];
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
fn getSectionByName(ctx: ObjectContext, name: []const u8) ?usize {
|
|
2283
|
-
for (0..ctx.shdrs.len) |shndx| {
|
|
2284
|
-
if (mem.eql(u8, ctx.getSectionName(shndx), name)) return shndx;
|
|
2285
|
-
} else return null;
|
|
2286
|
-
}
|
|
2287
|
-
};
|
|
2288
|
-
|
|
2289
|
-
const Symtab = struct {
|
|
2290
|
-
symbols: []const elf.Elf64_Sym = &.{},
|
|
2291
|
-
strings: []const u8 = &.{},
|
|
2292
|
-
|
|
2293
|
-
fn get(st: Symtab, index: usize) ?elf.Elf64_Sym {
|
|
2294
|
-
if (index >= st.symbols.len) return null;
|
|
2295
|
-
return st.symbols[index];
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
fn getName(st: Symtab, index: usize) ?[]const u8 {
|
|
2299
|
-
const sym = st.get(index) orelse return null;
|
|
2300
|
-
return getString(st.strings, sym.st_name);
|
|
2301
|
-
}
|
|
2302
|
-
};
|
|
2303
|
-
|
|
2304
|
-
fn getString(strtab: []const u8, off: u32) []const u8 {
|
|
2305
|
-
assert(off < strtab.len);
|
|
2306
|
-
return mem.sliceTo(@as([*:0]const u8, @ptrCast(strtab.ptr + off)), 0);
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
fn fmtShType(sh_type: u32) std.fmt.Alt(u32, formatShType) {
|
|
2310
|
-
return .{ .data = sh_type };
|
|
2311
|
-
}
|
|
2312
|
-
|
|
2313
|
-
fn formatShType(sh_type: u32, writer: *Writer) Writer.Error!void {
|
|
2314
|
-
const name = switch (sh_type) {
|
|
2315
|
-
elf.SHT_NULL => "NULL",
|
|
2316
|
-
elf.SHT_PROGBITS => "PROGBITS",
|
|
2317
|
-
elf.SHT_SYMTAB => "SYMTAB",
|
|
2318
|
-
elf.SHT_STRTAB => "STRTAB",
|
|
2319
|
-
elf.SHT_RELA => "RELA",
|
|
2320
|
-
elf.SHT_HASH => "HASH",
|
|
2321
|
-
elf.SHT_DYNAMIC => "DYNAMIC",
|
|
2322
|
-
elf.SHT_NOTE => "NOTE",
|
|
2323
|
-
elf.SHT_NOBITS => "NOBITS",
|
|
2324
|
-
elf.SHT_REL => "REL",
|
|
2325
|
-
elf.SHT_SHLIB => "SHLIB",
|
|
2326
|
-
elf.SHT_DYNSYM => "DYNSYM",
|
|
2327
|
-
elf.SHT_INIT_ARRAY => "INIT_ARRAY",
|
|
2328
|
-
elf.SHT_FINI_ARRAY => "FINI_ARRAY",
|
|
2329
|
-
elf.SHT_PREINIT_ARRAY => "PREINIT_ARRAY",
|
|
2330
|
-
elf.SHT_GROUP => "GROUP",
|
|
2331
|
-
elf.SHT_SYMTAB_SHNDX => "SYMTAB_SHNDX",
|
|
2332
|
-
elf.SHT_X86_64_UNWIND => "X86_64_UNWIND",
|
|
2333
|
-
elf.SHT_LLVM_ADDRSIG => "LLVM_ADDRSIG",
|
|
2334
|
-
elf.SHT_GNU_HASH => "GNU_HASH",
|
|
2335
|
-
elf.SHT_GNU_VERDEF => "VERDEF",
|
|
2336
|
-
elf.SHT_GNU_VERNEED => "VERNEED",
|
|
2337
|
-
elf.SHT_GNU_VERSYM => "VERSYM",
|
|
2338
|
-
else => if (elf.SHT_LOOS <= sh_type and sh_type < elf.SHT_HIOS) {
|
|
2339
|
-
return try writer.print("LOOS+0x{x}", .{sh_type - elf.SHT_LOOS});
|
|
2340
|
-
} else if (elf.SHT_LOPROC <= sh_type and sh_type < elf.SHT_HIPROC) {
|
|
2341
|
-
return try writer.print("LOPROC+0x{x}", .{sh_type - elf.SHT_LOPROC});
|
|
2342
|
-
} else if (elf.SHT_LOUSER <= sh_type and sh_type < elf.SHT_HIUSER) {
|
|
2343
|
-
return try writer.print("LOUSER+0x{x}", .{sh_type - elf.SHT_LOUSER});
|
|
2344
|
-
} else "UNKNOWN",
|
|
2345
|
-
};
|
|
2346
|
-
try writer.writeAll(name);
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
fn fmtPhType(ph_type: u32) std.fmt.Alt(u32, formatPhType) {
|
|
2350
|
-
return .{ .data = ph_type };
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
fn formatPhType(ph_type: u32, writer: *Writer) Writer.Error!void {
|
|
2354
|
-
const p_type = switch (ph_type) {
|
|
2355
|
-
elf.PT_NULL => "NULL",
|
|
2356
|
-
elf.PT_LOAD => "LOAD",
|
|
2357
|
-
elf.PT_DYNAMIC => "DYNAMIC",
|
|
2358
|
-
elf.PT_INTERP => "INTERP",
|
|
2359
|
-
elf.PT_NOTE => "NOTE",
|
|
2360
|
-
elf.PT_SHLIB => "SHLIB",
|
|
2361
|
-
elf.PT_PHDR => "PHDR",
|
|
2362
|
-
elf.PT_TLS => "TLS",
|
|
2363
|
-
elf.PT_NUM => "NUM",
|
|
2364
|
-
elf.PT_GNU_EH_FRAME => "GNU_EH_FRAME",
|
|
2365
|
-
elf.PT_GNU_STACK => "GNU_STACK",
|
|
2366
|
-
elf.PT_GNU_RELRO => "GNU_RELRO",
|
|
2367
|
-
else => if (elf.PT_LOOS <= ph_type and ph_type < elf.PT_HIOS) {
|
|
2368
|
-
return try writer.print("LOOS+0x{x}", .{ph_type - elf.PT_LOOS});
|
|
2369
|
-
} else if (elf.PT_LOPROC <= ph_type and ph_type < elf.PT_HIPROC) {
|
|
2370
|
-
return try writer.print("LOPROC+0x{x}", .{ph_type - elf.PT_LOPROC});
|
|
2371
|
-
} else "UNKNOWN",
|
|
2372
|
-
};
|
|
2373
|
-
try writer.writeAll(p_type);
|
|
2374
|
-
}
|
|
2375
|
-
};
|
|
2376
|
-
|
|
2377
|
-
const WasmDumper = struct {
|
|
2378
|
-
const symtab_label = "symbols";
|
|
2379
|
-
|
|
2380
|
-
fn parseAndDump(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
|
|
2381
|
-
const gpa = step.owner.allocator;
|
|
2382
|
-
var reader: std.Io.Reader = .fixed(bytes);
|
|
2383
|
-
|
|
2384
|
-
const buf = try reader.takeArray(8);
|
|
2385
|
-
if (!mem.eql(u8, buf[0..4], &std.wasm.magic)) {
|
|
2386
|
-
return error.InvalidMagicByte;
|
|
2387
|
-
}
|
|
2388
|
-
if (!mem.eql(u8, buf[4..], &std.wasm.version)) {
|
|
2389
|
-
return error.UnsupportedWasmVersion;
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
var output: std.Io.Writer.Allocating = .init(gpa);
|
|
2393
|
-
defer output.deinit();
|
|
2394
|
-
parseAndDumpInner(step, check, bytes, &reader, &output.writer) catch |err| switch (err) {
|
|
2395
|
-
error.EndOfStream => try output.writer.writeAll("\n<UnexpectedEndOfStream>"),
|
|
2396
|
-
else => |e| return e,
|
|
2397
|
-
};
|
|
2398
|
-
return output.toOwnedSlice();
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
fn parseAndDumpInner(
|
|
2402
|
-
step: *Step,
|
|
2403
|
-
check: Check,
|
|
2404
|
-
bytes: []const u8,
|
|
2405
|
-
reader: *std.Io.Reader,
|
|
2406
|
-
writer: *std.Io.Writer,
|
|
2407
|
-
) !void {
|
|
2408
|
-
switch (check.kind) {
|
|
2409
|
-
.headers => {
|
|
2410
|
-
while (reader.takeByte()) |current_byte| {
|
|
2411
|
-
const section = std.enums.fromInt(std.wasm.Section, current_byte) orelse {
|
|
2412
|
-
return step.fail("Found invalid section id '{d}'", .{current_byte});
|
|
2413
|
-
};
|
|
2414
|
-
|
|
2415
|
-
const section_length = try reader.takeLeb128(u32);
|
|
2416
|
-
try parseAndDumpSection(step, section, bytes[reader.seek..][0..section_length], writer);
|
|
2417
|
-
reader.seek += section_length;
|
|
2418
|
-
} else |_| {} // reached end of stream
|
|
2419
|
-
},
|
|
2420
|
-
|
|
2421
|
-
else => return step.fail("invalid check kind for Wasm file format: {s}", .{@tagName(check.kind)}),
|
|
2422
|
-
}
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
fn parseAndDumpSection(
|
|
2426
|
-
step: *Step,
|
|
2427
|
-
section: std.wasm.Section,
|
|
2428
|
-
data: []const u8,
|
|
2429
|
-
writer: *std.Io.Writer,
|
|
2430
|
-
) !void {
|
|
2431
|
-
var reader: std.Io.Reader = .fixed(data);
|
|
2432
|
-
|
|
2433
|
-
try writer.print(
|
|
2434
|
-
\\Section {s}
|
|
2435
|
-
\\size {d}
|
|
2436
|
-
, .{ @tagName(section), data.len });
|
|
2437
|
-
|
|
2438
|
-
switch (section) {
|
|
2439
|
-
.type,
|
|
2440
|
-
.import,
|
|
2441
|
-
.function,
|
|
2442
|
-
.table,
|
|
2443
|
-
.memory,
|
|
2444
|
-
.global,
|
|
2445
|
-
.@"export",
|
|
2446
|
-
.element,
|
|
2447
|
-
.code,
|
|
2448
|
-
.data,
|
|
2449
|
-
=> {
|
|
2450
|
-
const entries = try reader.takeLeb128(u32);
|
|
2451
|
-
try writer.print("\nentries {d}\n", .{entries});
|
|
2452
|
-
try parseSection(step, section, data[reader.seek..], entries, writer);
|
|
2453
|
-
},
|
|
2454
|
-
.custom => {
|
|
2455
|
-
const name_length = try reader.takeLeb128(u32);
|
|
2456
|
-
const name = data[reader.seek..][0..name_length];
|
|
2457
|
-
reader.seek += name_length;
|
|
2458
|
-
try writer.print("\nname {s}\n", .{name});
|
|
2459
|
-
|
|
2460
|
-
if (mem.eql(u8, name, "name")) {
|
|
2461
|
-
try parseDumpNames(step, &reader, writer, data);
|
|
2462
|
-
} else if (mem.eql(u8, name, "producers")) {
|
|
2463
|
-
try parseDumpProducers(&reader, writer, data);
|
|
2464
|
-
} else if (mem.eql(u8, name, "target_features")) {
|
|
2465
|
-
try parseDumpFeatures(&reader, writer, data);
|
|
2466
|
-
}
|
|
2467
|
-
// TODO: Implement parsing and dumping other custom sections (such as relocations)
|
|
2468
|
-
},
|
|
2469
|
-
.start => {
|
|
2470
|
-
const start = try reader.takeLeb128(u32);
|
|
2471
|
-
try writer.print("\nstart {d}\n", .{start});
|
|
2472
|
-
},
|
|
2473
|
-
.data_count => {
|
|
2474
|
-
const count = try reader.takeLeb128(u32);
|
|
2475
|
-
try writer.print("\ncount {d}\n", .{count});
|
|
2476
|
-
},
|
|
2477
|
-
else => {}, // skip unknown sections
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
fn parseSection(step: *Step, section: std.wasm.Section, data: []const u8, entries: u32, writer: anytype) !void {
|
|
2482
|
-
var reader: std.Io.Reader = .fixed(data);
|
|
2483
|
-
|
|
2484
|
-
switch (section) {
|
|
2485
|
-
.type => {
|
|
2486
|
-
var i: u32 = 0;
|
|
2487
|
-
while (i < entries) : (i += 1) {
|
|
2488
|
-
const func_type = try reader.takeByte();
|
|
2489
|
-
if (func_type != std.wasm.function_type) {
|
|
2490
|
-
return step.fail("expected function type, found byte '{d}'", .{func_type});
|
|
2491
|
-
}
|
|
2492
|
-
const params = try reader.takeLeb128(u32);
|
|
2493
|
-
try writer.print("params {d}\n", .{params});
|
|
2494
|
-
var index: u32 = 0;
|
|
2495
|
-
while (index < params) : (index += 1) {
|
|
2496
|
-
_ = try parseDumpType(step, std.wasm.Valtype, &reader, writer);
|
|
2497
|
-
} else index = 0;
|
|
2498
|
-
const returns = try reader.takeLeb128(u32);
|
|
2499
|
-
try writer.print("returns {d}\n", .{returns});
|
|
2500
|
-
while (index < returns) : (index += 1) {
|
|
2501
|
-
_ = try parseDumpType(step, std.wasm.Valtype, &reader, writer);
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
},
|
|
2505
|
-
.import => {
|
|
2506
|
-
var i: u32 = 0;
|
|
2507
|
-
while (i < entries) : (i += 1) {
|
|
2508
|
-
const module_name_len = try reader.takeLeb128(u32);
|
|
2509
|
-
const module_name = data[reader.seek..][0..module_name_len];
|
|
2510
|
-
reader.seek += module_name_len;
|
|
2511
|
-
const name_len = try reader.takeLeb128(u32);
|
|
2512
|
-
const name = data[reader.seek..][0..name_len];
|
|
2513
|
-
reader.seek += name_len;
|
|
2514
|
-
|
|
2515
|
-
const kind = std.enums.fromInt(std.wasm.ExternalKind, try reader.takeByte()) orelse {
|
|
2516
|
-
return step.fail("invalid import kind", .{});
|
|
2517
|
-
};
|
|
2518
|
-
|
|
2519
|
-
try writer.print(
|
|
2520
|
-
\\module {s}
|
|
2521
|
-
\\name {s}
|
|
2522
|
-
\\kind {s}
|
|
2523
|
-
, .{ module_name, name, @tagName(kind) });
|
|
2524
|
-
try writer.writeByte('\n');
|
|
2525
|
-
switch (kind) {
|
|
2526
|
-
.function => {
|
|
2527
|
-
try writer.print("index {d}\n", .{try reader.takeLeb128(u32)});
|
|
2528
|
-
},
|
|
2529
|
-
.memory => {
|
|
2530
|
-
try parseDumpLimits(&reader, writer);
|
|
2531
|
-
},
|
|
2532
|
-
.global => {
|
|
2533
|
-
_ = try parseDumpType(step, std.wasm.Valtype, &reader, writer);
|
|
2534
|
-
try writer.print("mutable {}\n", .{0x01 == try reader.takeLeb128(u32)});
|
|
2535
|
-
},
|
|
2536
|
-
.table => {
|
|
2537
|
-
_ = try parseDumpType(step, std.wasm.RefType, &reader, writer);
|
|
2538
|
-
try parseDumpLimits(&reader, writer);
|
|
2539
|
-
},
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
},
|
|
2543
|
-
.function => {
|
|
2544
|
-
var i: u32 = 0;
|
|
2545
|
-
while (i < entries) : (i += 1) {
|
|
2546
|
-
try writer.print("index {d}\n", .{try reader.takeLeb128(u32)});
|
|
2547
|
-
}
|
|
2548
|
-
},
|
|
2549
|
-
.table => {
|
|
2550
|
-
var i: u32 = 0;
|
|
2551
|
-
while (i < entries) : (i += 1) {
|
|
2552
|
-
_ = try parseDumpType(step, std.wasm.RefType, &reader, writer);
|
|
2553
|
-
try parseDumpLimits(&reader, writer);
|
|
2554
|
-
}
|
|
2555
|
-
},
|
|
2556
|
-
.memory => {
|
|
2557
|
-
var i: u32 = 0;
|
|
2558
|
-
while (i < entries) : (i += 1) {
|
|
2559
|
-
try parseDumpLimits(&reader, writer);
|
|
2560
|
-
}
|
|
2561
|
-
},
|
|
2562
|
-
.global => {
|
|
2563
|
-
var i: u32 = 0;
|
|
2564
|
-
while (i < entries) : (i += 1) {
|
|
2565
|
-
_ = try parseDumpType(step, std.wasm.Valtype, &reader, writer);
|
|
2566
|
-
try writer.print("mutable {}\n", .{0x01 == try reader.takeLeb128(u1)});
|
|
2567
|
-
try parseDumpInit(step, &reader, writer);
|
|
2568
|
-
}
|
|
2569
|
-
},
|
|
2570
|
-
.@"export" => {
|
|
2571
|
-
var i: u32 = 0;
|
|
2572
|
-
while (i < entries) : (i += 1) {
|
|
2573
|
-
const name_len = try reader.takeLeb128(u32);
|
|
2574
|
-
const name = data[reader.seek..][0..name_len];
|
|
2575
|
-
reader.seek += name_len;
|
|
2576
|
-
const kind_byte = try reader.takeLeb128(u8);
|
|
2577
|
-
const kind = std.enums.fromInt(std.wasm.ExternalKind, kind_byte) orelse {
|
|
2578
|
-
return step.fail("invalid export kind value '{d}'", .{kind_byte});
|
|
2579
|
-
};
|
|
2580
|
-
const index = try reader.takeLeb128(u32);
|
|
2581
|
-
try writer.print(
|
|
2582
|
-
\\name {s}
|
|
2583
|
-
\\kind {s}
|
|
2584
|
-
\\index {d}
|
|
2585
|
-
, .{ name, @tagName(kind), index });
|
|
2586
|
-
try writer.writeByte('\n');
|
|
2587
|
-
}
|
|
2588
|
-
},
|
|
2589
|
-
.element => {
|
|
2590
|
-
var i: u32 = 0;
|
|
2591
|
-
while (i < entries) : (i += 1) {
|
|
2592
|
-
try writer.print("table index {d}\n", .{try reader.takeLeb128(u32)});
|
|
2593
|
-
try parseDumpInit(step, &reader, writer);
|
|
2594
|
-
|
|
2595
|
-
const function_indexes = try reader.takeLeb128(u32);
|
|
2596
|
-
var function_index: u32 = 0;
|
|
2597
|
-
try writer.print("indexes {d}\n", .{function_indexes});
|
|
2598
|
-
while (function_index < function_indexes) : (function_index += 1) {
|
|
2599
|
-
try writer.print("index {d}\n", .{try reader.takeLeb128(u32)});
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
},
|
|
2603
|
-
.code => {}, // code section is considered opaque to linker
|
|
2604
|
-
.data => {
|
|
2605
|
-
var i: u32 = 0;
|
|
2606
|
-
while (i < entries) : (i += 1) {
|
|
2607
|
-
const flags = try reader.takeLeb128(u32);
|
|
2608
|
-
const index = if (flags & 0x02 != 0)
|
|
2609
|
-
try reader.takeLeb128(u32)
|
|
2610
|
-
else
|
|
2611
|
-
0;
|
|
2612
|
-
try writer.print("memory index 0x{x}\n", .{index});
|
|
2613
|
-
if (flags == 0) {
|
|
2614
|
-
try parseDumpInit(step, &reader, writer);
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
const size = try reader.takeLeb128(u32);
|
|
2618
|
-
try writer.print("size {d}\n", .{size});
|
|
2619
|
-
try reader.discardAll(size); // we do not care about the content of the segments
|
|
2620
|
-
}
|
|
2621
|
-
},
|
|
2622
|
-
else => unreachable,
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
fn parseDumpType(step: *Step, comptime E: type, reader: *std.Io.Reader, writer: *std.Io.Writer) !E {
|
|
2627
|
-
const byte = try reader.takeByte();
|
|
2628
|
-
const tag = std.enums.fromInt(E, byte) orelse {
|
|
2629
|
-
return step.fail("invalid wasm type value '{d}'", .{byte});
|
|
2630
|
-
};
|
|
2631
|
-
try writer.print("type {s}\n", .{@tagName(tag)});
|
|
2632
|
-
return tag;
|
|
2633
|
-
}
|
|
2634
|
-
|
|
2635
|
-
fn parseDumpLimits(reader: anytype, writer: anytype) !void {
|
|
2636
|
-
const flags = try reader.takeLeb128(u8);
|
|
2637
|
-
const min = try reader.takeLeb128(u32);
|
|
2638
|
-
|
|
2639
|
-
try writer.print("min {x}\n", .{min});
|
|
2640
|
-
if (flags != 0) {
|
|
2641
|
-
try writer.print("max {x}\n", .{try reader.takeLeb128(u32)});
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
fn parseDumpInit(step: *Step, reader: *std.Io.Reader, writer: *std.Io.Writer) !void {
|
|
2646
|
-
const byte = try reader.takeByte();
|
|
2647
|
-
const opcode = std.enums.fromInt(std.wasm.Opcode, byte) orelse {
|
|
2648
|
-
return step.fail("invalid wasm opcode '{d}'", .{byte});
|
|
2649
|
-
};
|
|
2650
|
-
switch (opcode) {
|
|
2651
|
-
.i32_const => try writer.print("i32.const {x}\n", .{try reader.takeLeb128(i32)}),
|
|
2652
|
-
.i64_const => try writer.print("i64.const {x}\n", .{try reader.takeLeb128(i64)}),
|
|
2653
|
-
.f32_const => try writer.print("f32.const {x}\n", .{@as(f32, @bitCast(try reader.takeInt(u32, .little)))}),
|
|
2654
|
-
.f64_const => try writer.print("f64.const {x}\n", .{@as(f64, @bitCast(try reader.takeInt(u64, .little)))}),
|
|
2655
|
-
.global_get => try writer.print("global.get {x}\n", .{try reader.takeLeb128(u32)}),
|
|
2656
|
-
else => unreachable,
|
|
2657
|
-
}
|
|
2658
|
-
const end_opcode = try reader.takeLeb128(u8);
|
|
2659
|
-
if (end_opcode != @intFromEnum(std.wasm.Opcode.end)) {
|
|
2660
|
-
return step.fail("expected 'end' opcode in init expression", .{});
|
|
2661
|
-
}
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
/// https://webassembly.github.io/spec/core/appendix/custom.html
|
|
2665
|
-
fn parseDumpNames(step: *Step, reader: *std.Io.Reader, writer: *std.Io.Writer, data: []const u8) !void {
|
|
2666
|
-
while (reader.seek < data.len) {
|
|
2667
|
-
switch (try parseDumpType(step, std.wasm.NameSubsection, reader, writer)) {
|
|
2668
|
-
// The module name subsection ... consists of a single name
|
|
2669
|
-
// that is assigned to the module itself.
|
|
2670
|
-
.module => {
|
|
2671
|
-
const size = try reader.takeLeb128(u32);
|
|
2672
|
-
const name_len = try reader.takeLeb128(u32);
|
|
2673
|
-
if (size != name_len + 1) return error.BadSubsectionSize;
|
|
2674
|
-
if (reader.seek + name_len > data.len) return error.UnexpectedEndOfStream;
|
|
2675
|
-
try writer.print("name {s}\n", .{data[reader.seek..][0..name_len]});
|
|
2676
|
-
reader.seek += name_len;
|
|
2677
|
-
},
|
|
2678
|
-
|
|
2679
|
-
// The function name subsection ... consists of a name map
|
|
2680
|
-
// assigning function names to function indices.
|
|
2681
|
-
.function, .global, .data_segment => {
|
|
2682
|
-
const size = try reader.takeLeb128(u32);
|
|
2683
|
-
const entries = try reader.takeLeb128(u32);
|
|
2684
|
-
try writer.print(
|
|
2685
|
-
\\size {d}
|
|
2686
|
-
\\names {d}
|
|
2687
|
-
\\
|
|
2688
|
-
, .{ size, entries });
|
|
2689
|
-
for (0..entries) |_| {
|
|
2690
|
-
const index = try reader.takeLeb128(u32);
|
|
2691
|
-
const name_len = try reader.takeLeb128(u32);
|
|
2692
|
-
if (reader.seek + name_len > data.len) return error.UnexpectedEndOfStream;
|
|
2693
|
-
const name = data[reader.seek..][0..name_len];
|
|
2694
|
-
reader.seek += name.len;
|
|
2695
|
-
|
|
2696
|
-
try writer.print(
|
|
2697
|
-
\\index {d}
|
|
2698
|
-
\\name {s}
|
|
2699
|
-
\\
|
|
2700
|
-
, .{ index, name });
|
|
2701
|
-
}
|
|
2702
|
-
},
|
|
2703
|
-
|
|
2704
|
-
// The local name subsection ... consists of an indirect name
|
|
2705
|
-
// map assigning local names to local indices grouped by
|
|
2706
|
-
// function indices.
|
|
2707
|
-
.local => {
|
|
2708
|
-
return step.fail("TODO implement parseDumpNames for local subsections", .{});
|
|
2709
|
-
},
|
|
2710
|
-
|
|
2711
|
-
else => |t| return step.fail("invalid subsection type: {s}", .{@tagName(t)}),
|
|
2712
|
-
}
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
|
-
fn parseDumpProducers(reader: *std.Io.Reader, writer: *std.Io.Writer, data: []const u8) !void {
|
|
2717
|
-
const field_count = try reader.takeLeb128(u32);
|
|
2718
|
-
try writer.print("fields {d}\n", .{field_count});
|
|
2719
|
-
var current_field: u32 = 0;
|
|
2720
|
-
while (current_field < field_count) : (current_field += 1) {
|
|
2721
|
-
const field_name_length = try reader.takeLeb128(u32);
|
|
2722
|
-
const field_name = data[reader.seek..][0..field_name_length];
|
|
2723
|
-
reader.seek += field_name_length;
|
|
2724
|
-
|
|
2725
|
-
const value_count = try reader.takeLeb128(u32);
|
|
2726
|
-
try writer.print(
|
|
2727
|
-
\\field_name {s}
|
|
2728
|
-
\\values {d}
|
|
2729
|
-
, .{ field_name, value_count });
|
|
2730
|
-
try writer.writeByte('\n');
|
|
2731
|
-
var current_value: u32 = 0;
|
|
2732
|
-
while (current_value < value_count) : (current_value += 1) {
|
|
2733
|
-
const value_length = try reader.takeLeb128(u32);
|
|
2734
|
-
const value = data[reader.seek..][0..value_length];
|
|
2735
|
-
reader.seek += value_length;
|
|
2736
|
-
|
|
2737
|
-
const version_length = try reader.takeLeb128(u32);
|
|
2738
|
-
const version = data[reader.seek..][0..version_length];
|
|
2739
|
-
reader.seek += version_length;
|
|
2740
|
-
|
|
2741
|
-
try writer.print(
|
|
2742
|
-
\\value_name {s}
|
|
2743
|
-
\\version {s}
|
|
2744
|
-
, .{ value, version });
|
|
2745
|
-
try writer.writeByte('\n');
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
}
|
|
2749
|
-
|
|
2750
|
-
fn parseDumpFeatures(reader: *std.Io.Reader, writer: *std.Io.Writer, data: []const u8) !void {
|
|
2751
|
-
const feature_count = try reader.takeLeb128(u32);
|
|
2752
|
-
try writer.print("features {d}\n", .{feature_count});
|
|
2753
|
-
|
|
2754
|
-
var index: u32 = 0;
|
|
2755
|
-
while (index < feature_count) : (index += 1) {
|
|
2756
|
-
const prefix_byte = try reader.takeLeb128(u8);
|
|
2757
|
-
const name_length = try reader.takeLeb128(u32);
|
|
2758
|
-
const feature_name = data[reader.seek..][0..name_length];
|
|
2759
|
-
reader.seek += name_length;
|
|
2760
|
-
|
|
2761
|
-
try writer.print("{c} {s}\n", .{ prefix_byte, feature_name });
|
|
2762
|
-
}
|
|
2763
|
-
}
|
|
2764
|
-
};
|