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

--- Comment #4 from Niall Douglas <s_gccbugzilla at nedprod dot com> 2012-06-15 
15:23:21 UTC ---
(In reply to comment #2)
> you can use -frecord-gcc-switches to detect mixed objects in linked library.

Indeed, one could grok the .text section this adds, parse the command line and
determine the build settings.

However, this is why that would be a poorer choice:

1. Last time I looked record-gcc-switches only works with ELF outputs.

2. You can't debug prebuilt system provided shared objects as these won't have
been compiled with -frecord-gcc-switches.

3. Parsing an ELF .text section is hard from within programs as compared to
dlsym(dll, "__gplusplus_std_cplusplus11")

4. Automated build config tools already have machinery for seeing if some
symbol is exported by some binary object. That lets the proposed system fit
into said existing machinery easily, whereas groking .text sections is
considerably harder. For example, an automated build config might adapt how it
builds itself according to how system provided shared libraries were built.

5. Future GCC command line switches may change. Indeed, one day -std will
default to c++11, not c++98. When that happens your .text section parsing will
break. The proposed system doesn't have that problem and is more futureproof.

Niall

Reply via email to