Re: GCC 8.3.0, -flto and violation of C++ One Definition Rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 29 Dec 2021, 11:45 Tom Kacvinsky via Gcc-help, <gcc-help@xxxxxxxxxxx>
wrote:

> Hi,
>
> First, using GCC 8.3.0 and binutils 2.37.I am trying to increase
> performance of linking our product, so I thought I'd give LTO a try.  So
> I am compiling all object files with -flto, and passing -flto to g++
> (which we use as our link driver).  However, what I have found is that
> some of our code violates the C++ One Definition Rule (-Werror=odr). This
> only happens when building with LTO - without LTO, the C++ rule is
> not violated.


As already explained, this is almost certainly wrong. It is more likely
that the LTO violation is always present, but only detected when using LTO.


  The problem exists with LTO using both the BFD and gold
> linkers.
>
> So, my question is, since the LTO object files are now such that one
> needs to use gcc-nm to examine them (which I know is a wrapper around nm,
> and passes an option to load the LTO plugin). how can I leverage that to
> see if there are other translation units that define the class that ODR
> violation is complaining about?  I did do a fairly thorough analysis of
> the object files and did not see there the particular class and methods
> would be multiply defined,


It would help if you tell us the actual error/warning you get. -Wodr can
warn about various different things. It does not warn about multiple
definitions, it warns about *inconsistent* definitions.


but that was just based on symbol names from
> gcc-nm output.  I suspect there is more to this since the object files
> have LTO information now, and that is what I'd like to examine.
>
> Any hints on how to move forward with diagnosing LTO link errors?
>
> Thanks,
>
> Tom
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux