-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLD segfault in SymbolTableSection<ELFT>::writeTo #79944
Comments
@llvm/issue-subscribers-lld-elf Author: Levi Zim (kxxt)
Hi, I encountered a segfault in lld when cross-compiling chromium from x86_64 host to riscv64.
Initially I used Later I tried The failing command is "python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- ~/Workspaces/llvm/llvm-project/build-debug/bin/clang++ -Wl,--version-script=../../build/linux/chrome.map -Werror -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 -Wl,-mllvm,-instcombine-lower-dbg-declare=0 -Wl,-mllvm,-split-threshold-for-reg-with-hint=0 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -flto=thin -Wl,--thinlto-jobs=all -Wl,-mllvm,-import-instr-limit=30 -Wl,-mllvm,-disable-auto-upgrade-debug-info -fwhole-program-vtables -Wl,--undefined-version -Wl,--no-call-graph-profile-sort --target=riscv64-linux-gnu -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -Wl,--gdb-index -Wl,-z,defs -Wl,--as-needed -nostdlib++ --sysroot=../../build/linux/debian_sid_riscv64-sysroot -rdynamic -pie -Wl,--disable-new-dtags -Wl,--lto-O2 -L../../build/linux/debian_sid_riscv64-sysroot/usr/lib/riscv64-linux-gnu -o "./chrome" -Wl,--start-group @"./chrome.rsp" -Wl,--end-group ../../third_party/llvm-build/Release+Asserts/lib/clang/18/lib/riscv64-unknown-linux-gnu/libclang_rt.builtins.a -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -ldbus-1 -latk-1.0 -latk-bridge-2.0 -lcups -lgio-2.0 -latspi -lresolv -lexpat -luuid -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lgbm -lEGL -ldrm -lxcb -lxkbcommon -lXi -lpci -lffi_pic -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lasound -lm -lz -lxshmfence -lstdc++ obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libstd_std.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/liballoc_alloc.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libcompiler_builtins_compiler_builtins.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/librustc_std_workspace_core_rustc_std_workspace_core.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libcore_core.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libprofiler_builtins_profiler_builtins.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libcfg_if_cfg_if.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libhashbrown_hashbrown.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/librustc_std_workspace_alloc_rustc_std_workspace_alloc.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/liblibc_libc.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libpanic_abort_panic_abort.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libpanic_unwind_panic_unwind.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libunwind_unwind.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/librustc_demangle_rustc_demangle.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libstd_detect_std_detect.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libaddr2line_addr2line.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libgimli_gimli.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libminiz_oxide_miniz_oxide.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libadler_adler.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libobject_object.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libmemchr_memchr.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libgetopts_getopts.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/librustc_std_workspace_std_rustc_std_workspace_std.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libunicode_width_unicode_width.rlib local_rustc_sysroot/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/libtest_test.rlib obj/skia/libskia_cbridge_urust_uside.rlib obj/third_party/rust/font_types/v0_4/lib/libfont_types_lib.rlib obj/third_party/rust/read_fonts/v0_15/lib/libread_fonts_lib.rlib obj/third_party/rust/skrifa/v0_15/lib/libskrifa_lib.rlib obj/build/rust/chromium_prelude/libchromium.rlib obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib obj/third_party/rust/qr_code/v2/lib/libqr_code_lib.rlib -Wl,--threads=1
Backtrace (gdb) bt full
#<!-- -->0 0x00005e038d28cf99 in llvm::support::endian::write<unsigned int, 1ul> (memory=0x753da8106000, value=0, endian=llvm::endianness::little) at /home/kxxt/Workspaces/llvm/llvm-project/llvm/include/llvm/Support/Endian.h:93
No locals.
#<!-- -->1 0x00005e038d28d0e6 in llvm::support::endian::write<unsigned int, (llvm::endianness)1, 1ul> (memory=0x753da8106000, value=0) at /home/kxxt/Workspaces/llvm/llvm-project/llvm/include/llvm/Support/Endian.h:102
No locals.
#<!-- -->2 0x00005e038d28d0be in llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::endianness)1, 1ul, 1ul>::operator= (this=0x753da8106000, newValue=0)
at /home/kxxt/Workspaces/llvm/llvm-project/llvm/include/llvm/Support/Endian.h:216
No locals.
#<!-- -->3 0x00005e038d5ddd82 in lld::elf::SymbolTableSection<llvm::object::ELFType<(llvm::endianness)1, true> >::writeTo (this=0x5e043405bdb0, buf=0x753d62030170 "\001")
at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/SyntheticSections.cpp:2230
sym = 0x5e05b30872d0
isDefinedHere = true
ent = @<!-- -->0x753dd6cc7470: {sym = 0x5e05b30872d0, strTabOffset = 0}
__for_range = @<!-- -->0x5e043405be58: {<llvm::SmallVectorImpl<lld::elf::SymbolTableEntry>> = {<llvm::SmallVectorTemplateBase<lld::elf::SymbolTableEntry, true>> = {<llvm::SmallVectorTemplateCommon<lld::elf::SymbolTableEntry, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x753da818e010, Size = 223895855, Capacity = 268435455}, <No data fields>},
static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<lld::elf::SymbolTableEntry, 0>> = {<No data fields>}, <No data fields>}
__for_begin = 0x753dd6cc7470
__for_end = 0x753e7d9ef300
eSym = 0x753da8106000
#<!-- -->4 0x00005e038d56dcd1 in lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda(unsigned long, unsigned long)#<!-- -->1}::operator()(unsigned long, unsigned long) const (__closure=0x5e0942f41c70, begin=0, end=1) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/OutputSections.cpp:497
s = 0x5e043405bdb0
isec = 0x5e043405bdb8
i = 0
numSections = 1
filler = {_M_elems = "\000\000\000"}
nonZeroFiller = false
this = 0x5e043040b148
buf = 0x753d62030158 ""
sections = {Data = 0x5e0468d04240, Length = 1}
__PRETTY_FUNCTION__ = "lld::elf::OutputSection::writeTo<llvm::object::ELFType<llvm::endianness::little, true> >(uint8_t*, llvm::parallel::TaskGroup&)::<lambda(size_t, size_t)>"
#<!-- -->5 0x00005e038d56defb in lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}::operator()() const (__closure=0x5e0942f41c70)
at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/OutputSections.cpp:547
i = 1
begin = 0
fn = {__sections = {Data = 0x5e0468d04240, Length = 1}, __buf = 0x753d62030158 "", __this = 0x5e043040b148, __nonZeroFiller = false, __filler = {_M_elems = "\000\000\000"}}
#<!-- -->6 0x00005e038d576d16 in std::__invoke_impl<void, lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}&>(std::__invoke_other, lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}&) (__f=...) at /usr/include/c++/13.2.1/bits/invoke.h:61
No locals.
#<!-- -->7 0x00005e038d57444e in std::__invoke_r<void, lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}&>(lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}&) (__fn=...) at /usr/include/c++/13.2.1/bits/invoke.h:111
No locals.
#<!-- -->8 0x00005e038d5729d5 in std::_Function_handler<void (), lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> >(unsigned char*, llvm::parallel::TaskGroup&)::{lambda()#<!-- -->1}>::_M_invoke(std::_Any_data const&)
(__functor=...) at /usr/include/c++/13.2.1/bits/std_function.h:290
No locals.
#<!-- -->9 0x00005e038d29eba8 in std::function<void ()>::operator()() const (this=0x7ffde3a5fdc0) at /usr/include/c++/13.2.1/bits/std_function.h:591
No locals.
#<!-- -->10 0x00005e0392ffa47d in llvm::parallel::TaskGroup::spawn(std::function<void ()>, bool) (this=0x7ffde3a5ff10, F=..., Sequential=false) at /home/kxxt/Workspaces/llvm/llvm-project/llvm/lib/Support/Parallel.cpp:221
No locals.
#<!-- -->11 0x00005e038d569179 in lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true> > (this=0x5e043040b148, buf=0x753d62030158 "", tg=...)
at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/OutputSections.cpp:547
done = true
begin = 0
i = 1
taskSize = 1078533248
--Type <RET> for more, q to quit, c to continue without paging--c
timeScope = {<No data fields>}
sections = {Data = 0x5e0468d04240, Length = 1}
filler = {_M_elems = "\000\000\000"}
nonZeroFiller = false
fn = {__sections = {Data = 0x5e0468d04240, Length = 1}, __buf = 0x753d62030158 "", __this = 0x5e043040b148, __nonZeroFiller = false, __filler = {_M_elems = "\000\000\000"}}
written = false
numSections = 1
taskSizeLimit = 4194304
#<!-- -->12 0x00005e038d669595 in (anonymous namespace)::Writer<llvm::object::ELFType<(llvm::endianness)1, true> >::writeSections (this=0x7ffde3a60150) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Writer.cpp:3031
sec = 0x5e043040b148
__for_range = @<!-- -->0x5e0399805c60: {<llvm::SmallVectorImpl<lld::elf::OutputSection*>> = {<llvm::SmallVectorTemplateBase<lld::elf::OutputSection*, true>> = {<llvm::SmallVectorTemplateCommon<lld::elf::OutputSection*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x5e046412f640, Size = 48, Capacity = 63}, <No data fields>},
static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<lld::elf::OutputSection*, 0>> = {<No data fields>}, <No data fields>}
__for_begin = 0x5e046412f7a8
__for_end = 0x5e046412f7c0
tg = {L = {Count = 0, Mutex = {<std::__mutex_base> = {_M_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}},
__size = '\000' <repeats 39 times>, __align = 0}}, <No data fields>}, Cond = {_M_cond = {_M_cond = {__data = {__wseq = {__value64 = 0, __value32 = {__low = 0, __high = 0}}, __g1_start = {__value64 = 0, __value32 = {
__low = 0, __high = 0}}, __g_refs = {0, 0}, __g_size = {0, 0}, __g1_orig_size = 0, __wrefs = 0, __g_signals = {0, 0}}, __size = '\000' <repeats 47 times>, __align = 0}}}}, Parallel = false}
timeScope = {<No data fields>}
#<!-- -->13 0x00005e038d65abf9 in (anonymous namespace)::Writer<llvm::object::ELFType<(llvm::endianness)1, true> >::run (this=0x7ffde3a60150) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Writer.cpp:653
timeScope = {<No data fields>}
#<!-- -->14 0x00005e038d695871 in lld::elf::writeResult<llvm::object::ELFType<(llvm::endianness)1, true> > () at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Writer.cpp:99
No locals.
#<!-- -->15 0x00005e038d42c905 in lld::elf::LinkerDriver::link (this=0x5e03998057e0 <lld::elf::ctx>, args=...) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Driver.cpp:3051
timeScope = {<No data fields>}
wrapped = std::vector of length 0, capacity 0
skipLinkedOutput = false
numObjsBeforeLTO = 158
newObjectFiles = {Data = 0x5e04e34d0690, Length = 34623}
#<!-- -->16 0x00005e038d41b635 in lld::elf::LinkerDriver::linkerMain (this=0x5e03998057e0 <lld::elf::ctx>, argsArr=...) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Driver.cpp:652
timeScope = {<No data fields>}
parser = {<llvm::opt::GenericOptTable> = {<llvm::opt::OptTable> = {_vptr.OptTable = 0x5e0399363780 <vtable for lld::elf::ELFOptTable+16>, OptionInfos = {Data = 0x5e03993638e0 <optInfo>, Length = 404}, IgnoreCase = false,
GroupedShortOptions = false, DashDashParsing = false, EnvVar = 0x0, InputOptionID = 1, UnknownOptionID = 2, FirstSearchableIndex = 2,
PrefixChars = {<llvm::SmallVector<char, 8>> = {<llvm::SmallVectorImpl<char>> = {<llvm::SmallVectorTemplateBase<char, true>> = {<llvm::SmallVectorTemplateCommon<char, void>> = {<llvm::SmallVectorBase<unsigned long>> = {
BeginX = 0x7ffde3a60650, Size = 1, Capacity = 8}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<char, 8>> = {
InlineElts = "-\006\246\343\375\177\000"}, <No data fields>}, <No data fields>}},
PrefixesUnionBuffer = {<llvm::SmallVectorImpl<llvm::StringLiteral>> = {<llvm::SmallVectorTemplateBase<llvm::StringLiteral, true>> = {<llvm::SmallVectorTemplateCommon<llvm::StringLiteral, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x7ffde3a60668, Size = 2, Capacity = 3}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<llvm::StringLiteral, 3>> = {
InlineElts = "y\217\022\223\003^\000\000\001\000\000\000\000\000\000\000{\217\022\223\003^\000\000\002", '\000' <repeats 15 times>, "\320\006\246\343\375\177\000"}, <No data fields>}}, <No data fields>}
args = {<llvm::opt::ArgList> = {_vptr.ArgList = 0x5e0399380140 <vtable for llvm::opt::InputArgList+16>,
Args = {<llvm::SmallVectorImpl<llvm::opt::Arg*>> = {<llvm::SmallVectorTemplateBase<llvm::opt::Arg*, true>> = {<llvm::SmallVectorTemplateCommon<llvm::opt::Arg*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {
BeginX = 0x754d62260010, Size = 14274, Capacity = 17407}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<llvm::opt::Arg*, 16>> = {
InlineElts = "\300]\023\233\003^\000\000\000\000\000\000\000\000\000\000\360\006\246\343\375\177\000\000\000\a\246\343\375\177\000\000\367&F\215\003^\000\000@<!-- -->_\200\231\003^\000\000p\304\023\233\003^", '\000' <repeats 18 times>, "@\a\246\343\375\177", '\000' <repeats 18 times>, "@<!-- -->_\200\231\003^\000\000@\a\246\343\375\177\000\000\324\031F\215\003^\000\000@<!-- -->_\200\231\003^\000"}, <No data fields>},
OptRanges = {<llvm::DenseMapBase<llvm::DenseMap<unsigned int, std::pair<unsigned int, unsigned int>, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, std::pair<unsigned int, unsigned int> > >, unsigned int, std::pair<unsigned int, unsigned int>, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, std::pair<unsigned int, unsigned int> > >> = {<llvm::DebugEpochBase> = {
Epoch = 2}, <No data fields>}, Buckets = 0x5e039b13bc50, NumEntries = 35, NumTombstones = 0, NumBuckets = 64}},
ArgStrings = {<llvm::SmallVectorImpl<char const*>> = {<llvm::SmallVectorTemplateBase<char const*, true>> = {<llvm::SmallVectorTemplateCommon<char const*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {
BeginX = 0x754d61ac9010, Size = 14293, Capacity = 28571}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<char const*, 16>> = {
InlineElts = "\274%\246\343\375\177\000\000\260\a\246\343\375\177\000\000,CE\215\003^\000\000\001\000\000\000\000\000\000\000\330\a\246\343\375\177\000\000\260\303\023\233\003^\000\000\260\303\023\233\003^\000\000\260\303\023\233\003^\000\000\340\a\246\343\375\177\000\000\360\a\246\343\375\177\000\000ҔD\215\003^\000\000\000\000\000\000\000\000\000\000@<!-- -->_\200\231\003^\000\000@<!-- -->_\200\231\003^\000\000p\304\023\233\003^\000\000\260\303\023\233\003^\000"}, <No data fields>}, SynthesizedStrings = std::__cxx11::list = {[0] = "--sysroot", [1] = "--hash-style", [2] = "--discard-locals", [3] = "--version-script", [4] = "--color-diagnostics=", [5] = "--thinlto-cache-policy",
[6] = "--call-graph-profile-sort=", [7] = "--threads"}, NumInputArgStrings = 14285}
#<!-- -->17 0x00005e038d417493 in lld::elf::link (args=..., stdoutOS=..., stderrOS=..., exitEarly=true, disableOutput=false) at /home/kxxt/Workspaces/llvm/llvm-project/lld/ELF/Driver.cpp:162
ctx = 0x5e039b135e20
#<!-- -->18 0x00005e038d29af55 in lld::unsafeLldMain (args=..., stdoutOS=..., stderrOS=..., drivers=..., exitEarly=true) at /home/kxxt/Workspaces/llvm/llvm-project/lld/Common/DriverDispatcher.cpp:163
argsV = {<llvm::SmallVectorImpl<char const*>> = {<llvm::SmallVectorTemplateBase<char const*, true>> = {<llvm::SmallVectorTemplateCommon<char const*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x7ffde3a60f00,
Size = 2, Capacity = 256}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<char const*, 256>> = {
InlineElts = "}%\246\343\375\177\000\000\274%\246\343\375\177\000\0000\223\352aMu\000\000X\223\352aMu", '\000' <repeats 130 times>, "_\205s\227\003^\000\000\a\000\000\000\000\000\000\000g\205s\227\003^\000\000\016\000\000\000\000\000\000\000\000\000\000\361\000\000\000\000"...}, <No data fields>}
d = 0x5e038d417209 <lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool)>
r = 0
#<!-- -->19 0x00005e038d17871c in lld_main (argc=2, argv=0x7ffde3a61a38) at /home/kxxt/Workspaces/llvm/llvm-project/lld/tools/lld/lld.cpp:90
r = 0
args = {Data = 0x7ffde3a61a38, Length = 2}
mainRet = std::optional = {[contained value] = -475653576}
#<!-- -->20 0x00005e038d17b730 in main (argc=2, argv=0x7ffde3a61a38) at /home/kxxt/Workspaces/llvm/llvm-project/build-debug/tools/lld/tools/lld/lld-driver.cpp:17
X = {
Alloc = {<llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096, 128> >> = {<No data fields>}, <llvm::detail::AllocatorHolder<llvm::MallocAllocator>> = {<llvm::MallocAllocator> = {<llvm::AllocatorBase<llvm::MallocAllocator>> = {<No data fields>}, <No data fields>}, <No data fields>}, CurPtr = 0x0, End = 0x0,
Slabs = {<llvm::SmallVectorImpl<void*>> = {<llvm::SmallVectorTemplateBase<void*, true>> = {<llvm::SmallVectorTemplateCommon<void*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x7ffde3a61890, Size = 0,
Capacity = 4}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<void*, 4>> = {
InlineElts = "\340b\242\231\003^\000\000\260\322\r\233\003^\000\000\220\030\246\343\375\177\000\000\260\322\r\233\003^\000"}, <No data fields>},
CustomSizedSlabs = {<llvm::SmallVectorImpl<std::pair<void*, unsigned long> >> = {<llvm::SmallVectorTemplateBase<std::pair<void*, unsigned long>, true>> = {<llvm::SmallVectorTemplateCommon<std::pair<void*, unsigned long>, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x7ffde3a618c0, Size = 0, Capacity = 0}, <No data fields>},
static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<std::pair<void*, unsigned long>, 0>> = {<No data fields>}, <No data fields>}, BytesAllocated = 0, RedZoneSize = 1},
Args = {<llvm::SmallVectorImpl<char const*>> = {<llvm::SmallVectorTemplateBase<char const*, true>> = {<llvm::SmallVectorTemplateCommon<char const*, void>> = {<llvm::SmallVectorBase<unsigned int>> = {BeginX = 0x7ffde3a618e0,
Size = 0, Capacity = 0}, <No data fields>}, static TakesParamByValue = true}, <No data fields>}, <llvm::SmallVectorStorage<char const*, 0>> = {<No data fields>}, <No data fields>}, StackPrinter = std::optional = {
[contained value] = {<llvm::PrettyStackTraceEntry> = {_vptr.PrettyStackTraceEntry = 0x5e039935c010 <vtable for llvm::PrettyStackTraceProgram+16>, NextEntry = 0x0}, ArgC = 2, ArgV = 0x7ffde3a61a38}}}
(gdb) p buf
$19 = (uint8_t *) 0x753d62030170 "\001"
(gdb) p eSym
$20 = (llvm::object::Elf_Sym_Impl<llvm::object::ELFType<(llvm::endianness)1, true> > *) 0x753da8106000
(gdb) p *eSym
Cannot access memory at address 0x753da8106000
I understand that it can't be easily reproduced as cross-compiling chromium to riscv64 requries lots of patches and building chromium takes a lot of time. So please ask me for more information if the above backtrace is not sufficient for tracing down the bug. |
Can you relink the executable using the environment variable |
Yes. The linker haven't finished but the size of the uncompressed tarball is already 21GB. I am uncertain where I could upload it. BTW is there any way to generate a smaller reproduce tarball? |
@MaskRay I have uploaded the zstd compressed reproduce tarball to github: https://github.com/kxxt/lld-79944-reproducer/releases/tag/original . It is |
This issue also occurs when ThinLTO is disabled. With ThinLTO disabled, linking with riscv64-linux-gnu-ld also results in a segfault. So gnu bfd linker might also be affected by the same bug. |
I have the same problem. Have you solved it? |
Nope. |
The link succeeded with the latest lld :) cat repro.tar.zst.aa repro.tar.zst.ab repro.tar.zst.ac | tar -I zstd -x
cd lld-repro
/tmp/Rel/bin/ld.lld @reponse.txt |
I have a similar problem: #100511. Can you help me take a look? |
Yes. I could also confirm it. Cross compiling chromium 126.0.6478.185 for riscv64 using Do you happen to know the commit that fixes this bug? I suspect bfd linker is also affected but haven't checked it on chromium 126.0.6478.185. |
Hi, I encountered a segfault in lld when cross-compiling chromium from x86_64 host to riscv64.
Initially I used
clang version 18.0.0git (https://chromium.googlesource.com/external/github.com/llvm/llvm-project c4146121e940b6b853148c780568dee38b97382f)
.Later I tried
clang version 18.1.0rc (https://github.com/llvm/llvm-project.git bab01aead7d7a34436bc8e1639b90227374f079e)
.The failing command is
Backtrace
I understand that it can't be easily reproduced as cross-compiling chromium to riscv64 requries lots of patches and building chromium takes a lot of time. So please ask me for more information if the above backtrace is not sufficient for tracing down the bug.
The text was updated successfully, but these errors were encountered: