Comments (8)
@rui314 thanks for the explanation, I clearly misunderstood how preloading is implemented in mold. This will not work with cargo because cargo does not allow the user to access the list of object files prior to linking.
Ideally, mold would have a feature like this:
If I run mold -daemon -o output a.o b.o c.o
, mold detects that no daemon is running, starts one up, and performs the first link.
Now, I can run mold -daemon -o output a.o b.o c.o
any number of times, and each time mold detects that the daemon is running and the arguments are the same, so it reuses work from the first invocation.
Is this possible? I am not an expert on linking, so I don't know what the limitations are.
Thank you!
from mold.
Thank you for your suggestion, but I think there are a few practical issues with that approach:
- Preloading is supposed to be used in preload object files, compile, link cycles. So, in a single build (e.g. a single invocation of
make
orcargo
), you are supposed to first run mold with -reload, compile source, and then invoke mold again without -preload. Can you make a change to cargo config to do this in the first place? - If we allow the exact same command line flags, every number of mold run does preload, and every odd number of mold run creates an output. I think it can easily be out of sync and confuses build systems and users.
from mold.
The preloading feature can make mold faster, but mold is already pretty fast. Could you share a little bit more about why you wanted to use the preloading feature? How long does your build takes for the linking step?
from mold.
why you wanted to use the preloading feature?
To move from "1.69s" in "mold" column in README to "0.79s" in "mold w/ preloading"?
from mold.
If you're using mold --run
then that would know when it had started for the first time and could do the --preload and then subsequent mold calls could make use of that for the lifetime that the mold --run is running. I.e. it could act as a short-term daemon. (That said maybe I too have misunderstood)
from mold.
When mold started as mold run make
, it doesn't know the actual linker command. It only gets make
as an argument. But we need a list of object files and other command line parameters to start preloading. So it is not feasible.
from mold.
from mold.
Object file preloading doesn't seem to get traction, and it looks to me that making that feature trickier/more implicit isn't a good idea, so I'll close this issue as working-as-intended.
from mold.
Related Issues (20)
- 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
- Build mold from source with -march or -mcpu in the build script HOT 2
- mold support for Fortran HOT 1
- Segmentation fault when compiling ROOT HOT 4
- /usr/lib/mold/mold-wrapper.so: unsupported relocation type 1026 HOT 3
- Binary linked with mold segfaults immediately HOT 5
- [FEATURE REQ/BUG REP] SH4 endianas HOT 7
- x86_64-exception-multiple-ehframe test failure HOT 2
- corrupted .riscv.attributes ISA string
- Very slow symbol lookup speed with gdb HOT 3
- mold fails to build on Debian sid on most of the archs (`error: implicit declaration of function`)
- mold does not accelerate the compile process compare to normal config HOT 15
- Support `libdep` plugin HOT 8
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.