Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] CFLAGS=-fno-common related breakage is incoming
Date: Sun, 19 Jan 2020 22:37:06
Message-Id: 20200119223651.3b6aa2fc@sf
1 > What is happening?
2
3 gcc-10 is coming soon. It will be more disruptive than gcc-9.
4
5 One of the major changes is the switch from C{,XX}FLAGS=-fcommon
6 to C{,XX}FLAGS=-fno-common by default: https://gcc.gnu.org/PR85678
7
8 It's a planned change and not a gcc regression. It will expose some
9 warts on old code and unblock minor optimisations accessing globals.
10
11 The change has already happened in gcc trunk.
12
13 > Is my package affected? Should I do anything?
14
15 You can check proactively if your packages are affected.
16
17 Add -fno-common to your make.conf's C{,XX}FLAGS and
18 see if things still build.
19
20 The typical symptom is a linker failure on multiple definitions
21 for some global variable:
22
23 ld: a.o:(.bss+0x0): multiple definition of `a'; main.o:(.data+0x0): first defined here
24
25 > How to fix it?
26
27 https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common contains
28 some examples. Ideally code will need a few 'extern' additions and maybe
29 moving variable definitions.
30
31 Example of proposed openrc fix:
32 https://github.com/OpenRC/openrc/pull/348
33
34 Adding 'append-flags -fcommon' might work as a temporary workaround.
35
36 > Can I help?
37
38 Glad you asked! We will need to gather failed packages and fix them
39 upstream and downstream. Here is what you can do:
40
41 1. Add -fno-common to your make.conf's C{,XX}FLAGS
42 2. Build packages you maintain
43 3. Fix a bug upstream (or report a failure).
44 4. Pull a fix downstream (or file a bug and add it to the tracker).
45
46 > What is already known to be broken? Can I look at example fixes?
47
48 See https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
49 for an artificial example.
50
51 Gentoo tracker bug of known issues:
52 https://bugs.gentoo.org/705764
53 15 bugs so far.
54
55 SUSE tracker bug of known issues:
56 https://bugzilla.suse.com/show_bug.cgi?id=1160244
57 95 bugs so far. A good source of packages to check against the
58 ones you care about.
59
60 > What does -fcommon do?
61
62 Look up -fcommon in https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
63
64 > I have no idea why my package broke. The error does not make sense.
65
66 Feel free to CC toolchain@ on a bug you observe and we'll try to sort it out.
67
68 --
69
70 Sergei

Replies

Subject Author
Re: [gentoo-dev] CFLAGS=-fno-common related breakage is incoming Sergei Trofimovich <slyfox@g.o>