On Wed, Oct 15, 2014 at 4:47 PM, Ilya Palachev <i.palac...@samsung.com> wrote: > Hi all, > > The attached patch fixes PR lto/61048. > > The basic idea is to write option -fsanitize to existing ELF section > .gnu.lto_.opts in object files and then read it in lto-wrapper. > > On 15.10.2014 12:46, Richard Biener wrote: >> >> You need to handle them in lto-opts.c and output them to the existing >> option >> section. > > > 2 minor changes are added to existing function that write options (in > lto-opts.c) and then read them from object files (lto-wrapper.c). > > The patch was bootstrapped and regtested on x86_64-unknown-linux-gnu. > > Ok for trunk?
Ok. Note that for mismatched options you'll now get the "first" chosen. Which could be -fno-sanitize=address. Also if you build one file with -fsanitize=address and one with -fsanitize=undefined you'll get either but not both enabled. So the patch works for the simple cases but it will likely require more complex handling in lto-wrapper.c:merge_and_complain to do something sensible for mismatches (and not treat -fsanitize=address equal to -fsanitize=undefined). Btw, similar merging issues probably exist for -fsanitize-recover, -fsanitize-undefined-trap-on-error, or do they apply during instrumentation already? Thanks, Richard. > Best regards, > Ilya Palachev