various fixes

* getopt changes
* removed some tbb call
* used the new demangle callsite
This commit is contained in:
Farid Zakaria 2023-07-08 02:15:36 +00:00
parent a5ab4fa2cb
commit 640d1aec04
19 changed files with 30 additions and 23 deletions

View file

@ -70,8 +70,8 @@ COSMOPOLITAN_C_END_
#define SIGWINCH 28
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGBUS 7
#define SIGBUS SIGBUS
#define SIGTHR SIGTHR
#define SIGCHLD SIGCHLD
#define SIGCONT SIGCONT

View file

@ -71,7 +71,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "libc/isystem/getopt.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

3
third_party/mold/config.h vendored Normal file
View file

@ -0,0 +1,3 @@
#define MOLD_VERSION "1.11.0"
#define MOLD_LIBDIR "/usr/local/lib"
#define MOLD_IS_SOLD 0

View file

@ -2,6 +2,7 @@
#include "third_party/mold/common.h"
#include "third_party/libcxx/cstdlib"
#include "libc/stdio/stdio.h"
#ifndef _WIN32
// MISSING #include <cxxabi.h>
@ -38,7 +39,7 @@ std::optional<std::string_view> cpp_demangle(std::string_view name) {
#ifndef _WIN32
if (name.starts_with("_Z")) {
int status;
char *p = abi::__cxa_demangle(std::string(name).c_str(), buf, &buflen, &status);
char *p = __cxa_demangle(std::string(name).c_str(), buf, &buflen, &status);
if (status == 0) {
buf = p;
return p;

View file

@ -36,7 +36,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

View file

@ -16,7 +16,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

View file

@ -39,7 +39,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

View file

@ -107,7 +107,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"

View file

@ -50,7 +50,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

View file

@ -29,7 +29,7 @@
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/rand48.h"
#include "libc/mem/alg.h"
@ -45,7 +45,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"

View file

@ -42,7 +42,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif

View file

@ -2,7 +2,7 @@
#if !defined(_WIN32) && !defined(__APPLE__)
#include "third_party/mold/elf/mold.h"
// MISSING #include "config.h"
#include "third_party/mold/config.h"
#include "third_party/libcxx/filesystem"
#include "libc/calls/calls.h"
@ -51,7 +51,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"

View file

@ -1,6 +1,6 @@
// clang-format off
#include "third_party/mold/common.h"
// MISSING #include "config.h"
#include "third_party/mold/config.h"
#include "third_party/libcxx/cstring"
#include "third_party/libcxx/filesystem"
@ -29,7 +29,7 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"
#endif
@ -167,10 +167,11 @@ void install_signal_handler() {
#endif
i64 get_default_thread_count() {
// TODO(fzakaria): disable tbb callsites
// mold doesn't scale well above 32 threads.
int n = tbb::global_control::active_value(
tbb::global_control::max_allowed_parallelism);
return std::min(n, 32);
// int n = tbb::global_control::active_value(
// tbb::global_control::max_allowed_parallelism);
return 1;
}
} // namespace mold

View file

@ -15,12 +15,14 @@ THIRD_PARTY_MOLD_A_DIRECTDEPS = \
THIRD_PARTY_LIBCXX \
THIRD_PARTY_ZSTD \
THIRD_PARTY_XXHASH \
THIRD_PARTY_GETOPT \
THIRD_PARTY_ZLIB
THIRD_PARTY_MOLD_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_MOLD_A_DIRECTDEPS),$($(x))))
# https://github.com/rui314/mold/blob/d4d93d7fb72dd19c44aafa4dd5397e35787d33ad/CMakeLists.txt#L62
# TODO(fzakaria): figure out solution for -Wno-error=class-memaccess
$(THIRD_PARTY_MOLD_OBJS): private \
CPPFLAGS += \
-std=gnu++20 \

View file

@ -41,7 +41,7 @@ cat <<EOF | $CC -o $t/b.o -c -fno-PIC -xc -
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/rand48.h"
// MISSING #include <ucontext.h>

View file

@ -39,7 +39,7 @@ cat <<'EOF' | $CC -xc -o $t/exe -
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"

View file

@ -24,7 +24,7 @@ cat <<EOF | $CC -fPIC -c -o $t/a.o -xc -
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/rand48.h"

View file

@ -40,7 +40,7 @@ cat <<EOF | $CC -c -o $t/b.o -xc -
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "third_party/getopt/getopt.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h"

View file

@ -1828,7 +1828,7 @@ static void XXH_free(void* p) { (void)p; }
#include "libc/stdio/temp.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/exit.h"
#include "third_party/getopt/getopt.internal.h"
#include "third_party/getopt/long.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/rand48.h"