Bug ID 1160244
Summary [META] -fno-common package failures
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Basesystem
Assignee bnc-team-screening@forge.provo.novell.com
Reporter martin.liska@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

Starting from the upcoming GCC release 10, the default of -fcommon option will
change to -fno-common:

In C, global variables with multiple tentative definitions will result in
linker errors. Global variable accesses are also more efficient on various
targets.

Porting advice:

A common mistake in C is omitting <code>extern</code> when declaring a global
variable in a header file.  If the header is included by several files it 
results in multiple definitions of the same variable.  In previous GCC versions
this error is ignored.  GCC 10 defaults to <code>-fno-common</code>, 
which means a linker error will now be reported. To fix this, use
<code>extern</code> in header files when declaring global variables, and ensure
each global is defined in exactly one C file. As a workaround, legacy C code
can be compiled with -fcommon.

      int x;  // tentative definition - avoid in header files 
      extern int y;  // correct declaration in a header file 

Recommendations for package maintainers:
- report the violation to upstream
- cherry pick a fix from upsteam

Alternatively one can append -fcommon to $optflags for a package that will not
be fixed upstream.


You are receiving this mail because: