Comments (8)
Thank you very much @nehaljwani for finding the flag to reproduce the issue. I submitted fc4aafa so that at least on my machine, mold is now clean with these extra assertions
from mold.
from mold.
I'm not sure, but to me it looks like mold isn't being linked properly. You probably just have an empty ELF. Please run strip for mold executable and tell what's the resulting size? If it's very small, then likely I'm right.
makepkg
automatically strips binaries as part of the build process:
==> Entering fakeroot environment...
==> Starting package()...
install -Dm 755 mold /home/wmoore/Projects/aur.me/mold/pkg/mold/usr/bin/mold
install -m 755 -d /home/wmoore/Projects/aur.me/mold/pkg/mold/usr/lib/mold
install -m 644 mold-wrapper.so /home/wmoore/Projects/aur.me/mold/pkg/mold/usr/lib/mold
install -Dm 644 docs/mold.1 /home/wmoore/Projects/aur.me/mold/pkg/mold/usr/share/man/man1/mold.1
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Stripping unneeded symbols from binaries and libraries...
-> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "mold"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: mold 0.9.1-1 (Sat 03 Jul 2021 10:30:17)
Confirming binary is non-empty and stripping does not alter the binary (as it's already stripped):
$ strip /usr/bin/mold -o /tmp/mold-stripped
$ ls -l /usr/bin/mold /tmp/mold-stripped
.rwxr-xr-x 1.8M root 3 Jul 10:30 /usr/bin/mold
.rwxr-xr-x 1.8M wmoore 3 Jul 11:28 /tmp/mold-stripped
$ sha256sum /usr/bin/mold /tmp/mold-stripped
a57f51bfe05952d0f8953b1714b3cdf47a650944ea372ce395d3a83b1a25fccc /usr/bin/mold
a57f51bfe05952d0f8953b1714b3cdf47a650944ea372ce395d3a83b1a25fccc /tmp/mold-stripped
ldd
output in case it's useful:
$ ldd /usr/bin/mold
linux-vdso.so.1 (0x00007ffe75ff1000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fd8adb7d000)
libtbb.so.2 => /usr/lib/libtbb.so.2 (0x00007fd8adb37000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007fd8adb1d000)
libmimalloc.so.2.0 => /usr/lib/libmimalloc.so.2.0 (0x00007fd8ada99000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fd8ad883000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fd8ad868000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd8ad845000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fd8ad679000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fd8ae048000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd8ad672000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fd8ad667000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fd8ad523000)
from mold.
Let me run makepkg
in a Docker environment to see if I can reproduce the issue locally. I don't know what that command is exactly doing, but I guess I'd have to investigate the issue by bisecting -- find out differences of plain make
and makepkg
and identify which step causes a break.
from mold.
It looks like it's working for me. Here is the config files I made to build mold with makepkg. https://github.com/rui314/aur/tree/master/mold
from mold.
One can replicate this problem with: make EXTRA_CPPFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
Many modern distributions like Fedora and Arch use this as one of the default flags while building packages.
I found two places where problems were caught. Fix for one is available at #78
The second one is:
/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/span:276: std::span::reference std::span<ElfSym<X86_64>, 18446744073709551615>::operator[](std::span::size_type) const [_Type = ElfSym<X86_64>, _Extent = 18446744073709551615]: Assertion '__idx < size()' failed.
Thread 2.1 "mold" received signal SIGABRT, Aborted.
[Switching to LWP 3204173]
0x00007ffff78aa2a2 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff78aa2a2 in raise () from /lib64/libc.so.6
#1 0x00007ffff78938a4 in abort () from /lib64/libc.so.6
#2 0x000000000041b13d in std::__replacement_assert (__file=<optimized out>, __line=<optimized out>, __line@entry=276, __function=<optimized out>, __condition=<optimized out>)
at /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/x86_64-redhat-linux/bits/c++config.h:2654
#3 0x000000000044e94e in std::span<ElfSym<X86_64>, 18446744073709551615ul>::operator[] (this=<optimized out>, __idx=0) at /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/span:276
#4 Symbol<X86_64>::esym (this=this@entry=0x53cf84f0140) at ./mold.h:1960
#5 0x000000000044dd7c in get_rank<X86_64> (sym=...) at object_file.cc:778
For some reason, at:
Lines 1957 to 1961 in 426a689
sym_idx
is uninitialized for elf-init.oS
which comes from libc_nonshared.a
from mold.
Fantastic detective work @nehaljwani and thanks for fixing one of the issues.
from mold.
Feel free to reopen if it still persists.
from mold.
Related Issues (20)
- do applications with LLVM's polly flag and thilto, and linked with mold still segfault? HOT 14
- Fails to link on alpha: relocation truncated to fit: GPREL16 HOT 4
- mold wrapper issue when building in an armv7l container on a arm64/armv7l host using mold 2.4.0 HOT 5
- `--trace-symbol` flag affects `.symver` HOT 2
- Issues with `.symver` and symbol interpositioning HOT 6
- Is macos supported HOT 3
- Help with --section-order and putting sections at different addresses HOT 11
- Segfault linking llvm-sys HOT 18
- -Bsymbolic-non-weak-functions not a valid flag in mold HOT 1
- Mold does not support `-b binary`
- Test #324: x86_64-version failed with latest mold-git HOT 5
- Unknown command line option HOT 1
- mold refused to link GP-setup code for RISC-V HOT 1
- Adding illumos support HOT 2
- Cross compiling using arm-linux-gnueabihf toolchain does not work with LTO on macOS HOT 1
- LDPT_REGISTER_CLAIM_FILE_HOOK_V2 missing from LTO support HOT 2
- Update the performance comparison in the README, and include the GNU ld (BFD) linker HOT 4
- MOLD removes GCC's offload symbols when linking HOT 5
- Mold installation on RHEL8? HOT 2
- Rust on ppc64le: unknown relocation R_PPC64_DTPREL16_LO_DS HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mold.