Bug#818996: Please enable -Wabi-tag warning for C++ programs
>> - compile and link a program that uses libfoo and libbar with uvw compiler > > Let me follow up with some real result from a minimal test case. > >> (but I'm probably getting the sequence of events totally wrong so please >> specify what is actually going on) > > Not at all. Its a confluence of events, and that's what is making it > tricky to nail down. > > -Wabi-tag is somewhat of a mystery at the moment. Though introduced in > GCC 5.1, its still not documented at 5.3 (cf., > http://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Warning-Options.html#Warning-Options). > According to > http://allanmcrae.com/2015/06/the-case-of-gcc-5-1-and-the-two-c-abis/, > its intended to catch the mixing and matching that's causing the pain. I can't really offer anything useful at the moment because I don't have a clear understanding of what's going on. Sorry about that. Here are the three references I am aware. The Red Hat one made my radar tonight: * "GCC5 and the C++11 ABI", http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/ * "Dual ABIs", http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html * "The Case of GCC-5.1 and the Two C++ ABIs", http://allanmcrae.com/2015/06/the-case-of-gcc-5-1-and-the-two-c-abis/ I'm also aware that GCC appears to lack documentation on -Wabi-tag (cf., http://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Warning-Options.html#Warning-Options.). I *thought* -Wabi-tag could be used to detect the differences between ABIs when compiling and linking. That would, in turn alert the user, but I'm not sure that was correct. For example, the following warns of an ABI problem even though C++03 does not have this problem: $ cat test.cxx #include std::string foo __attribute__ ((visibility ("default"))); std::string bar __attribute__ ((visibility ("default"))); And: $ g++ -g3 -O2 -Wabi-tag -std=c++03 -shared test.cxx -o test.so test.cxx:3:13: warning: ‘foo’ inherits the "cxx11" ABI tag that ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ (used in its type) has [-Wabi-tag] std::string foo __attribute__ ((visibility ("default"))); ^ In file included from /usr/include/c++/5/string:52:0, from test.cxx:1: /usr/include/c++/5/bits/basic_string.h:71:11: note: ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ declared here class basic_string ^ test.cxx:4:13: warning: ‘bar’ inherits the "cxx11" ABI tag that ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ (used in its type) has [-Wabi-tag] std::string bar __attribute__ ((visibility ("default"))); ^ In file included from /usr/include/c++/5/string:52:0, from test.cxx:1: /usr/include/c++/5/bits/basic_string.h:71:11: note: ‘std::__cxx11::string {aka std::__cxx11::basic_string}’ declared here class basic_string ^ Then, I thought I could side step the problem by building a library with both old and new symbols that coexist as discussed in the Red Hat blog. But I can't seem to get a definitive answer on what it means to coexist, and how to do it. I asked a couple of questions on the GCC Help mailing list. They may help you more than they helped me: * "Why does -Wabi-tag complain when -std=c++03?", https://gcc.gnu.org/ml/gcc-help/2016-03/msg00123.html * "How to provide coexisting std::string's (with and without abi:cxx11) in GCC 5.1 and above?", https://gcc.gnu.org/ml/gcc-help/2016-03/msg00118.html "What a fine mess we're in" comes to mind right about now... Sorry again about not being able to help. Jeff
Bug#818996: Please enable -Wabi-tag warning for C++ programs
On Wed, Mar 23, 2016 at 3:18 PM, Simon McVittie wrote: > [Removing debian-devel from Cc] > > On Wed, 23 Mar 2016 at 13:31:32 +0100, Matthias Klose wrote: >> If you want to change that, that change should be made in dpkg-buildflags. > > From the original report: > >> >On Tue, 22 Mar 2016 at 10:34:29 -0400, Jeffrey Walton wrote: >> >>It appears Debian built the library with GCC, and GCC used >> >>_GLIBCXX_USE_CXX11_ABI. The user then compiled with Clang and caught a >> >>link error. The tools did not warn him about the problems, so the >> >>report trickled downhill to us. > > it isn't clear to me whether that would have helped: dpkg-buildflags > only affects the warnings emitted when Debian packages are built, whereas > a change in gcc would also affect the warnings emitted when upstream > software is built on Debian. > ... Maybe fast uptake of the patches discussed here would be most helpful: http://llvm.org/bugs/show_bug.cgi?id=23529#c61. Jeff
Bug#818996: Please enable -Wabi-tag warning for C++ programs
On Thu, 24 Mar 2016 at 08:57:22 -0400, Jeffrey Walton wrote: > "What a fine mess we're in" comes to mind right about now... The transition within Debian was no fun either: https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=libstdc%2B%2B-cxx11;users=debian-gcc@lists.debian.org
Bug#819176: gcc-5: Please avoid storing -fdebug-prefix-map in DW_AT_producer (for better reproducibility)
Package: gcc-5 Version: 5.3.1-12 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: buildpath embedding the build path in binaries makes it harder to get byte-for-byte reproducibility, because the build has to happen in the same directory. gcc by default embeds the build path in the debug info of C tools (e.g. DW_AT_comp_dir and DW_AT_decl_file). This isn't useful for distributed binary packages, because the build environment isn't on the same machine (or necessarily in the same place). The build path can be mangled/stripped with gcc's -fdebug-prefix-map argument. For example: gcc -fdebug-prefix-map=$(pwd)=. -g -o foo foo.c however, when supplying -fdebug-prefix-map, gcc puts that string itself into DW_AT_producer. The attached patch (pulled from upstream gcc master) avoids storing -fdebug-prefix-map in DW_AT_producer. I'd like this to be backported into debian's gcc so that we can make and test a more reproducible toolchain. (thinking about timing: we shouldn't need the patch once we move to gcc 6, but we should be testing a buildpath-independent reproducible toolchain now; i'll file a bug soon to add this pattern to either dh or dpkg-buildflags) Regards, --dkg -- System Information: Debian Release: stretch/sid Architecture: amd64 (x86_64) Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages gcc-5 depends on: ii binutils 2.26-5 ii cpp-5 5.3.1-12 ii gcc-5-base5.3.1-12 ii libc6 2.22-3 ii libcc1-0 5.3.1-12 ii libgcc-5-dev 5.3.1-12 ii libgcc1 1:5.3.1-12 ii libgmp10 2:6.1.0+dfsg-2 ii libisl15 0.16.1-1 ii libmpc3 1.0.3-1 ii libmpfr4 3.1.4-1 ii libstdc++65.3.1-12 ii zlib1g1:1.2.8.dfsg-2+b1 Versions of packages gcc-5 recommends: ii libc6-dev 2.22-3 Versions of packages gcc-5 suggests: pn gcc-5-doc pn gcc-5-locales ii gcc-5-multilib5.3.1-12 pn libasan2-dbg pn libatomic1-dbg pn libcilkrts5-dbg pn libgcc1-dbg pn libgomp1-dbg pn libitm1-dbg pn liblsan0-dbg pn libmpx0-dbg pn libquadmath0-dbg pn libtsan0-dbg pn libubsan0-dbg -- debconf-show failed >From 6ceddcd7b87911ddbb942923722af5a735dacedc Mon Sep 17 00:00:00 2001 From: bernds Date: Fri, 18 Dec 2015 19:48:26 + Subject: [PATCH] Ignore -fdebug-prefix-map in producer string (by Daniel Kahn Gillmor) * dwarf2out.c (gen_producer_string): Ignore -fdebug-prefix-map. testsuite/ * gcc.dg/debug/dwarf2/prod-options.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231835 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog| 4 gcc/dwarf2out.c | 1 + gcc/testsuite/ChangeLog | 4 gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c | 12 4 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fec7992..11ee620 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-12-18 Daniel Kahn Gillmor + + * dwarf2out.c (gen_producer_string): Ignore -fdebug-prefix-map. + 2015-12-18 Nathan Sidwell * config/nvptx/nvptx.c (nvptx_option_override): Emit sorry for diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 067c4f2..320a077 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21498,6 +21498,7 @@ gen_producer_string (void) case OPT_fpreprocessed: case OPT_fltrans_output_list_: case OPT_fresolution_: + case OPT_fdebug_prefix_map_: /* Ignore these. */ continue; default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5da1ce4..b2d9d3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-12-18 Bernd Schmidt + + * gcc.dg/debug/dwarf2/prod-options.c: New test. + 2015-12-18 Eric Botcazou * gnat.dg/specs/debug1.ads: Bump final count to 18. diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c new file mode 100644 index 000..21449f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c @@ -0,0 +1,12 @@ +/* Verify that the DW_AT_producer does not contain certain compiler options + such as -fdebug-prefix-map=; this is undesirable since path names make + the build not reproducible. Other skipped options could be tested here + as well. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */ +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" } } */ +/* { dg-final { scan-assembler-not "debug-prefix-map" } } */ + +void func (void) +{ +} -- 2.8.0.rc3
Processing of gcc-5_5.3.1-13_source.changes
gcc-5_5.3.1-13_source.changes uploaded successfully to localhost along with the files: gcc-5_5.3.1-13.dsc gcc-5_5.3.1-13.diff.gz Greetings, Your Debian queue daemon (running on host franck.debian.org)
gcc-5_5.3.1-13_source.changes ACCEPTED into unstable
Accepted: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Format: 1.8 Date: Thu, 24 Mar 2016 14:43:10 +0100 Source: gcc-5 Binary: gcc-5-base libgcc1 libgcc1-dbg libgcc2 libgcc2-dbg libgcc-5-dev libgcc4 libgcc4-dbg lib64gcc1 lib64gcc1-dbg lib64gcc-5-dev lib32gcc1 lib32gcc1-dbg lib32gcc-5-dev libn32gcc1 libn32gcc1-dbg libn32gcc-5-dev libx32gcc1 libx32gcc1-dbg libx32gcc-5-dev gcc-5 gcc-5-multilib gcc-5-test-results gcc-5-plugin-dev gcc-5-hppa64-linux-gnu cpp-5 gcc-5-locales g++-5 g++-5-multilib libgomp1 libgomp1-dbg lib32gomp1 lib32gomp1-dbg lib64gomp1 lib64gomp1-dbg libn32gomp1 libn32gomp1-dbg libx32gomp1 libx32gomp1-dbg libitm1 libitm1-dbg lib32itm1 lib32itm1-dbg lib64itm1 lib64itm1-dbg libx32itm1 libx32itm1-dbg libatomic1 libatomic1-dbg lib32atomic1 lib32atomic1-dbg lib64atomic1 lib64atomic1-dbg libn32atomic1 libn32atomic1-dbg libx32atomic1 libx32atomic1-dbg libasan2 libasan2-dbg lib32asan2 lib32asan2-dbg lib64asan2 lib64asan2-dbg libx32asan2 libx32asan2-dbg liblsan0 liblsan0-dbg lib32lsan0 lib32lsan0-dbg libx32lsan0 libx32lsan0-dbg libtsan0 libtsan0-dbg libubsan0 libubsan0-dbg lib32ubsan0 lib32ubsan0-dbg lib64ubsan0 lib64ubsan0-dbg libx32ubsan0 libx32ubsan0-dbg libcilkrts5 libcilkrts5-dbg lib32cilkrts5 lib32cilkrts5-dbg lib64cilkrts5 lib64cilkrts5-dbg libx32cilkrts5 libx32cilkrts5-dbg libmpx0 libmpx0-dbg lib32mpx0 lib32mpx0-dbg lib64mpx0 lib64mpx0-dbg libquadmath0 libquadmath0-dbg lib32quadmath0 lib32quadmath0-dbg lib64quadmath0 lib64quadmath0-dbg libx32quadmath0 libx32quadmath0-dbg libcc1-0 libgccjit0 libgccjit-5-dev libgccjit-5-dbg libgccjit-5-doc gobjc++-5 gobjc++-5-multilib gobjc-5 gobjc-5-multilib libobjc-5-dev lib64objc-5-dev lib32objc-5-dev libn32objc-5-dev libx32objc-5-dev libobjc4 libobjc4-dbg lib64objc4 lib64objc4-dbg lib32objc4 lib32objc4-dbg libn32objc4 libn32objc4-dbg libx32objc4 libx32objc4-dbg gfortran-5 gfortran-5-multilib libgfortran-5-dev lib64gfortran-5-dev lib32gfortran-5-dev libn32gfortran-5-dev libx32gfortran-5-dev libgfortran3 libgfortran3-dbg lib64gfortran3 lib64gfortran3-dbg lib32gfortran3 lib32gfortran3-dbg libn32gfortran3 libn32gfortran3-dbg libx32gfortran3 libx32gfortran3-dbg gccgo-5 gccgo-5-multilib libgo7 libgo7-dbg lib64go7 lib64go7-dbg lib32go7 lib32go7-dbg libn32go7 libn32go7-dbg libx32go7 libx32go7-dbg gcj-5 gcj-5-jdk gcj-5-jre-headless gcj-5-jre libgcj16 gcj-5-jre-lib libgcj16-awt libgcj16-dev libgcj16-dbg gcj-5-source libgcj-doc libstdc++6 lib32stdc++6 lib64stdc++6 libn32stdc++6 libx32stdc++6 libstdc++-5-dev libstdc++-5-pic libstdc++6-5-dbg lib32stdc++-5-dev lib32stdc++6-5-dbg lib64stdc++-5-dev lib64stdc++6-5-dbg libn32stdc++-5-dev libn32stdc++6-5-dbg libx32stdc++-5-dev libx32stdc++6-5-dbg libstdc++-5-doc gnat-5 gnat-5-sjlj libgnat-5 libgnat-5-dbg libgnatvsn5-dev libgnatvsn5 libgnatvsn5-dbg libgnatprj5-dev libgnatprj5 libgnatprj5-dbg gdc-5 gdc-5-multilib libphobos-5-dev lib64phobos-5-dev lib32phobos-5-dev libx32phobos-5-dev fixincludes gcc-5-source Architecture: source Version: 5.3.1-13 Distribution: unstable Urgency: medium Maintainer: Debian GCC Maintainers Changed-By: Matthias Klose Description: cpp-5 - GNU C preprocessor fixincludes - Fix non-ANSI header files g++-5 - GNU C++ compiler g++-5-multilib - GNU C++ compiler (multilib support) gcc-5 - GNU C compiler gcc-5-base - GCC, the GNU Compiler Collection (base package) gcc-5-hppa64-linux-gnu - GNU C compiler (cross compiler for hppa64) gcc-5-locales - GCC, the GNU compiler collection (native language support files) gcc-5-multilib - GNU C compiler (multilib support) gcc-5-plugin-dev - Files for GNU GCC plugin development. gcc-5-source - Source of the GNU Compiler Collection gcc-5-test-results - Test results for the GCC test suite gccgo-5- GNU Go compiler gccgo-5-multilib - GNU Go compiler (multilib support) gcj-5 - GCJ byte code and native compiler for Java(TM) gcj-5-jdk - GCJ and Classpath development tools for Java(TM) gcj-5-jre - Java runtime environment using GIJ/Classpath gcj-5-jre-headless - Java runtime environment using GIJ/Classpath (headless version) gcj-5-jre-lib - Java runtime library for use with gcj (jar files) gcj-5-source - GCJ java sources for use in IDEs like eclipse and netbeans gdc-5 - GNU D compiler (version 2) gdc-5-multilib - GNU D compiler (version 2, multilib support) gfortran-5 - GNU Fortran compiler gfortran-5-multilib - GNU Fortran compiler (multilib support) gnat-5 - GNU Ada compiler gnat-5-sjlj - GNU Ada compiler (setjump/longjump runtime library) gobjc++-5 - GNU Objective-C++ compiler gobjc++-5-multilib - GNU Objective-C++ compiler (multilib support) gobjc-5- GNU Objective-C compiler gobjc-5-multilib - GNU Objective-C compiler (multilib support) lib32asan2 - AddressSanitizer -- a fast memory error detector (32bit) lib32asan2-dbg - AddressSanitizer -- a fast memory error detector (32 bit debug sy lib32atomic1 - support library providing __atomic built-in functions (32