support glibc dl, m, pthread, rt

master
Andrew Kelley 2019-03-05 18:17:22 -05:00
parent e06da10838
commit 4c386436ea
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
10 changed files with 1899 additions and 137 deletions

View File

@ -805,6 +805,11 @@ set(ZIG_C_HEADER_FILES
)
set(ZIG_LIBC_FILES
"dummy/c.zig"
"dummy/dl.zig"
"dummy/m.zig"
"dummy/pthread.zig"
"dummy/rt.zig"
"glibc-include/a.out.h"
"glibc-include/aio.h"
"glibc-include/aliases.h"
@ -1250,60 +1255,74 @@ set(ZIG_LIBC_FILES
"glibc/bits/floatn-common.h"
"glibc/bits/libc-header-start.h"
"glibc/bits/long-double.h"
"glibc/bits/param.h"
"glibc/bits/pthreadtypes.h"
"glibc/bits/sched.h"
"glibc/bits/select.h"
"glibc/bits/setjmp.h"
"glibc/bits/signum-generic.h"
"glibc/bits/signum.h"
"glibc/bits/stat.h"
"glibc/bits/stdint-intn.h"
"glibc/bits/timesize.h"
"glibc/bits/typesizes.h"
"glibc/bits/stdlib-bsearch.h"
"glibc/bits/time.h"
"glibc/bits/time64.h"
"glibc/bits/timesize.h"
"glibc/bits/types/__sigset_t.h"
"glibc/bits/types/struct_sched_param.h"
"glibc/bits/typesizes.h"
"glibc/bits/uintn-identity.h"
"glibc/bits/waitflags.h"
"glibc/bits/waitstatus.h"
"glibc/bits/select.h"
"glibc/bits/pthreadtypes.h"
"glibc/bits/types/__sigset_t.h"
"glibc/bits/types/struct_sched_param.h"
"glibc/bits/stdlib-bsearch.h"
"glibc/bits/stat.h"
"glibc/bits/sched.h"
"glibc/bits/time.h"
"glibc/csu/abi-note.S"
"glibc/csu/abi-tag.h"
"glibc/csu/elf-init.c"
"glibc/csu/init.c"
"glibc/debug/stack_chk_fail_local.c"
"glibc/elf/elf.h"
"glibc/include/alloca.h"
"glibc/include/bits/cpu-set.h"
"glibc/include/bits/statx.h"
"glibc/include/bits/stdlib-float.h"
"glibc/include/bits/types.h"
"glibc/include/bits/types/__locale_t.h"
"glibc/include/bits/types/clock_t.h"
"glibc/include/bits/types/time_t.h"
"glibc/include/bits/types/timer_t.h"
"glibc/include/bits/types/clockid_t.h"
"glibc/include/bits/types/locale_t.h"
"glibc/include/bits/types/sig_atomic_t.h"
"glibc/include/bits/types/sigset_t.h"
"glibc/include/bits/types/struct_timeval.h"
"glibc/include/bits/types/struct_itimerspec.h"
"glibc/include/bits/types/struct_timespec.h"
"glibc/include/bits/stdlib-float.h"
"glibc/include/bits/statx.h"
"glibc/include/bits/cpu-set.h"
"glibc/include/bits/types/struct_timeval.h"
"glibc/include/bits/types/struct_tm.h"
"glibc/include/bits/types/time_t.h"
"glibc/include/bits/types/timer_t.h"
"glibc/include/config.h"
"glibc/include/dso_handle.h"
"glibc/include/elf.h"
"glibc/include/endian.h"
"glibc/include/features.h"
"glibc/include/gnu/stubs.h"
"glibc/include/libc-modules.h"
"glibc/include/libc-pointer-arith.h"
"glibc/include/libc-symbols.h"
"glibc/include/pthread.h"
"glibc/include/sched.h"
"glibc/include/setjmp.h"
"glibc/include/signal.h"
"glibc/include/stackinfo.h"
"glibc/include/stap-probe.h"
"glibc/include/stdc-predef.h"
"glibc/include/stdlib.h"
"glibc/include/sys/cdefs.h"
"glibc/include/sys/types.h"
"glibc/include/sys/param.h"
"glibc/include/sys/select.h"
"glibc/include/sys/signal.h"
"glibc/include/sys/stat.h"
"glibc/include/stackinfo.h"
"glibc/include/libc-pointer-arith.h"
"glibc/include/dso_handle.h"
"glibc/include/pthread.h"
"glibc/include/sched.h"
"glibc/include/time.h"
"glibc/include/sys/time.h"
"glibc/include/sys/types.h"
"glibc/include/time.h"
"glibc/io/bits/statx.h"
"glibc/io/fstat.c"
"glibc/io/fstat64.c"
"glibc/io/fstatat.c"
@ -1315,93 +1334,78 @@ set(ZIG_LIBC_FILES
"glibc/io/stat.c"
"glibc/io/stat64.c"
"glibc/io/sys/stat.h"
"glibc/io/bits/statx.h"
"glibc/locale/bits/types/__locale_t.h"
"glibc/locale/bits/types/locale_t.h"
"glibc/misc/sys/cdefs.h"
"glibc/misc/sys/param.h"
"glibc/misc/sys/select.h"
"glibc/nptl/pthread_atfork.c"
"glibc/posix/bits/types.h"
"glibc/posix/sys/types.h"
"glibc/posix/sched.h"
"glibc/posix/bits/cpu-set.h"
"glibc/posix/bits/types.h"
"glibc/posix/sched.h"
"glibc/posix/sys/types.h"
"glibc/setjmp/setjmp.h"
"glibc/setjmp/setjmp.h"
"glibc/signal/bits/types/sig_atomic_t.h"
"glibc/signal/bits/types/sigset_t.h"
"glibc/signal/signal.h"
"glibc/signal/sys/signal.h"
"glibc/stdlib/alloca.h"
"glibc/stdlib/at_quick_exit.c"
"glibc/stdlib/atexit.c"
"glibc/stdlib/bits/stdlib-float.h"
"glibc/stdlib/exit.h"
"glibc/stdlib/stdlib.h"
"glibc/stdlib/bits/stdlib-float.h"
"glibc/string/endian.h"
"glibc/sysdeps/generic/allocalim.h"
"glibc/sysdeps/generic/dl-dtprocnum.h"
"glibc/sysdeps/generic/dwarf2.h"
"glibc/sysdeps/generic/libc-lock.h"
"glibc/sysdeps/generic/stackinfo.h"
"glibc/sysdeps/generic/symbol-hacks.h"
"glibc/sysdeps/generic/sysdep.h"
"glibc/sysdeps/generic/stackinfo.h"
"glibc/sysdeps/generic/dl-dtprocnum.h"
"glibc/sysdeps/generic/allocalim.h"
"glibc/sysdeps/generic/libc-lock.h"
"glibc/sysdeps/pthread/allocalim.h"
"glibc/sysdeps/nptl/bits/pthreadtypes.h"
"glibc/sysdeps/nptl/bits/thread-shared-types.h"
"glibc/sysdeps/nptl/libc-lock.h"
"glibc/sysdeps/nptl/libc-lockP.h"
"glibc/sysdeps/nptl/lowlevellock.h"
"glibc/sysdeps/nptl/pthread.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h"
"glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h"
"glibc/sysdeps/pthread/allocalim.h"
"glibc/sysdeps/unix/sysv/linux/bits/param.h"
"glibc/sysdeps/unix/sysv/linux/bits/sched.h"
"glibc/sysdeps/unix/sysv/linux/bits/signum.h"
"glibc/sysdeps/unix/sysv/linux/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/bits/time.h"
"glibc/sysdeps/unix/sysv/linux/bits/timex.h"
"glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/include/sys/timex.h"
"glibc/sysdeps/unix/sysv/linux/sys/timex.h"
"glibc/sysdeps/unix/sysv/linux/bits/timex.h"
"glibc/sysdeps/x86/bits/floatn.h"
"glibc/sysdeps/x86/bits/wordsize.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h"
"glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h"
"glibc/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h"
"glibc/sysdeps/x86/bits/endian.h"
"glibc/sysdeps/x86/bits/floatn.h"
"glibc/sysdeps/x86/bits/select.h"
"glibc/sysdeps/x86/sysdep.h"
"glibc/sysdeps/x86/bits/setjmp.h"
"glibc/sysdeps/x86/bits/wordsize.h"
"glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h"
"glibc/sysdeps/x86/sysdep.h"
"glibc/sysdeps/x86_64/crti.S"
"glibc/sysdeps/x86_64/crtn.S"
"glibc/sysdeps/x86_64/stackinfo.h"
"glibc/sysdeps/x86_64/start.S"
"glibc/sysdeps/x86_64/sysdep.h"
"glibc/sysdeps/x86_64/stackinfo.h"
"glibc/time/bits/types/clock_t.h"
"glibc/time/bits/types/clockid_t.h"
"glibc/time/bits/types/struct_itimerspec.h"
"glibc/time/bits/types/struct_timespec.h"
"glibc/time/bits/types/struct_timeval.h"
"glibc/time/bits/types/struct_tm.h"
"glibc/time/bits/types/time_t.h"
"glibc/time/bits/types/timer_t.h"
"glibc/time/bits/types/struct_timeval.h"
"glibc/time/bits/types/struct_timespec.h"
"glibc/time/time.h"
"glibc/time/sys/time.h"
"glibc/string/endian.h"
"glibc/signal/bits/types/sigset_t.h"
"glibc/stdlib/alloca.h"
"glibc/elf/elf.h"
"glibc/include/bits/types/struct_tm.h"
"glibc/time/bits/types/struct_tm.h"
"glibc/include/bits/types/struct_itimerspec.h"
"glibc/time/bits/types/struct_itimerspec.h"
"glibc/sysdeps/x86/bits/setjmp.h"
"glibc/include/setjmp.h"
"glibc/setjmp/setjmp.h"
"glibc/setjmp/setjmp.h"
"glibc/bits/setjmp.h"
"glibc/sysdeps/nptl/libc-lockP.h"
"glibc/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h"
"glibc/sysdeps/nptl/lowlevellock.h"
"glibc/include/stap-probe.h"
"glibc/sysdeps/unix/sysv/linux/bits/param.h"
"glibc/include/sys/param.h"
"glibc/misc/sys/param.h"
"glibc/bits/param.h"
"glibc/include/signal.h"
"glibc/include/sys/signal.h"
"glibc/signal/signal.h"
"glibc/signal/sys/signal.h"
"glibc/sysdeps/unix/sysv/linux/bits/signum.h"
"glibc/bits/signum.h"
"glibc/bits/signum-generic.h"
"glibc/include/bits/types/sig_atomic_t.h"
"glibc/signal/bits/types/sig_atomic_t.h"
"glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h"
"glibc/sysdeps/unix/sysv/linux/bits/stat.h"
"symbols.zig"
"glibc/time/time.h"
)
if(MSVC)

File diff suppressed because it is too large Load Diff

19
libc/dummy/dl.zig Normal file
View File

@ -0,0 +1,19 @@
const builtin = @import("builtin");
pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
unreachable;
}
// This file exists to create a libdl.so file so that LLD has something to look at
// and emit linker errors if an attempt to link against a non-existent C symbol happens.
export fn __libdl_freeres() void {}
export fn _dlfcn_hook() void {}
export fn dladdr() void {}
export fn dladdr1() void {}
export fn dlclose() void {}
export fn dlerror() void {}
export fn dlinfo() void {}
export fn dlmopen() void {}
export fn dlopen() void {}
export fn dlsym() void {}
export fn dlvsym() void {}

1068
libc/dummy/m.zig Normal file

File diff suppressed because it is too large Load Diff

263
libc/dummy/pthread.zig Normal file
View File

@ -0,0 +1,263 @@
const builtin = @import("builtin");
pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
unreachable;
}
// This file exists to create a libpthread.so file so that LLD has something to look at
// and emit linker errors if an attempt to link against a non-existent C symbol happens.
export fn _IO_flockfile() void {}
export fn _IO_ftrylockfile() void {}
export fn _IO_funlockfile() void {}
export fn __close() void {}
export fn __connect() void {}
export fn __errno_location() void {}
export fn __fcntl() void {}
export fn __fork() void {}
export fn __h_errno_location() void {}
export fn __libc_allocate_rtsig() void {}
export fn __libc_current_sigrtmax() void {}
export fn __libc_current_sigrtmin() void {}
export fn __libpthread_freeres() void {}
export fn __lseek() void {}
export fn __nanosleep() void {}
export fn __open() void {}
export fn __open64() void {}
export fn __pread64() void {}
export fn __pthread_barrier_init() void {}
export fn __pthread_barrier_wait() void {}
export fn __pthread_cleanup_routine() void {}
export fn __pthread_clock_gettime() void {}
export fn __pthread_clock_settime() void {}
export fn __pthread_get_minstack() void {}
export fn __pthread_getspecific() void {}
export fn __pthread_initialize_minimal() void {}
export fn __pthread_key_create() void {}
export fn __pthread_mutex_destroy() void {}
export fn __pthread_mutex_init() void {}
export fn __pthread_mutex_lock() void {}
export fn __pthread_mutex_trylock() void {}
export fn __pthread_mutex_unlock() void {}
export fn __pthread_mutexattr_destroy() void {}
export fn __pthread_mutexattr_init() void {}
export fn __pthread_mutexattr_settype() void {}
export fn __pthread_once() void {}
export fn __pthread_register_cancel() void {}
export fn __pthread_register_cancel_defer() void {}
export fn __pthread_rwlock_destroy() void {}
export fn __pthread_rwlock_init() void {}
export fn __pthread_rwlock_rdlock() void {}
export fn __pthread_rwlock_tryrdlock() void {}
export fn __pthread_rwlock_trywrlock() void {}
export fn __pthread_rwlock_unlock() void {}
export fn __pthread_rwlock_wrlock() void {}
export fn __pthread_setspecific() void {}
export fn __pthread_unregister_cancel() void {}
export fn __pthread_unregister_cancel_restore() void {}
export fn __pthread_unwind() void {}
export fn __pthread_unwind_next() void {}
export fn __pwrite64() void {}
export fn __read() void {}
export fn __res_state() void {}
export fn __send() void {}
export fn __shm_directory() void {}
export fn __sigaction() void {}
export fn __vfork() void {}
export fn __wait() void {}
export fn __write() void {}
export fn _pthread_cleanup_pop() void {}
export fn _pthread_cleanup_pop_restore() void {}
export fn _pthread_cleanup_push() void {}
export fn _pthread_cleanup_push_defer() void {}
export fn accept() void {}
export fn call_once() void {}
export fn close() void {}
export fn cnd_broadcast() void {}
export fn cnd_destroy() void {}
export fn cnd_init() void {}
export fn cnd_signal() void {}
export fn cnd_timedwait() void {}
export fn cnd_wait() void {}
export fn connect() void {}
export fn fcntl() void {}
export fn flockfile() void {}
export fn fork() void {}
export fn fsync() void {}
export fn ftrylockfile() void {}
export fn funlockfile() void {}
export fn longjmp() void {}
export fn lseek() void {}
export fn lseek64() void {}
export fn msync() void {}
export fn mtx_destroy() void {}
export fn mtx_init() void {}
export fn mtx_lock() void {}
export fn mtx_timedlock() void {}
export fn mtx_trylock() void {}
export fn mtx_unlock() void {}
export fn nanosleep() void {}
export fn open() void {}
export fn open64() void {}
export fn pause() void {}
export fn pread() void {}
export fn pread64() void {}
export fn pthread_atfork() void {}
export fn pthread_attr_destroy() void {}
export fn pthread_attr_getaffinity_np() void {}
export fn pthread_attr_getdetachstate() void {}
export fn pthread_attr_getguardsize() void {}
export fn pthread_attr_getinheritsched() void {}
export fn pthread_attr_getschedparam() void {}
export fn pthread_attr_getschedpolicy() void {}
export fn pthread_attr_getscope() void {}
export fn pthread_attr_getstack() void {}
export fn pthread_attr_getstackaddr() void {}
export fn pthread_attr_getstacksize() void {}
export fn pthread_attr_init() void {}
export fn pthread_attr_setaffinity_np() void {}
export fn pthread_attr_setdetachstate() void {}
export fn pthread_attr_setguardsize() void {}
export fn pthread_attr_setinheritsched() void {}
export fn pthread_attr_setschedparam() void {}
export fn pthread_attr_setschedpolicy() void {}
export fn pthread_attr_setscope() void {}
export fn pthread_attr_setstack() void {}
export fn pthread_attr_setstackaddr() void {}
export fn pthread_attr_setstacksize() void {}
export fn pthread_barrier_destroy() void {}
export fn pthread_barrier_init() void {}
export fn pthread_barrier_wait() void {}
export fn pthread_barrierattr_destroy() void {}
export fn pthread_barrierattr_getpshared() void {}
export fn pthread_barrierattr_init() void {}
export fn pthread_barrierattr_setpshared() void {}
export fn pthread_cancel() void {}
export fn pthread_cond_broadcast() void {}
export fn pthread_cond_destroy() void {}
export fn pthread_cond_init() void {}
export fn pthread_cond_signal() void {}
export fn pthread_cond_timedwait() void {}
export fn pthread_cond_wait() void {}
export fn pthread_condattr_destroy() void {}
export fn pthread_condattr_getclock() void {}
export fn pthread_condattr_getpshared() void {}
export fn pthread_condattr_init() void {}
export fn pthread_condattr_setclock() void {}
export fn pthread_condattr_setpshared() void {}
export fn pthread_create() void {}
export fn pthread_detach() void {}
export fn pthread_equal() void {}
export fn pthread_exit() void {}
export fn pthread_getaffinity_np() void {}
export fn pthread_getattr_default_np() void {}
export fn pthread_getattr_np() void {}
export fn pthread_getconcurrency() void {}
export fn pthread_getcpuclockid() void {}
export fn pthread_getname_np() void {}
export fn pthread_getschedparam() void {}
export fn pthread_getspecific() void {}
export fn pthread_join() void {}
export fn pthread_key_create() void {}
export fn pthread_key_delete() void {}
export fn pthread_kill() void {}
export fn pthread_kill_other_threads_np() void {}
export fn pthread_mutex_consistent() void {}
export fn pthread_mutex_consistent_np() void {}
export fn pthread_mutex_destroy() void {}
export fn pthread_mutex_getprioceiling() void {}
export fn pthread_mutex_init() void {}
export fn pthread_mutex_lock() void {}
export fn pthread_mutex_setprioceiling() void {}
export fn pthread_mutex_timedlock() void {}
export fn pthread_mutex_trylock() void {}
export fn pthread_mutex_unlock() void {}
export fn pthread_mutexattr_destroy() void {}
export fn pthread_mutexattr_getkind_np() void {}
export fn pthread_mutexattr_getprioceiling() void {}
export fn pthread_mutexattr_getprotocol() void {}
export fn pthread_mutexattr_getpshared() void {}
export fn pthread_mutexattr_getrobust() void {}
export fn pthread_mutexattr_getrobust_np() void {}
export fn pthread_mutexattr_gettype() void {}
export fn pthread_mutexattr_init() void {}
export fn pthread_mutexattr_setkind_np() void {}
export fn pthread_mutexattr_setprioceiling() void {}
export fn pthread_mutexattr_setprotocol() void {}
export fn pthread_mutexattr_setpshared() void {}
export fn pthread_mutexattr_setrobust() void {}
export fn pthread_mutexattr_setrobust_np() void {}
export fn pthread_mutexattr_settype() void {}
export fn pthread_once() void {}
export fn pthread_rwlock_destroy() void {}
export fn pthread_rwlock_init() void {}
export fn pthread_rwlock_rdlock() void {}
export fn pthread_rwlock_timedrdlock() void {}
export fn pthread_rwlock_timedwrlock() void {}
export fn pthread_rwlock_tryrdlock() void {}
export fn pthread_rwlock_trywrlock() void {}
export fn pthread_rwlock_unlock() void {}
export fn pthread_rwlock_wrlock() void {}
export fn pthread_rwlockattr_destroy() void {}
export fn pthread_rwlockattr_getkind_np() void {}
export fn pthread_rwlockattr_getpshared() void {}
export fn pthread_rwlockattr_init() void {}
export fn pthread_rwlockattr_setkind_np() void {}
export fn pthread_rwlockattr_setpshared() void {}
export fn pthread_self() void {}
export fn pthread_setaffinity_np() void {}
export fn pthread_setattr_default_np() void {}
export fn pthread_setcancelstate() void {}
export fn pthread_setcanceltype() void {}
export fn pthread_setconcurrency() void {}
export fn pthread_setname_np() void {}
export fn pthread_setschedparam() void {}
export fn pthread_setschedprio() void {}
export fn pthread_setspecific() void {}
export fn pthread_sigmask() void {}
export fn pthread_sigqueue() void {}
export fn pthread_spin_destroy() void {}
export fn pthread_spin_init() void {}
export fn pthread_spin_lock() void {}
export fn pthread_spin_trylock() void {}
export fn pthread_spin_unlock() void {}
export fn pthread_testcancel() void {}
export fn pthread_timedjoin_np() void {}
export fn pthread_tryjoin_np() void {}
export fn pthread_yield() void {}
export fn pwrite() void {}
export fn pwrite64() void {}
export fn raise() void {}
export fn read() void {}
export fn recv() void {}
export fn recvfrom() void {}
export fn recvmsg() void {}
export fn sem_close() void {}
export fn sem_destroy() void {}
export fn sem_getvalue() void {}
export fn sem_init() void {}
export fn sem_open() void {}
export fn sem_post() void {}
export fn sem_timedwait() void {}
export fn sem_trywait() void {}
export fn sem_unlink() void {}
export fn sem_wait() void {}
export fn send() void {}
export fn sendmsg() void {}
export fn sendto() void {}
export fn sigaction() void {}
export fn siglongjmp() void {}
export fn sigwait() void {}
export fn system() void {}
export fn tcdrain() void {}
export fn thrd_create() void {}
export fn thrd_detach() void {}
export fn thrd_exit() void {}
export fn thrd_join() void {}
export fn tss_create() void {}
export fn tss_delete() void {}
export fn tss_get() void {}
export fn tss_set() void {}
export fn vfork() void {}
export fn wait() void {}
export fn waitpid() void {}
export fn write() void {}

