rui314 / mold

Mold: A Modern Linker 🦠
MIT License
13.69k stars 448 forks source link

Build mold from source with -march or -mcpu in the build script #1268

Closed Paulo-21 closed 1 month ago

Paulo-21 commented 1 month ago

Hello, I was wondering if it would be nice to build mold with -march or -mcpu when building from source, because when we install mold from source, we generaly build mold for the machine that we used to build mold, it is not intended for distribution.

In this case, we can expect more perfomance gain even if mold is the fastest linker already.

What do you thing about it ?

rui314 commented 1 month ago

You can do it by running the initial cmake with a CXXFLAGS like CXXFLAGS=-march=native cmake .... I did not observe any performance difference with that option on my machine though. Did you see any improvements on your machine?

I don't think we want to set it by default anyway because some people do build mold and distribute to other machines. My understanding is that most project don't compile with -march=native by default too.

Paulo-21 commented 1 month ago

I didn't tested yet with a big software. If you think there is no advantage to enable this option by default then we can close this issue, i can reopen it later if i see a difference linking time on my machine. ty