On Fri, Mar 26, 2021 at 4:05 PM Yonghong Song <yhs@xxxxxx> wrote: > > Now since you found gcc actually has flags in dwarf tag producer which > will provides whether lto is used, I went on clang side found that > the following flag is needed in clang in order to embed flags in > the producer tag: > -grecord-gcc-switches ... > In Linux: > - add flag -grecord-gcc-switches if clang lto is enabled. I think that will help to make dwarf output a bit more uniform between gcc and clang. So it's a good thing on its own. Recording compilation flags in the debug info could be useful in other cases too. I would pass it for both lto and non-lto builds.