48
libc/dummy/rt.zig Normal file
View File

@ -0,0 +1,48 @@
const builtin = @import("builtin");
pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
unreachable;
}
// This file exists to create a librt.so file so that LLD has something to look at
// and emit linker errors if an attempt to link against a non-existent C symbol happens.
export fn __mq_open_2() void {}
export fn aio_cancel() void {}
export fn aio_cancel64() void {}
export fn aio_error() void {}
export fn aio_error64() void {}
export fn aio_fsync() void {}
export fn aio_fsync64() void {}
export fn aio_init() void {}
export fn aio_read() void {}
export fn aio_read64() void {}
export fn aio_return() void {}
export fn aio_return64() void {}
export fn aio_suspend() void {}
export fn aio_suspend64() void {}
export fn aio_write() void {}
export fn aio_write64() void {}
export fn clock_getcpuclockid() void {}
export fn clock_getres() void {}
export fn clock_gettime() void {}
export fn clock_nanosleep() void {}
export fn clock_settime() void {}
export fn lio_listio() void {}
export fn lio_listio64() void {}
export fn mq_close() void {}
export fn mq_getattr() void {}
export fn mq_notify() void {}
export fn mq_open() void {}
export fn mq_receive() void {}
export fn mq_send() void {}
export fn mq_setattr() void {}
export fn mq_timedreceive() void {}
export fn mq_timedsend() void {}
export fn mq_unlink() void {}
export fn shm_open() void {}
export fn shm_unlink() void {}
export fn timer_create() void {}
export fn timer_delete() void {}
export fn timer_getoverrun() void {}
export fn timer_gettime() void {}
export fn timer_settime() void {}

