From: Takashi Iwai Subject: Re: LTO build errors (Re: linux-next: clean up the kbuild tree?) Date: Wed, 25 Nov 2015 07:58:19 +0100 Message-ID: References: <20151115112705.0bf4f0ed@canb.auug.org.au> <20151115175848.GD10150@tassilo.jf.intel.com> <5649D3B9.7020701@suse.cz> <20151121010033.GB8438@tassilo.jf.intel.com> <20151124021231.GE8438@tassilo.jf.intel.com> <20151125043344.GG8438@tassilo.jf.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mx2.suse.de ([195.135.220.15]:35100 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbbKYG6V (ORCPT ); Wed, 25 Nov 2015 01:58:21 -0500 In-Reply-To: <20151125043344.GG8438@tassilo.jf.intel.com> Sender: linux-next-owner@vger.kernel.org List-ID: To: Andi Kleen Cc: Michal Marek , Stephen Rothwell , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org On Wed, 25 Nov 2015 05:33:44 +0100, Andi Kleen wrote: >=20 >=20 > Hi Takashi, >=20 > On Tue, Nov 24, 2015 at 05:33:36PM +0100, Takashi Iwai wrote: > > LD vmlinux > > arch/x86/kernel/cpu/perf_event_intel_rapl.c:66:20: error: rapl_doma= in_names causes a section type conflict with __setup_str_set_reset_devi= ces > > static const char *rapl_domain_names[NR_RAPL_DOMAINS] __initconst = =3D { > > ^ > > init/main.c:159:19: note: =E2=80=98__setup_str_set_reset_devices=E2= =80=99 was declared here > > __setup("reset_devices", set_reset_devices); > >=20 > > Hmm... I see no direct relation, but OK, let's try to get rid of > > __initconst. Now it hits lots of other errors like: >=20 > I hit the same issue, will send a patch. The other symbol is typicall= y some > random correct symbol because gcc detects the conflict on a pair of s= ymbols. >=20 > The problem is that placing const correctly is too difficult, the cor= rect line > would be=20 >=20 > static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initcon= st =3D { Ah, so I should have ignored the relation with __setup_* but concentrate on the line. LTO goes much deeper than a human being can look through :) Yes, such an error is often overseen. A quick grep shows the following: arch/arc/plat-axs10x/axs10x.c:463:static const char *axs101_compat[] __= initconst =3D { arch/arc/plat-axs10x/axs10x.c:477:static const char *axs103_compat[] __= initconst =3D { arch/arc/plat-sim/platform.c:22:static const char *simulation_compat[] = __initconst =3D { arch/arm/mach-imx/mach-imx6ul.c:87:static const char *imx6ul_dt_compat[= ] __initconst =3D { arch/arm/mach-shmobile/setup-r8a7793.c:22:static const char *r8a7793_bo= ards_compat_dt[] __initconst =3D { arch/x86/kernel/cpu/perf_event_intel_rapl.c:66:static const char *rapl_= domain_names[NR_RAPL_DOMAINS] __initconst =3D { drivers/clk/pistachio/clk.h:40:#define PNAME(x) static const char *x[] = __initconst > > `__sw_hweight32' referenced in section `.text' of /tmp/ccUCMU7n.ltr= ans13.ltrans.o: defined in discarded section `.text' of lib/built-in.o = (symbol from plugin) > > `__sw_hweight32' referenced in section `.text' of /tmp/ccUCMU7n.ltr= ans13.ltrans.o: defined in discarded section `.text' of lib/built-in.o = (symbol from plugin) > > `__sw_hweight32' referenced in section `.text' of /tmp/ccUCMU7n.ltr= ans13.ltrans.o: defined in discarded section `.text' of lib/built-in.o = (symbol from plugin) > > `__sw_hweight32' referenced in section `.text' of /tmp/ccUCMU7n.ltr= ans13.ltrans.o: defined in discarded section `.text' of lib/built-in.o = (symbol from plugin) >=20 > This needs >=20 > https://git.kernel.org/cgit/linux/kernel/git/ak/linux-misc.git/commit= /?h=3Dlto-4.0&id=3Dd826425f7a9d935d521989bd0a871b76fb4c59e2 OK, noted. > > /tmp/ccUCMU7n.ltrans21.ltrans.o: In function `do_exit': > > :(.text+0xfc0): undefined reference to `sys_futex' > > /tmp/ccUCMU7n.ltrans22.ltrans.o: In function `_do_fork': > > :(.text+0x39f7): undefined reference to `ret_from_fork' > > :(.text+0x4428): undefined reference to `ret_from_kerne= l_thread' >=20 >=20 > That's new, but can be fixed by adding __visible or asmlinkage to the= se symbols > I guess it's from the recent entry* restructuring. >=20 > I'll do an updated tree later. >=20 > Everything that's called from assembler in C needs to be marked like = this. It's > fairly mechanic. OK, thanks for the information! Takashi