Hacker News new | past | comments | ask | show | jobs | submit login

You’ll need to also add -flto to your LDFLAGS.



I don't think that's required. The linker driver will use LTO automatically if the object files it's given contain LTO IR.

If anything you might want to explicitly do -fno-lto to not use LTO when you have fat objects.


Thanks. confirmed with chatgpt, and, if you're doing debug build, you probably do not want to use -flto, otherwise it's great for release build.


LTO is required to detect ODR errors and to do a bunch of other checks.

It does more than optimize.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: