Open Alex313031 opened 2 years ago
Please explain what you tried from the instructions in the README.
@matu3ba Okay, I have compiled it with stripping, -03, lto, and -march=haswell and -mtune=haswell for max performance :) I then set -fuse-ld=/usr/local/bin/mold in the main BUILD.gn for Thorium. Seems to work, but now another question. How do I pass llvm flags to it, as it doest recognize the mllvm option. Is mold one on one compatible with llvm flags, or is there something else I need to do?
For example, my main BUILD.gn normally has some loop optimizations I added like "-Wl,-mllvm,-aggressive-ext-opt" and "-Wl,-mllvm,-enable-loop-distribute", I have tried omitting the -Wl, ommitting the -mllvm, and ommiting both, but mold doesn't recognize them, wheras lld does, and I have the same set as cflags for clang, which also recognizes it.
Are you trying LTO? LTO is probably too new to try. We don't and unlikely to support mllvm options as they are LLVM-specific options.
i tried to compile chromium with mold. I use this patch to remove the mllvm options.
https://github.com/stha09/chromium-patches/blob/master/chromium-100-compiler.patch
After that the compile stops with the error:
ninja: Entering directory `out/Release'
[2040/50333] LINK ./chrome_sandbox
FAILED: chrome_sandbox
python3 "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome_sandbox" -- clang++ -pie -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -flto=thin -Wl,--thinlto-jobs=all -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -Wl,-mllvm,-import-instr-limit=5 -fwhole-program-vtables -no-canonical-prefixes -rdynamic -nostdlib++ -Wl,--lto-O0 -Wl,-z,defs -Wl,--as-needed -fsanitize=cfi-vcall -fsanitize=cfi-icall -pie -Wl,--disable-new-dtags -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -lgomp -fuse-ld=mold -DLLVM_USE_LINKER=mold -o "./chrome_sandbox" -Wl,--start-group @"./chrome_sandbox.rsp" -Wl,--end-group -ldl -lpthread -lrt
mold: fatal: unknown command line option: --thinlto-cache-dir=thinlto-cache
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[2045/50333] ACTION //chrome/common:available_offline_content_mojom_shared__generator(//build/toolchain/linux/unbundle:default)
ninja: build stopped: subcommand failed.
@monarc99 You need to remove the thinlto cache lines in //chromium/src/build/config/compiler/BUILD.gn Search for these lines in that file and add a # in front to comment it out. Lines grouped together are right under each other.
cache_policy = "cache_size=10%:cache_size_bytes=40g:cache_size_files=100000"
"/lldltocache:" + rebase_path("$root_out_dir/thinlto-cache", root_build_dir), "/lldltocachepolicy:$cache_policy",
[ "-Wl,--thinlto-cache-dir=" + rebase_path("$root_out_dir/thinlto-cache", root_build_dir) ]
ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
Now mold should be able to handle --thinlto-cache-dir=thinlto-cache
with the above patch.
Reported the issue to GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105305
Meanwhile, the chromium
developers have clearly committed themselves to not support building chromium
with mold
: https://bugs.chromium.org/p/chromium/issues/detail?id=1280356#c1
Apparently as a consequence, they are now blocking mold
as with the latest (as of today) chromium
development version 104.0.5099.0, it is not possible to get a working flatc
binary anymore. Flatc
is compiled during the chromium
build process from bundled sources.
With -fuse-ld=mold
, I get a non-working flatc
binary:
flatc: malloc.c:4302: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
Thus, all flatc
calls during the build process fail, and chromium
cannot be built.
Cross-checked: When I set -fuse-ld=ld.lld
, flatc
does not throw such errors.
@DAC324 Thanks, let me take a look. What is your gn args?
I am building in an Arch-like manner with a PKGBUILD
file.
gn
is called like below:
LC_ALL=C buildtools/linux64/gn gen out/Release -v --args="${_flags[*]}" --script-executable=/usr/bin/python
Where the _flags
are like this:
_flags=(
'angle_enable_abseil=false'
'use_sysroot=false'
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
'host_toolchain="//build/toolchain/linux/unbundle:default"'
'is_debug=false'
'is_official_build=false'
'is_component_build=true' # must be false for official build
'enable_widevine=false'
'enable_hangout_services_extension=false'
"ffmpeg_branding=\"ChromeOS\""
"google_api_key=\"${_google_api_key}\""
"google_default_client_id=\"${_google_default_client_id}\""
"google_default_client_secret=\"${_google_default_client_secret}\""
'disable_fieldtrial_testing_config=false'
'blink_enable_generated_code_formatting=false'
'blink_symbol_level=0'
'enable_iterator_debugging=false'
# Ungoogling
'enable_mdns=false'
#'enable_one_click_signin=false'
'enable_reading_list=false'
'enable_remoting=false'
'enable_reporting=false'
'enable_service_discovery=false'
'enable_swiftshader=false'
'use_aura=true'
'use_gtk=true'
'gtk_version=3'
'link_pulseaudio=true'
'treat_warnings_as_errors=false'
'enable_nacl=false'
'use_custom_libcxx=false' # use true if you want use bundled RE2
'use_vaapi=true'
'proprietary_codecs=true' # prerequisite for the following lines
'enable_platform_hevc=true'
'enable_platform_ac3_eac3_audio=true'
'enable_platform_mpeg_h_audio=true'
'enable_platform_dolby_vision=true'
'enable_mse_mpeg2ts_stream_parser=true'
'clang_use_chrome_plugins=true'
'use_gold=false'
'use_dbus=true'
'use_thin_lto=false' # must be true for official build
'enable_pseudolocales=false'
'enable_platform_hevc=true'
'dcheck_always_on=false'
'dcheck_is_configurable=false'
'use_system_harfbuzz=true'
'use_system_freetype=true'
'use_system_lcms2=true'
'use_system_libdrm=true'
'use_system_libjpeg=true'
'use_system_minigbm=true'
'use_system_libpng=true'
# 'use_system_libsync=true' # not included in Arch
'use_system_libopenjpeg2=true'
'use_xkbcommon = true'
'use_dawn=true'
'build_dawn_tests=false'
# WebRTC stuff
'rtc_use_h264=true'
# Don't use bundled sources (not possible)
#'rtc_build_json=false' #not possible as there are dependencies
'rtc_build_libevent=false'
# 'rtc_build_libvpx=false'
# 'rtc_build_opus=false'
# 'rtc_build_ssl=false' #not possible(prevented by an assert)
)
With mold
1.3.0 from Git, compiling chromium
works again.
What you will have to do is (in a PKGBUILD
derived from https://aur.archlinux.org/packages/chromium-dev):
# use mold as linker which is much faster
ln -sf /usr/bin/mold ${_clang_path}/mold
_lld="mold"
And the next round goes on :(
As already described, Chromium developers do not like mold
. So from time to time, they implement "features" to let it fail with the latest sources.
Here's a recent one:
/usr/bin/python "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome_crashpad_handler" -- /opt/.cache/yay/chromium-dev/src/chromium-105.0.5153.0/third_party/llvm-build/Release+Asserts/bin/clang++ -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-105.0.5153.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -pie -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./chrome_crashpad_handler" -Wl,--start-group @"./chrome_crashpad_handler.rsp" ./libbase.so ./libabsl.so ./libboringssl.so ./libperfetto.so ./libchrome_zlib.so ./libprotobuf_lite.so -Wl,--end-group -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lglib-2.0 -lgobject-2.0 -lgthread-2.0
FAILED: chrome_crashpad_handler
/usr/bin/python "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome_crashpad_handler" -- /opt/.cache/yay/chromium-dev/src/chromium-105.0.5153.0/third_party/llvm-build/Release+Asserts/bin/clang++ -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-105.0.5153.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -pie -Wl,--disable-new-dtags -Wl,-rpath=\$ORIGIN -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./chrome_crashpad_handler" -Wl,--start-group @"./chrome_crashpad_handler.rsp" ./libbase.so ./libabsl.so ./libboringssl.so ./libperfetto.so ./libchrome_zlib.so ./libprotobuf_lite.so -Wl,--end-group -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lglib-2.0 -lgobject-2.0 -lgthread-2.0
mold: error: undefined symbol: pcre_config
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: pcre_study
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: icu_71::TimeZone::getGMT()
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::Calendar::set(int, int, int, int, int, int)
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_dfa_exec
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: event_base_loopbreak
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::UMemory::operator new(unsigned long)
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::Calendar::setTimeInMillis(double, UErrorCode&)
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_exec
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: icu_71::Calendar::set(UCalendarDateFields, int)
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_get_stringnumber
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: icu_71::Calendar::getTimeInMillis(UErrorCode&) const
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_fullinfo
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: icu_71::GregorianCalendar::GregorianCalendar(icu_71::Locale const&, UErrorCode&)
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::Calendar::get(UCalendarDateFields, UErrorCode&) const
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::Calendar::setLenient(signed char)
>>> referenced by libbase.so
mold: error: undefined symbol: event_add
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_get_stringtable_entries
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: icu_71::GregorianCalendar::GregorianCalendar(icu_71::TimeZone const&, icu_71::Locale const&, UErrorCode&)
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_compile2
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: event_base_set
>>> referenced by libbase.so
mold: error: undefined symbol: event_del
>>> referenced by libbase.so
mold: error: undefined symbol: event_base_loop
>>> referenced by libbase.so
mold: error: undefined symbol: event_set
>>> referenced by libbase.so
mold: error: undefined symbol: event_base_new
>>> referenced by libbase.so
mold: error: undefined symbol: pcre_free
>>> referenced by /usr/lib64/libglib-2.0.so
mold: error: undefined symbol: event_get_fd
>>> referenced by libbase.so
mold: error: undefined symbol: event_base_free
>>> referenced by libbase.so
mold: error: undefined symbol: icu_71::Locale::getUS()
>>> referenced by libbase.so
Update: These unresolved symbol errors seem to have been fixed with mold-1.4.0
.
Cool, thank you for trying the latest version.
As I said, the Chromium developers do not like mold
for reasons unknown to me.
Now that version 1.4.0 does not have that unresolved symbols problem anymore, a new blocker was introduced:
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
I'd think you shouldn't speculate their feelings. That they do not support mold doesn't necessarily mean they dislike it. It's just unsupported.
If you can share me the details of the error, I might be able to fix the issue for you.
Here's the full report:
chromium-dev/src/chromium-106.0.5219.0/third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/blink/renderer/core/core/prefetched_signed_exchange_manager.o.d -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-16-init-572-gdde41c6c-3\" -DCOMPONENT_BUILD -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBLINK_CORE_IMPLEMENTATION=1 -DUSE_V8_CONTEXT_SNAPSHOT -DV8_CONTEXT_SNAPSHOT_FILENAME=\"v8_context_snapshot.bin\" -DV8_USE_EXTERNAL_STARTUP_DATA -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DLIBYUV_DISABLE_NEON -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_WAYLAND_KHR -DBLINK_IMPLEMENTATION=1 -DINSIDE_BLINK -DABSL_CONSUME_DLL -DBORINGSSL_SHARED_LIBRARY -DUSING_SYSTEM_ICU=1 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC -DU_IMPORT=U_EXPORT -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0 -DHAVE_PTHREAD -DPROTOBUF_USE_DLLS -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_BUILTIN_ISAC_FIX=0 -DWEBRTC_USE_BUILTIN_ISAC_FLOAT=1 -DWEBRTC_USE_X11 -DWEBRTC_USE_PIPEWIRE -DWEBRTC_USE_GIO -DLOGGING_INSIDE_WEBRTC -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_HAS_WUFFS_LIBRARY -DSK_VULKAN=1 -DSKIA_DLL -DSKCMS_API=__attribute__\(\(visibility\(\"default\"\)\)\) -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DUSING_V8_SHARED -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_SANDBOXED_POINTERS -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_SHARED_LIBRARY -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DWTF_USE_WEBAUDIO_PFFFT=1 -DUSE_SYSTEM_LIBJPEG -DUSING_V8_BASE_SHARED -DUSING_V8_PLATFORM_SHARED -I../.. -Igen -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -Igen/shim_headers/icui18n_shim -Igen/shim_headers/icuuc_shim -I../../third_party/libyuv/include -I../../third_party/jsoncpp/source/include -Igen/shim_headers/opus_shim -Igen/shim_headers/ffmpeg_shim -Igen/shim_headers/openh264_shim -Igen/shim_headers/libpng_shim -Igen/shim_headers/libwebp_shim -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../third_party/wayland/src/src -I../../third_party/wayland/include/src -I../../third_party/wayland/include/protocol -Igen/shim_headers/re2_shim -I../../third_party/khronos -I../../gpu -Igen/third_party/dawn/include -I../../third_party/dawn/include -Igen/shim_headers/snappy_shim -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ced/src -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -Igen/net/third_party/quiche/src -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../v8/include -Igen/v8/include -I../../third_party/libwebm/source -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/libaom/source/libaom -I../../third_party/crashpad/crashpad -I../../third_party/crashpad/crashpad/compat/linux -I../../third_party/crashpad/crashpad/compat/non_win -I../../third_party/zlib -I../../third_party/iccjpeg -I../../third_party/ots/src/include -Wall -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Wno-deprecated-builtins -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -m64 -msse3 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Xclang -add-plugin -Xclang blink-gc-plugin -Wglobal-constructors -Xclang -plugin-arg-find-bad-constructs -Xclang check-layout-object-methods -O2 -fdata-sections -ffunction-sections -fno-unique-section-names -g0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -Wconversion -Wno-float-conversion -Wno-sign-conversion -Wno-implicit-float-conversion -Wno-implicit-int-conversion -DPROTOBUF_ALLOW_DEPRECATED=1 -I/usr/include/nss -I/usr/include/nspr -Wno-shadow -I/usr/include/libpng16 -I/usr/include/libxml2 -I/usr/include/libxml2 -std=c++17 -Wno-trigraphs -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wno-deprecated-declarations -O3 -pipe -fstack-protector-strong -fno-plt -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -march=x86-64-v2 -mtune=sandybridge -I/usr/include -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -O3 -pipe -fstack-protector-strong -fno-plt -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -march=x86-64-v2 -mtune=sandybridge -I/usr/include -Wp,-U_GLIBCXX_ASSERTIONS -Wno-builtin-macro-redefined -c ../../third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc -o obj/third_party/blink/renderer/core/core/prefetched_signed_exchange_manager.o
PLEASE submit a bug report to https://crbug.com and run tools/clang/scripts/process_crashreports.py (only works inside Google) which will upload a report and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/.cache/yay/chromium-dev/src/chromium-106.0.5219.0/third_party/llvm-build/Release+Asserts/bin/clang++ -Wall -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Wno-deprecated-builtins -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pthread -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -m64 -msse3 -Wno-builtin-macro-redefined -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Xclang -add-plugin -Xclang blink-gc-plugin -Wglobal-constructors -Xclang -plugin-arg-find-bad-constructs -Xclang check-layout-object-methods -O2 -fdata-sections -ffunction-sections -fno-unique-section-names -g0 -Wconversion -Wno-float-conversion -Wno-sign-conversion -Wno-implicit-float-conversion -Wno-implicit-int-conversion -Wno-shadow -std=c++17 -Wno-trigraphs -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wno-deprecated-declarations -O3 -pipe -fstack-protector-strong -fno-plt -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -march=x86-64-v2 -mtune=sandybridge -O3 -pipe -fstack-protector-strong -fno-plt -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -march=x86-64-v2 -mtune=sandybridge -Wno-builtin-macro-redefined -fcolor-diagnostics -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-16-init-572-gdde41c6c-3\" -DCOMPONENT_BUILD -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBLINK_CORE_IMPLEMENTATION=1 -DUSE_V8_CONTEXT_SNAPSHOT -DV8_CONTEXT_SNAPSHOT_FILENAME=\"v8_context_snapshot.bin\" -DV8_USE_EXTERNAL_STARTUP_DATA -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DLIBYUV_DISABLE_NEON -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_WAYLAND_KHR -DBLINK_IMPLEMENTATION=1 -DINSIDE_BLINK -DABSL_CONSUME_DLL -DBORINGSSL_SHARED_LIBRARY -DUSING_SYSTEM_ICU=1 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC -DU_IMPORT=U_EXPORT -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0 -DHAVE_PTHREAD -DPROTOBUF_USE_DLLS -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_BUILTIN_ISAC_FIX=0 -DWEBRTC_USE_BUILTIN_ISAC_FLOAT=1 -DWEBRTC_USE_X11 -DWEBRTC_USE_PIPEWIRE -DWEBRTC_USE_GIO -DLOGGING_INSIDE_WEBRTC -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_HAS_WUFFS_LIBRARY -DSK_VULKAN=1 -DSKIA_DLL -DSKCMS_API=__attribute__((visibility(\"default\"))) -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DUSING_V8_SHARED -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_SANDBOXED_POINTERS -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_SHARED_LIBRARY -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DWTF_USE_WEBAUDIO_PFFFT=1 -DUSE_SYSTEM_LIBJPEG -DUSING_V8_BASE_SHARED -DUSING_V8_PLATFORM_SHARED -I../.. -Igen -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -Igen/shim_headers/icui18n_shim -Igen/shim_headers/icuuc_shim -I../../third_party/libyuv/include -I../../third_party/jsoncpp/source/include -Igen/shim_headers/opus_shim -Igen/shim_headers/ffmpeg_shim -Igen/shim_headers/openh264_shim -Igen/shim_headers/libpng_shim -Igen/shim_headers/libwebp_shim -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../third_party/wayland/src/src -I../../third_party/wayland/include/src -I../../third_party/wayland/include/protocol -Igen/shim_headers/re2_shim -I../../third_party/khronos -I../../gpu -Igen/third_party/dawn/include -I../../third_party/dawn/include -Igen/shim_headers/snappy_shim -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ced/src -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -Igen/net/third_party/quiche/src -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../v8/include -Igen/v8/include -I../../third_party/libwebm/source -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/libaom/source/libaom -I../../third_party/crashpad/crashpad -I../../third_party/crashpad/crashpad/compat/linux -I../../third_party/crashpad/crashpad/compat/non_win -I../../third_party/zlib -I../../third_party/iccjpeg -I../../third_party/ots/src/include -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -DPROTOBUF_ALLOW_DEPRECATED=1 -I/usr/include/nss -I/usr/include/nspr -I/usr/include/libpng16 -I/usr/include/libxml2 -I/usr/include/libxml2 -D_FORTIFY_SOURCE=2 -I/usr/include -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -D_FORTIFY_SOURCE=2 -I/usr/include -Wp,-U_GLIBCXX_ASSERTIONS -c -MMD -MF obj/third_party/blink/renderer/core/core/prefetched_signed_exchange_manager.o.d -fcolor-diagnostics -o obj/third_party/blink/renderer/core/core/prefetched_signed_exchange_manager.o ../../third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc
1. <eof> parser at end of file
#0 0x000055d80db2c89f (/opt/.cache/yay/chromium-dev/src/chromium-106.0.5219.0/third_party/llvm-build/Release+Asserts/bin/clang+++0x39e589f)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 16.0.0 (https://github.com/llvm/llvm-project/ dde41c6c560b67165c7ac884815cd50fdce446f8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/.cache/yay/chromium-dev/src/chromium-106.0.5219.0/third_party/llvm-build/Release+Asserts/bin
clang++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: ../../tools/clang/crashreports/prefetched_signed_exchange_manager-5c0390.cpp
clang++: note: diagnostic msg: ../../tools/clang/crashreports/prefetched_signed_exchange_manager-5c0390.sh
clang++: note: diagnostic msg:
********************
Cross checking now if reverting to ld.lld avoids this crash.
Update: Looks like it is not related to mold
as this error occurs with ld.lld
as well :(
Next round:
/usr/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcloud_policy_proto_generated_compile.so" --tocfile="./libcloud_policy_proto_generated_compile.so.TOC" --output="./libcloud_policy_proto_generated_compile.so" -- /opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libcloud_policy_proto_generated_compile.so" -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,-rpath=\$ORIGIN -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./libcloud_policy_proto_generated_compile.so" @"./libcloud_policy_proto_generated_compile.so.rsp"
FAILED: libcloud_policy_proto_generated_compile.so libcloud_policy_proto_generated_compile.so.TOC
/usr/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libcloud_policy_proto_generated_compile.so" --tocfile="./libcloud_policy_proto_generated_compile.so.TOC" --output="./libcloud_policy_proto_generated_compile.so" -- /opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libcloud_policy_proto_generated_compile.so" -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,-rpath=\$ORIGIN -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./libcloud_policy_proto_generated_compile.so" @"./libcloud_policy_proto_generated_compile.so.rsp"
mold: error: undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned long, std::type_info const*)
>>> referenced by policy_common_definitions.pb.cc
>>> obj/components/policy/proto/libpolicy_common_definitions_compile_proto.a(obj/components/policy/proto/policy_common_definitions_compile_proto/policy_common_definitions.pb.o):(enterprise_management::StringList::_InternalParse(char const*, google::protobuf::internal::ParseContext*))>>> referenced by cloud_policy.pb.cc
>>> obj/components/policy/cloud_policy_proto_generated_compile_proto/cloud_policy.pb.o:(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::protobuf::internal::InternalMetadata::mutable_unknown_fields_slow<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >())>>> referenced by policy_common_definitions.pb.cc
>>> obj/components/policy/proto/libpolicy_common_definitions_compile_proto.a(obj/components/policy/proto/policy_common_definitions_compile_proto/policy_common_definitions.pb.o):(void google::protobuf::internal::RepeatedPtrFieldBase::MergeFromInnerLoop<google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::TypeHandler>(void**, void**, int, int))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[4/32933] /usr/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libbase.so" --tocfile="./libbase.so.TOC" --output="./libbase.so" -- /opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libbase.so" -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,-rpath=\$ORIGIN -Wl,-O2 -Wl,--gc-sections -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./libbase.so" @"./libbase.so.rsp"
FAILED: libbase.so libbase.so.TOC
/usr/bin/python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libbase.so" --tocfile="./libbase.so.TOC" --output="./libbase.so" -- /opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libbase.so" -fuse-ld=/opt/.cache/yay/chromium-dev/src/chromium-108.0.5317.0/third_party/llvm-build/Release+Asserts/bin/mold -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,-rpath=\$ORIGIN -Wl,-O2 -Wl,--gc-sections -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o "./libbase.so" @"./libbase.so.rsp"
mold: error: undefined symbol: protozero::MessageHandleBase::MessageHandleBase(protozero::Message*)
>>> referenced by logging.cc
>>> obj/base/base/logging.o:(void trace_event_internal::AddTypedTraceEvent<logging::LogMessage::~LogMessage()::$_0>(char, unsigned char const*, perfetto::StaticString, logging::LogMessage::~LogMessage()::$_0&&))>>> referenced by memory_pressure_listener.cc
>>> obj/base/base/memory_pressure_listener.o:(base::MemoryPressureListener::Notify(base::MemoryPressureListener::MemoryPressureLevel))>>> referenced by memory_pressure_listener.cc
>>> obj/base/base/memory_pressure_listener.o:(base::MemoryPressureListener::Notify(base::MemoryPressureListener::MemoryPressureLevel))>>> referenced 28 more times
mold: error: undefined symbol: perfetto::base::TaskRunner::~TaskRunner()
>>> referenced by perfetto_task_runner.cc
>>> obj/base/base/perfetto_task_runner.o:(base::tracing::PerfettoTaskRunner::~PerfettoTaskRunner())
mold: error: undefined symbol: perfetto::Platform::~Platform()
>>> referenced by perfetto_platform.cc
>>> obj/base/base/perfetto_platform.o:(base::tracing::PerfettoPlatform::~PerfettoPlatform())
mold: error: undefined symbol: perfetto::TracedValue::~TracedValue()
>>> referenced by file.cc
>>> obj/base/base/file.o:(base::File::WriteIntoTrace(perfetto::TracedValue) const)>>> referenced by file_path.cc
>>> obj/base/base/file_path.o:(base::FilePath::WriteIntoTrace(perfetto::TracedValue) const)>>> referenced by location.cc
>>> obj/base/base/location.o:(base::Location::WriteIntoTrace(perfetto::TracedValue) const)>>> referenced 11 more times
mold: error: undefined symbol: perfetto::TracedDictionary::AddItem(perfetto::DynamicString)
>>> referenced by values.cc
>>> obj/base/base/values.o:(base::Value::Dict::WriteIntoTrace(perfetto::TracedValue) const)
mold: error: undefined symbol: protozero::ScatteredStreamWriter::~ScatteredStreamWriter()
>>> referenced by user_metrics.cc
>>> obj/base/base/user_metrics.o:(base::trace_event::TraceEventHandle trace_event_internal::AddTraceEvent<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(char, unsigned char const*, char const*, char const*, unsigned long, unsigned int, unsigned long, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))>>> referenced by stack_sampling_profiler.cc
>>> obj/base/base/stack_sampling_profiler.o:(base::trace_event::TraceEventHandle trace_event_internal::AddTraceEvent<int&>(char, unsigned char const*, char const*, char const*, unsigned long, unsigned int, unsigned long, char const*, int&))>>> referenced by trace_arguments.cc
>>> obj/base/base/trace_arguments.o:(base::trace_event::TraceArguments::operator=(base::trace_event::TraceArguments&&))>>> referenced 7 more times
mold: error: undefined symbol: perfetto::Platform::Shutdown()
>>> referenced by perfetto_platform.cc
>>> obj/base/base/perfetto_platform.o
mold: error: undefined symbol: perfetto::internal::BaseTrackEventInternedDataIndex::~BaseTrackEventInternedDataIndex()
>>> referenced by logging.cc
>>> obj/base/base/logging.o:(base::trace_event::InternedSourceLocation::~InternedSourceLocation())>>> referenced by logging.cc
>>> obj/base/base/logging.o:(perfetto::TrackEventInternedDataIndex<base::trace_event::InternedSourceLocation, 4ul, base::trace_event::TraceSourceLocation, perfetto::BigInternedDataTraits>::~TrackEventInternedDataIndex())>>> referenced by logging.cc
>>> obj/base/base/logging.o:(perfetto::TrackEventInternedDataIndex<base::trace_event::InternedLogMessage, 20ul, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, perfetto::BigInternedDataTraits>::~TrackEventInternedDataIndex())>>> referenced 11 more times
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
I'm using gentoo and following the guide to just add -fuse-ld=mold -Wl,-O1 -Wl,--as-needed
to my LDFLAGS the build fails because mold gets invoked with an unknown -m argument:
FAILED: bytecode_builtins_list_generator
python3.10 "../../build/toolchain/gcc_link_wrapper.py" --output="./bytecode_builtins_list_generator" -- x86_64-pc-linux-gnu-clang++ -pie -fuse-ld=lld -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -flto=thin -Wl,--thinlto-jobs=all -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -Wl,-mllvm,-import-instr-limit=30 -fwhole-program-vtables -Wl,--no-call-graph-profile-sort -no-canonical-prefixes -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,--lto-O0 -pie -Wl,--disable-new-dtags -fuse-ld=mold -Wl,-O1 -Wl,--as-needed -o "./bytecode_builtins_list_generator" -Wl,--start-group @"./bytecode_builtins_list_generator.rsp" -Wl,--end-group -latomic -ldl -lpthread -lrt
mold: fatal: unknown -m argument: llvm
x86_64-pc-linux-gnu-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
-mllvm
is an clang/lld specific flag. Maybe they have hard-coded that flag to the Chromium build script, unfortunately.
ok, with this patch it almost works on 119.0.6045.199
--- ./build/config/compiler/compiler.gni.orig
+++ ./build/config/compiler/compiler.gni
@@ -37,6 +37,9 @@
# The default linker everywhere else.
use_lld = is_clang && current_os != "zos"
+ # enable together with use_lld
+ use_mold = false
+
# If true, optimize for size.
# Default to favoring speed over size for platforms not listed below.
optimize_for_size = !is_high_end_android && (is_android || is_castos)
--- ./build/config/compiler/pgo/BUILD.gn.orig
+++ ./build/config/compiler/pgo/BUILD.gn
@@ -143,13 +143,8 @@
if (is_win) {
ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ]
} else {
- ldflags = [ "-Wl,-mllvm,-enable-ext-tsp-block-placement=1" ]
}
} else {
- cflags += [
- "-mllvm",
- "-enable-ext-tsp-block-placement=1",
- ]
}
}
}
--- ./build/config/compiler/BUILD.gn.orig
+++ ./build/config/compiler/BUILD.gn
@@ -384,7 +384,9 @@
}
}
- if (use_lld) {
+ if (use_mold) {
+ ldflags += [ "-fuse-ld=mold" ]
+ } else if (use_lld) {
ldflags += [ "-fuse-ld=lld" ]
if (lld_path != "") {
ldflags += [ "-B$lld_path" ]
@@ -601,7 +603,6 @@
if (is_win) {
ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ]
} else {
- ldflags += [ "-Wl,-mllvm,-instcombine-lower-dbg-declare=0" ]
}
}
@@ -717,7 +714,6 @@
# binary size than the default setting of 100.
# TODO(gbiv): We ideally shouldn't need to specify this; ThinLTO
# should be able to better manage binary size increases on its own.
- import_instr_limit = 30
if (is_win) {
ldflags += [
@@ -726,7 +722,6 @@
"/lldltocache:" +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"/lldltocachepolicy:$cache_policy",
- "-mllvm:-disable-auto-upgrade-debug-info",
]
} else {
ldflags += [ "-flto=thin" ]
@@ -766,14 +761,11 @@
import_instr_limit = 5
}
- ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ]
-
if (!is_chromeos) {
# TODO(https://crbug.com/972449): turn on for ChromeOS when that
# toolchain has this flag.
# We only use one version of LLVM within a build so there's no need to
# upgrade debug info, which can be expensive since it runs the verifier.
- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ]
}
}
@@ -893,7 +885,6 @@
is_android && host_os == "linux",
"MLGO is currently only supported for targeting Android on a linux host")
if (use_thin_lto) {
- ldflags += [ "-Wl,-mllvm,-enable-ml-inliner=release" ]
}
}
@@ -1438,7 +1429,6 @@
# This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348
# has been resolved, and -mno-outline is obeyed by the linker during
# ThinLTO.
- ldflags += [ "-Wl,-mllvm,-enable-machine-outliner=never" ]
}
asmflags = cflags
with the last issue being:
ninja: job failed: "python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./chromedriver.unstripped" -- clang++ -fuse-ld=mold -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -flto=thin -Wl,--thinlto-jobs=all -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -fwhole-program-vtables -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -Wl,-z,defs -Wl,--as-needed -Wl,--lto-O0 -pie -Wl,--disable-new-dtags -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs -o "./chromedriver.unstripped" -Wl,--start-group @"./chromedriver.unstripped.rsp" -Wl,--end-group -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lintl -ljsoncpp -licui18n -licuuc -licudata -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lz -levent -lresolv -lgio-2.0 -ljpeg -lopus -lavcodec -lavformat -lavutil -ldav1d -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lpipewire-0.3 -lgbm -lEGL -ldrm -lminizip -lfontconfig -lexpat -lwebp -lwebpdemux -lwebpmux -lfreetype -lharfbuzz-subset -lharfbuzz -lxcb -lxkbcommon -ldbus-1
mold: fatal: cannot open obj/services/tracing/public/cpp/cpp/posix_system_producer.o: No file descriptors available
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: subcommand failed
Sounds like you need ulimit -n unlimited
or even adjust the hard limit in /etc/security/limits.conf
if the former is not sufficient.
I've adjust limits very big values, but I still get 'Too many open files' error :( Seems that it's another reason...
Another potential knob to tune is /proc/sys/fs/file-max
in case your distro's default might be like 65k.
I have the same problem Too many open files
. My ulimit -Hn
, ulimit -Sn
and /proc/sys/fs/nr_open
are 1073741816
, /proc/sys/fs/file-max
is 9223372036854775807
, are they not big enough?
I think this could be a bug.
Are you using fuse or some special filesystem?
I'm using ext4.
No fuse or some other overlay filesystem on top of ext4? The issue here is that we close a file descriptor immediately after we open a file and mmap it to memory. mmap'ed file is not usually counted towards the number of opened files. Therefore, "too many open files" error should not usually occur for mold.
However, if there's something in your system that intercepts file operations and keep file descriptors open as long as their corresponding files are kept mmap'ed, that's not the case. Some overlay filesystem does that and can cause "too many open files" error.
I am running on native hardware PC (Laptop) under Gentoo, should no fuse or some other overlay filesystem.
Edit: Finally find the reason:
chromium_compile() {
# Final link uses lots of file descriptors.
ulimit -n 2048
not enough for mold.
Building chromium with mold causes a mksnapshot
segfault:
[1920/1920] ACTION //v8:run_mksnapshot_default(//build/toolchain/linux/unbundle:default)
ninja: job failed: python3 ../../v8/tools/run.py ./mksnapshot --turbo_instruction_scheduling --stress-turbo-late-spilling --target_os=linux --target_arch=x64 --embedded_src gen/v8/embedded.S --embedded_variant Default --random-seed 314159265 --startup_blob snapshot_blob.bin --no-native-code-counters
Return code is -11
ninja: subcommand failed
@apprehensions I couldn't reproduce the issue. What is your mold version? I tested it with mold 2.31.0.
I am using the same mold version. I am also using musl, which could be the issue.
Ah, maybe. What is your distro and version?
KISS Linux Community
Hello, Im working on a chromium fork called Thorium > https://github.com/Alex313031/Thorium and would like to test using mold instead of lld during linking of the .so files and executables. How would I do this? I know this was one of the inspirations of the creator when making mold. Do I need to install or build/install mold first, or is it included in a chromium checkout? Can I just modify the main BUILD.gn to use LDFLAGS+= [ "-fuse-ld=mold", ]?