Comments (8)
Did you know who created that temporary file?
If you run mold with the environment variable MOLD_DEBUG set to 1, the linker will record the command line given to it in the .comment
section of an output file, which you can see with readelf -p .comment your-executable-file
. You may want to do that to see how that temporary file is passed to the linker.
from mold.
I am pretty certain it is GCC that creates the temporary file. I'll try to verify.
from mold.
The relevant part from the .comment section (I had to remove some details.)
String dump of section '.comment':
[ 0] mold command line: -plugin /usr/libexec/gcc/x86_64-redhat-linux/13/liblto_plugin.so -plugin-opt=/usr/li\
bexec/gcc/x86_64-redhat-linux/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccEfFUxB.res -plugin-opt=-pass-through=-\
lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-op\
t=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu \
-m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o test -z noexecstack -z relro -z n\
ow /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-redhat-linux/13/../../../../li\
b64/crti.o /usr/lib/gcc/x86_64-redhat-linux/13/crtbeginS.o -L/usr/lib/gcc/x86_64-redhat-linux/13 -L/usr/lib/gcc/x86\
_64-redhat-linux/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/13/../\
../.. a.cpp.o b.cpp.o c.cpp.o d.cpp.o lib1.a lib2.a lib3.a -ldl lib4.a e.cpp.o f.cpp.o g.cpp.o h.cpp.o lib5.a lib6.\
a lib7.a -lrt --thread-count=4 -Map=test.map --dependency-file=test.d -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgc\
c_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/13/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crtn.\
o
The temporary file mentioned in the dependency file is test: /tmp/ccSTKqic ...
,
which is not mentioned on the command line. Either created by mold or by one of the GCC scripts?
from mold.
Interesting. Can you try to run the linker again with the --repro
flag, which generates test.repro.tar
, and share the generated tar file with me? With that, I can run mold with the exact inputs on my local machine.
from mold.
Ahh found it. Where the temporary file comes from: an resource file.
mold-link.zip
Still the other linkers does not output a dependency to the resource file. (gold,ld,lld)
from mold.
Unfortunately I couldn't reproduce the issue with the zip file you provided. Could you upload a tar file generated by mold as I explained in the previous comment?
from mold.
Unfortunately I couldn't reproduce the issue with the zip file you provided. Could you upload a tar file generated by mold as I explained in the previous comment?
I can. I am a bit surprised that you cannot reproduce. From reading the mold sources it seems quite clear that a response file (@file
), is added to the mf_pool in the Context. And when that file happens to be a temporary file things fall down.
For me a (with the code in the zip file), all subsequent invocations of ninja will rerun the linker step. Where it should just say "no work to do". Easy way for me to see why this happens is to run ninja as ninja -d explain
where the temporary file is reported as the culprit for why re-link is needed.
Anyway, the repro file:
(zipped tgz file, githug does not like tar nor tgz.)
I am afraid that you will not be able to reprocue with this either as the response file has been resolved and does not participate in the reported command line invocation anymore.
from mold.
The above commit should fix the issue.
from mold.
Related Issues (20)
- [Question] Is `mold` any compatible at all with wine-tkg (and anything Wine related) to build? HOT 2
- Binaries linked with mold-2.30.0 randomly either work or crash in `_dl_relocate_object` HOT 4
- Fold sold back into mold? HOT 1
- arm-arm_abs-error failed: sorry, unimplemented: Thumb-1 'hard-float' VFP ABI HOT 3
- `mold 2.31.0` build failure when targeting `ARMv6` HOT 3
- retain, used and perhaps wildcard-matching using retain-symbols-file HOT 13
- Missing -z option rodynamic HOT 1
- riscv64-shared-abs-sym fails with 2.31.0 HOT 2
- Statically linked binaries crash with illegal hardware instructions HOT 7
- Cannot build project using tealr and Mold linker HOT 2
- `mold/third-party/mimalloc` can be bumped to `v2.1.6`
- mold: fatal: unknown command line option: -arch HOT 1
- ninja error "FindFirstFileExA" during build on windows with vs2022 HOT 1
- Error with `cargo build --release` on PPC64LE: Missing `R_PPC64_TPREL16_LO_DS` HOT 2
- Is -z x86-64-vX supported? HOT 2
- Fails to build LLVM 18.1.6 with mold HOT 3
- Corrupts the `DWARF` section when relocating multiple objects into a single one HOT 3
- Feature request: Warn about reverse or cyclic dependencies
- MSYS2/UCRT64: LINKER_TYPE 'MOLD' is unknown or not supported by this toolchain. HOT 6
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.