SUSE Blog

SUSE Linux Enterprise 12 Toolchain Update



By: Andreas Jaeger

September 19, 2016 2:06 am

Reads:2,189

Comments:0

Score:5

Print/PDF

Do you want to have better diagnostics when developing your C, C++, or Fortran code? Want to have applications that run faster and take advantage of new CPUs? Do you have code that benefits from vectorizing? Install the updated GNU toolchain, a collection of programming tools from the GNU project, on your SUSE Linux Enterprise 12 systems.

We just released the updates for the GNU toolchain: The GCC 6.2 compiler collection, binutils 2.26.1, and GDB 7.11.1.

Improved Diagnostics

The C and C++ compilers report source locations now as ranges, instead of just points. This makes it easier to identify the subexpression that is reported:

 test.cc: In function 'int test(int, int, foo, int, int)':
 test.cc:5:16: error: no match for 'operator*' (operand types are 'int' and 'foo')
 return p + q * r * s + t;
            ~~^~~

In addition, there is now initial support for precise diagnostic locations within strings:

 format-strings.c:3:14: warning: field width specifier '*' expects a matching 'int' argument [-Wformat=]
 printf("%*d");
          ^

Diagnostics can now contain “fix-it hints”, which are displayed in context underneath the relevant source code. For example:

fixits.c: In function 'bad_deref':
fixits.c:11:13: error: 'ptr' is a pointer; did you mean to use '->'?
return ptr.x;
          ^
          ->

The C and C++ compilers now offer suggestions for misspelled field names:

spellcheck-fields.cc:52:13: error: 'struct s' has no member named 'colour'; did you mean 'color'?
return ptr->colour;
            ^~~~~~

-Wmisleading-indentation warns about places where the indentation of the code gives a misleading idea of the block structure of the code to a human reader. For example, given CVE-2014-1266:

sslKeyExchange.c: In function 'SSLVerifySignedServerKeyExchange':
sslKeyExchange.c:629:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
    ^~
sslKeyExchange.c:631:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
        goto fail;
        ^~~~

This warning is enabled by -Wall.

Optimizations

To allow for more efficient code, Value range propagation now assumes that the this pointer of C++ member functions is non-null. This eliminates common null pointer checks but also breaks some non-conforming code-bases (such as Qt-5, Chromium, KDevelop). As a temporary work-around -fno-delete-null-pointer-checks can be used. Wrong code can be identified by using -fsanitize=undefined.

Hardware Enablement

The new compiler brings better support for AARCH64, including link time optimization across translation units, new x86-64 CPUs (AMD Zen, Intel Skylake), updates for Power9 and IBM z13.

Vector Extensions

On x86-64 the C Library comes with some vectorized math functions, the compiler can use them directly to not only speed up basic arithmetic but also functions like sin, cos, exp, log, and exp.

As an example:

for (i=0; i < max_a; i++)
  s[i] = sin(a[i])

can now be vectorized, a vectorized sin functions is used for this.

Note this requires the glibc from the upcoming SUSE Linux Enterprise Server 12 SP2.

For the new Power9 and IBM z13 architectures, vector instructions have been enabled in GCC.

Version 4.5 of the OpenMP specification is now supported in C and C++ compilers.

Using GCC 6

Use gcc-6 or g++-6 instead of gcc/g++ to compile your program:

$ gcc-6 hello.c -o hello

GDB and binutils updates

GDB informs users now about which threads interrupted the program. A more explicit syntax for breakpoints is supported, you can say for example “break -s main.c -li 3” to set a breakpoint in line 3 of your main.c file.

Binutils now support compressed DWARF debugging sections. This is disabled by default, you need to pass --compress-debug-sections to the linker or assembler to use it. This can reduce your debug sections by around 50 per cent (tested on Linux kernel).

Installation

These updates are available as part of the SUSE Linux Enterprise Server subscription. The compiler collection is available via the toolchain module. User that want to install it, need to first register the toolchain module and can then install it with YaST or using zypper
(“zypper in gcc-6“). binutils and GDB are available as normal maintenance updates.

Reference

Learn more about GCC in the GCC changes document and if your code is non-conforming, best read also the GCC porting document.

3 votes, average: 5.00 out of 53 votes, average: 5.00 out of 53 votes, average: 5.00 out of 53 votes, average: 5.00 out of 53 votes, average: 5.00 out of 5 (3 votes, average: 5.00 out of 5)
You need to be a registered member to rate this post.
Loading...

Tags: , ,
Categories: Announcements, Enterprise Linux, SUSE Linux Enterprise, SUSE Linux Enterprise Server, Technical Solutions

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

Comment

RSS