http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53673

             Bug #: 53673
           Summary: Add magic weak symbol to indicate C++ standard setting
                    (C++03, C++11 etc) to help debug ABI problems
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: s_gccbugzi...@nedprod.com


Can we have a magic weak symbol output by G++ into compilands saying what -std
setting was used? For example:

No -std outputs __gplusplus_std_cpluscplus98
-std=c++03 outputs __gplusplus_std_cplusplus03
-std=gnu++03 outputs __gplusplus_std_gnu03
-std=c++11 outputs __gplusplus_std_cplusplus11
-std=gnu++11 outputs __gplusplus_std_gnu11
... and so on ...

Why? Because right now it's too easy to accidentally link object files compiled
with 98 with those compiled with 11 and not then know why things spontaneously
fail:

http://gcc.gnu.org/ml/gcc/2012-06/msg00201.html
http://gcc.gnu.org/wiki/Cxx11AbiCompatibility

If __gplusplus_std_cpluscplus98 and __gplusplus_std_cplusplus11 both turn up in
a shared object or executable, then we know we have combined 98 and 11 built
code. Indeed, a future ld could warn if this happens.

Niall

Reply via email to