Gentoo Archives: gentoo-dev

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

Replies

Subject Author
Re: [gentoo-dev] CFLAGS=-fno-common related breakage is incoming Joonas Niilola <juippis@g.o>