On Fri, Oct 11, 2019 at 6:15 AM Kugan Vivekanandarajah <kugan.vivekanandara...@linaro.org> wrote: > > Hi Richard, > Thanks for the review. > > On Wed, 2 Oct 2019 at 20:41, Richard Biener <richard.guent...@gmail.com> > wrote: > > > > On Wed, Oct 2, 2019 at 10:39 AM Kugan Vivekanandarajah > > <kugan.vivekanandara...@linaro.org> wrote: > > > > > > Hi, > > > > > > As mentioned in the PR, attached patch adds COLLECT_AS_OPTIONS for > > > passing assembler options specified with -Wa, to the link-time driver. > > > > > > The proposed solution only works for uniform -Wa options across all > > > TUs. As mentioned by Richard Biener, supporting non-uniform -Wa flags > > > would require either adjusting partitioning according to flags or > > > emitting multiple object files from a single LTRANS CU. We could > > > consider this as a follow up. > > > > > > Bootstrapped and regression tests on arm-linux-gcc. Is this OK for trunk? > > > > While it works for your simple cases it is unlikely to work in practice > > since > > your implementation needs the assembler options be present at the link > > command line. I agree that this might be the way for people to go when > > they face the issue but then it needs to be documented somewhere > > in the manual. > > > > That is, with COLLECT_AS_OPTION (why singular? I'd expected > > COLLECT_AS_OPTIONS) available to cc1 we could stream this string > > to lto_options and re-materialize it at link time (and diagnose mismatches > > even if we like). > OK. I will try to implement this. So the idea is if we provide > -Wa,options as part of the lto compile, this should be available > during link time. Like in: > > arm-linux-gnueabihf-gcc -march=armv7-a -mthumb -O2 -flto > -Wa,-mimplicit-it=always,-mthumb -c test.c > arm-linux-gnueabihf-gcc -flto test.o > > I am not sure where should we stream this. Currently, cl_optimization > has all the optimization flag provided for compiler and it is > autogenerated and all the flags are integer values. Do you have any > preference or example where this should be done.
In lto_write_options, I'd simply append the contents of COLLECT_AS_OPTIONS (with -Wa, prepended to each of them), then recover them in lto-wrapper for each TU and pass them down to the LTRANS compiles (if they agree for all TUs, otherwise I'd warn and drop them). Richard. > Thanks, > Kugan > > > > > > > Richard. > > > > > Thanks, > > > Kugan > > > > > > > > > gcc/ChangeLog: > > > > > > 2019-10-02 kugan.vivekanandarajah <kugan.vivekanandara...@linaro.org> > > > > > > PR lto/78353 > > > * gcc.c (putenv_COLLECT_AS_OPTION): New to set COLLECT_AS_OPTION in env. > > > (driver::main): Call putenv_COLLECT_AS_OPTION. > > > * lto-wrapper.c (run_gcc): use COLLECT_AS_OPTION from env. > > > > > > gcc/testsuite/ChangeLog: > > > > > > 2019-10-02 kugan.vivekanandarajah <kugan.vivekanandara...@linaro.org> > > > > > > PR lto/78353 > > > * gcc.target/arm/pr78353-1.c: New test. > > > * gcc.target/arm/pr78353-2.c: New test.