[Lsb-messages] /var/www/bzr/lsb/devel/build_env r2329: add some more flags for >= gcc5 to try to get ABI compatibility

Mats Wichmann mats at linuxfoundation.org
Sun Apr 23 16:29:58 UTC 2017


------------------------------------------------------------
revno: 2329
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: build_env
timestamp: Sun 2017-04-23 10:29:58 -0600
message:
  add some more flags for >= gcc5 to try to get ABI compatibility
modified:
  lsbdev-cc/lsbcc.c
  package/Makefile
-------------- next part --------------
=== modified file 'lsbdev-cc/lsbcc.c'
--- a/lsbdev-cc/lsbcc.c	2017-04-21 15:06:52 +0000
+++ b/lsbdev-cc/lsbcc.c	2017-04-23 16:29:58 +0000
@@ -400,7 +400,8 @@
 
 /* begin utility functions */
 
-/* We need to figure out the path to the compiler base directory.
+/*
+ * We need to figure out the path to the compiler base directory.
  * Unfortunately, we don't know how to do this in a compiler-independent way.
  * This would need tweaking if a non-gcc compiler didn't recognize
  * option -print-libgcc-file-name.
@@ -669,24 +670,48 @@
 }
 
 /*
+ * Starting with gcc5, the default C++ ABI version specifier changes
+ * From 3.4 -> 4.x, it was version 2; afterwards it is set to version 0,
+ * which actually means "the latest", as there was some rapid
+ * changing of abi versions, as follows:
+ *
+ * Version 3 is a bugfix (version unknown);
+ * Version 4 in G++ 4.5 (but not default)
+ * Version 5 in G++ 4.6 (but not default)
+ * Version 6 in G++ 4.7 (but not default)
+ * Version 7 in G++ 4.8 (but not default)
+ * Version 8 in G++ 4.9 (but not default)
+ * Version 9 in G++ 5.2 (picked up via new default 0)
+ * Version 10 in G++ 6.1 (picked up via new default 0)
+ * Version 11 in G++ 7 (picked up via new default 0)
+ *
  * Starting with gcc6, the default C++ standard is c++14.
  * For LSB up to and including 5.0, that's not going to fly,
  * we have old C++ headers (and library) that aren't compatible.
+ *
+ * This function first returned true for gcc6, but now it needs to
+ * represent two states - abi-version and C++-standard, so
+ * just send back the gcc version
+ *
+ * Just as an aside, at this time clang makes no effort to
+ * follow the changes of g++ ABI; however current clang++ is
+ * still reporting it is compatible with gcc4, so from LSB
+ * perspective that should be okay for now. 
  */
-
-int need_old_cxx()
+int need_old_gxx()
 {
-    /* Guessing that we won't need this after 5.0 */
-    if (strcmp(lsbcc_lsbversion, "5.1") >= 0) {
-	return 0;
-    }
-
     /* This option became available on gcc 4.1. */
     find_gcc_version();
     switch (gccversion[0]) {
 
+    case '5':
+	return 5;
+
     case '6':
-	return 1;
+	return 6;
+
+    case '7':
+	return 7;
 
     default:
 	return 0;
@@ -1832,12 +1857,26 @@
     argvaddstring(gccargs, "-mcpu=603");
 #endif
 
-    /* Check if we need to force a particular C++ standard */
-    if ((LSBCPLUS == lsbccmode) && need_old_cxx()) {
-	if (lsbcc_debug & DEBUG_MODIFIED_ARGS) {
-	    fprintf(stderr, "Adding -std=gnu++98 to args\n");
+    /*
+     * Check if we need to force characteristics of older g++
+     * See commentary in the need_old_gxx() function.
+     */
+    if (lsbccmode == LSBCPLUS) {
+        int ver_rv = need_old_gxx();
+	if (ver_rv) {
+	    if (lsbcc_debug & DEBUG_MODIFIED_ARGS) {
+		fprintf(stderr, "Adding -fabi-version=2 -Wabi=2 to args\n");
+	    }
+	    argvaddstring(gccargs, "-fabi-version=2");
+	    argvaddstring(gccargs, "-Wabi=2");
+
+	    if (ver_rv >= 6) {
+		if (lsbcc_debug & DEBUG_MODIFIED_ARGS) {
+		    fprintf(stderr, "Adding -std=gnu++98 to args\n");
+		}
+		argvaddstring(gccargs, "-std=gnu++98");
+	    }
 	}
-	argvaddstring(gccargs, "-std=gnu++98");
     }
 
     /* Check if we need to specify the length of long double. */

=== modified file 'package/Makefile'
--- a/package/Makefile	2017-04-21 15:06:52 +0000
+++ b/package/Makefile	2017-04-23 16:29:58 +0000
@@ -50,11 +50,11 @@
 # Should have leading "."
 # a big number (80-99) is leading up to the next minor spec
 # build_env is version-independent so can wait till late to bump this
-SUB_VERSION=.9
+SUB_VERSION=.10
 
 # We define this here instead of directly in the spec file as
 # we need to be able to work out what the produced rpm files will be called
-BUILDNO=3
+BUILDNO=1
 
 # Initialize LIB64 to proper value for 64-bit architectures
 export LIB64:=$(shell case `uname -m` in (ppc64 | s390x | x86_64) echo 64 ;; esac)



More information about the lsb-messages mailing list