View File

@ -9148,6 +9148,7 @@ static void resolve_out_paths(CodeGen *g) {
return;
}
const char *prefix = "";
const char *extname;
switch (g->out_type) {
case OutTypeUnknown:
@ -9159,6 +9160,7 @@ static void resolve_out_paths(CodeGen *g) {
extname = target_exe_file_ext(g->zig_target);
break;
case OutTypeLib:
prefix = target_lib_file_prefix(g->zig_target);
extname = target_lib_file_ext(g->zig_target, g->is_static,
g->version_major, g->version_minor, g->version_patch);
break;
@ -9167,7 +9169,8 @@ static void resolve_out_paths(CodeGen *g) {
assert(g->root_out_name);
Buf basename = BUF_INIT;
buf_init_from_buf(&basename, g->root_out_name);
buf_init_from_str(&basename, prefix);
buf_append_buf(&basename, g->root_out_name);
buf_append_str(&basename, extname);
if (g->enable_cache || g->is_test_build) {
os_path_join(&g->artifact_dir, &basename, &g->output_file_path);

View File

@ -70,6 +70,17 @@ static const char *path_from_libc(CodeGen *g, const char *subpath) {
return buf_ptr(result);
}
static const char *build_dummy_so(CodeGen *parent, const char *name, size_t major_version) {
Buf *glibc_dummy_root_src = buf_sprintf("%s" OS_SEP "libc" OS_SEP "dummy" OS_SEP "%s.zig",
buf_ptr(parent->zig_lib_dir), name);
CodeGen *child_gen = create_child_codegen(parent, glibc_dummy_root_src, OutTypeLib, nullptr);
codegen_set_out_name(child_gen, buf_create_from_str(name));
codegen_set_lib_version(child_gen, major_version, 0, 0);
child_gen->is_static = false;
codegen_build_and_link(child_gen);
return buf_ptr(&child_gen->output_file_path);
}
static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
if (parent->libc == nullptr && target_is_glibc(parent)) {
if (strcmp(file, "crti.o") == 0) {
@ -181,13 +192,15 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
codegen_build_and_link(child_gen);
return buf_ptr(&child_gen->output_file_path);
} else if (strcmp(file, "libc.so.6") == 0) {
Buf *glibc_dummy_root_src = buf_create_from_str(path_from_libc(parent, "symbols.zig"));
CodeGen *child_gen = create_child_codegen(parent, glibc_dummy_root_src, OutTypeLib, nullptr);
codegen_set_out_name(child_gen, buf_create_from_str("c"));
codegen_set_lib_version(child_gen, 6, 0, 0);
child_gen->is_static = false;
codegen_build_and_link(child_gen);
return buf_ptr(&child_gen->output_file_path);
return build_dummy_so(parent, "c", 6);
} else if (strcmp(file, "libm.so.6") == 0) {
return build_dummy_so(parent, "m", 6);
} else if (strcmp(file, "libpthread.so.0") == 0) {
return build_dummy_so(parent, "pthread", 0);
} else if (strcmp(file, "librt.so.1") == 0) {
return build_dummy_so(parent, "rt", 1);
} else if (strcmp(file, "libdl.so.2") == 0) {
return build_dummy_so(parent, "dl", 2);
} else if (strcmp(file, "libc_nonshared.a") == 0) {
CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeLib, nullptr);
codegen_set_out_name(child_gen, buf_create_from_str("c_nonshared"));
@ -549,6 +562,22 @@ static void construct_linker_job_elf(LinkJob *lj) {
if (buf_eql_str(link_lib->name, "c")) {
continue;
}
if (g->libc == nullptr && target_is_glibc(g)) {
// glibc
if (buf_eql_str(link_lib->name, "m")) {
lj->args.append(get_libc_crt_file(g, "libm.so.6")); // this is our dummy so file
continue;
} else if (buf_eql_str(link_lib->name, "pthread")) {
lj->args.append(get_libc_crt_file(g, "libpthread.so.0")); // this is our dummy so file
continue;
} else if (buf_eql_str(link_lib->name, "dl")) {
lj->args.append(get_libc_crt_file(g, "libdl.so.2")); // this is our dummy so file
continue;
} else if (buf_eql_str(link_lib->name, "rt")) {
lj->args.append(get_libc_crt_file(g, "librt.so.1")); // this is our dummy so file
continue;
}
}
Buf *arg;
if (buf_starts_with_str(link_lib->name, "/") || buf_ends_with_str(link_lib->name, ".a") ||
buf_ends_with_str(link_lib->name, ".so"))

View File

@ -922,6 +922,14 @@ const char *target_exe_file_ext(const ZigTarget *target) {
}
}
const char *target_lib_file_prefix(const ZigTarget *target) {
if (target->os == OsWindows || target->os == OsUefi) {
return "";
} else {
return "lib";
}
}
const char *target_lib_file_ext(const ZigTarget *target, bool is_static,
size_t version_major, size_t version_minor, size_t version_patch)
{

View File

@ -143,6 +143,7 @@ const char *target_o_file_ext(const ZigTarget *target);
const char *target_asm_file_ext(const ZigTarget *target);
const char *target_llvm_ir_file_ext(const ZigTarget *target);
const char *target_exe_file_ext(const ZigTarget *target);
const char *target_lib_file_prefix(const ZigTarget *target);
const char *target_lib_file_ext(const ZigTarget *target, bool is_static,
size_t version_major, size_t version_minor, size_t version_patch);