On Wed, Oct 15, 2014 at 12:41:47PM +0400, Ilya Palachev wrote:
> >Yep.  As with other options this looks like it needs "conservative"
> >merging.  Which might be more involved than for other cases - but well...
> >
> >Look at existing examples in gcc/lto-opts.c and gcc/lto-wrapper.c.
> 
> I have seen that in r180827 you have removed functions lto_read_file_options
> from gcc/lto-streamer.h and lto_read_all_file_options from gcc/lto/lto.c. Do
> you mean that something like these functions should be added again?

I don't understand why would you want to read/write all options, just make
sure -fsanitize= is among those that are important for LTO.
I'll defer to Richard/Honza where exactly in LTO that should be done.

> Maybe it will be worthwhile to report the user what options he forget to add
> to the linkning command?
> 
> For example, without -flto option the following error is reported:
> 
> $ g++ -c test.cpp -fsanitize=address -o test_nolto.o
> $ g++ test_nolto.o -o test_nolto
> test_nolto.o:test.cpp:function main: error: undefined reference to
> '__asan_report_load4'

For non-lto, there shouldn't be any merging of options from anywhere.
gcc man page documents that the -fsanitize= options are needed for linking
too, it is similar to -fopenmp or plenty of other options.  Nothing special
needs to be done for that.

        Jakub

Reply via email to