The only small argument I can think for it is for cases where the compiler and linker cooperate, like -function-sections + -gc-sections.
I am fine with just updating our own build for now to take advantage of the linker optimizations. It is probably a good idea even if this patch goes in for people building with gcc or older clang versions (patch is a second). On 1 November 2014 22:04, Chandler Carruth <[email protected]> wrote: > So, I vaguely don't like this.... > > I'm pretty comfortable with 'clang -O3 x.o y.o z.o -o my_binary' passing O3 > to the LTO plugin, but less comfortable with passing it to the linker > itself. I'm not really sure why though, so I'm open to be convinced > otherwise. I don't have any principled stance here, it just seems somewhat > off. > > I asked Rafael on IRC to check with GCC, and it requires "-Wl,-O3", and so > my current vote is for us to not invent a new convenience thing here. I'd be > interested if others disagree, and if so why. > > On Mon, Oct 20, 2014 at 9:35 AM, Rafael Espíndola > <[email protected]> wrote: >> >> It is fairly common for -O to be passed to clang when linking and both >> bfd and gold support -O options, but currently the driver doesn't >> translate it and projects have to use -Wl,-O if they want to enable >> those options. In fact, our own build pass -O3, but not -Wl,-O. >> >> The attached patch translates and forwards the -O options to the linker. >> >> Cheers, >> Rafael > > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
