Applications supplying their own custom stack to pthread_create are not
allowed to free the allocated memory after pthread_join returns as,
according to the specification, the thread is not guaranteed to be dead
after the join call returns.
Avoid this class of problems by avoiding the use of a custom stack
altogether, let pthread handle its own resources.
Allocations made on the child stack are now done on the C heap.
Thanks @semarie for noticing the problem on OpenBSD and suggesting a
fix.
Closes#7275
commit 9d1816111d used the "output path"
as the path for passing shared library artifact paths to the Zig CLI.
For Windows, this was incorrect because it would pass the .dll instead
of the .lib file. This commit passes the "output lib path" instead,
which makes it pass the .lib path in case of a .dll on Windows.
This way the linker does not complain and say, "bad file type. Did you
specify a DLL instead of an import library?"
* it is now -fcompiler-rt and -fno-compiler-rt to override the (quite
reasonable) default of bundling compiler-rt only for executables and
dynamic libraries.
- the build.zig API is still called bundle_compiler_rt however it is
now an optional bool instead of a bool. leaving it as `null` means
to use the compiler default.
* renamed some internal identifiers to make the source more readable
* additionally support -fcompiler-rt when doing build-obj for ELF files
since that target already supports linking multiple objects into one.
- includes an error message when attempting this for non-ELF. in the
future this could additionally be supported with a more advanced
implementation that does not rely on the linker.
* properly populate the linker cache hash
I spent a long time working on this data structure, and I still think
it's a neat idea, but it has no business being in the std lib.
I'm aware of the few remaining references to SegmentedList that exist in
the std lib, but they are dead code, and so I'm leaving the dead
references as a clue that the code is dead. Cleaning up dead code will
be a separate effort that involves code coverage tools to make sure we
find it all.
std-lib-orphanage commit: 2c36a7894c689ecbaf63d5f489bb0c68773410c4
closes#7190
* Switch to using unicode when parsing the command line on windows
* Apply changes by LemonBoy and *hopefully* fix tests on MIPs
Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com>
* Fix up next and skip
* Move comment to more relevant place
Co-authored-by: LemonBoy <LemonBoy@users.noreply.github.com>
stderr_mutex may still be held when we reach the signal handler, grab
our own stderr handle to print the error messages and avoid deadlocking.
Closes#7247
fork() on Linux/sparc64 seems to return its result in two registers,
with %o0 always holding the current process' PID, and the parent/child
status returned in %o1. Add some glue code to convert those into
the libc-style return value.
* always align the stack to 16. I saw an instance on x86_64 linux where
it was needed.
* detect at runtime if being interpreted by a dynamic loader and if so
avoid clobbering the fs register.
Find the effective ELF load address in dl_iterate_phdr by computing the
difference between the in-memory phdr and its p_vaddr specified in the
ELF file.
This makes the dl_iterate_phdr test pass and restores the stack traces.