dslm4515 / Musl-LFS

Linux From Scratch using Musl as Libc
GNU General Public License v3.0
167 stars 21 forks source link

Disable optimizations for GCC Pass 1 #18

Closed firasuke closed 4 years ago

firasuke commented 4 years ago

The first pass of GCC doesn't require optimization as it's only used to build musl (it won't be used outside of the toolchain); hence, I disabled them to significantly speed up the build process.

dslm4515 commented 4 years ago

That is very true and I agree.

I was always wondering how to speed up the cross-tools build since it’s only to force the build system to use musl to build the tools toolchain.

I did keep track of the time to build cross-tools, so I’ll compare. Thanks!

dslm4515 commented 4 years ago

Btw, build scripts are incomplete and out of date. They are supposed to be based on the “scripts” in docs. Thanks for also updating the appropriate ones in docs

Edit: fixed typo

firasuke commented 4 years ago

You're most welcome!

Well to speed up the build process, one has to carefully set the value of MAKEFLAGS (preferably -j1 for debugging and testing versions, and higher than that based on your core and thread count +1 for stable release versions). The first passes of GCC can be further sped up by disabling more unneeded flags.

The final toolchain (the native one and not the cross one) may need to be redesigned as I don't see any purpose behind building binutils and gcc twice. The only reason it's done in LFS is because the first pass of GCC is mentioned as a cross compiler and is used to build both the final versions of both binutils and GCC, but in our case we already have an entire cross-compilation toolchain, so there's no need for for the first passes of binutils and GCC.

dslm4515 commented 4 years ago

Wow. I forgot about that! Lol, I used to read every word in the LFS book when I first discovered LFS...back when LFS version 6.3 was the lastest! Now a days I just skip through it and use it as a guide.

Yes, I agree that final tool chain should only build GCC and binutils once. I’ll implement that design in branch 6.00 along with gcc9.2 or GCC 10 :P

firasuke commented 4 years ago

Glad I could be of benefit. I'll be looking forward to version 6.00.

As always, keep up the great work!

gottaeat commented 4 years ago

@dslm4515

I’ll implement that design in branch 6.00 along with gcc9.2 or GCC 10 :P

for your information, i've built gcc-9.2.0with patches from void and then built the system with it instead of 9.1.0 with patches from your repo. so it's possible to move to and use 9.2.0.

edit: also. there's a long time before the stable gcc-10.0.0 release.

dslm4515 commented 4 years ago

@firasuke I was able to build the cross-tools fine with disabling optimizations for GCC... also build the toolchain without building GCC and binutils twice!

Once I finish the build scripts for the final system, I'll push stable-5.00 to master and begin on stable-6.00!

firasuke commented 4 years ago

That's good to know! Keep up the great work!