From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753598AbdF2PhL (ORCPT ); Thu, 29 Jun 2017 11:37:11 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:18966 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753384AbdF2PhG (ORCPT ); Thu, 29 Jun 2017 11:37:06 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com v5TFai57027503 X-Nifty-SrcIP: [209.85.161.176] MIME-Version: 1.0 In-Reply-To: <4a610d3a-76de-7fec-40dc-61ec5ef175ee@roeck-us.net> References: <77ef6224-28f6-d71d-29d8-74b41fa26f0b@roeck-us.net> <20170628225837.25abba1e@roar.ozlabs.ibm.com> <4a610d3a-76de-7fec-40dc-61ec5ef175ee@roeck-us.net> From: Masahiro Yamada Date: Fri, 30 Jun 2017 00:36:42 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Build failure in -next due to 'sh: thin archives fix linking' To: Guenter Roeck Cc: Nicholas Piggin , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi. 2017-06-28 23:02 GMT+09:00 Guenter Roeck : > On 06/28/2017 05:58 AM, Nicholas Piggin wrote: >> >> On Wed, 28 Jun 2017 05:38:50 -0700 >> Guenter Roeck wrote: >> >>> Hi, >>> >>> I see the following build error in -next when building >>> sh:rts7751r2dplus_defconfig. >>> >>> sh4-linux-ld: arch/sh/kernel/vsyscall/vsyscall-dummy.o: compiled for a >>> big endian system and target is little endian >>> sh4-linux-ld: arch/sh/kernel/vsyscall/vsyscall-dummy.o: uses instructions >>> which are incompatible with instructions used in previous modules >>> sh4-linux-ld: failed to merge target specific data of file >>> arch/sh/kernel/vsyscall/vsyscall-dummy.o >>> make[2]: *** [arch/sh/kernel/vsyscall/vsyscall-syms.o] Error 1 >>> >>> Bisect points to 'sh: thin archives fix linking' as the culprit. Bisect >>> log is attached. >>> I tried with gcc 4.8.3 and 6.3.0, both built with buildroot for sh4eb. >> >> >> Thanks for the report. In arch/sh/kernel/vsyscall/Makefile, the line: >> >> cmd_syscall_syms = $(LD) -r -o $@ -R $< >> >> Can you try adding $(LDFLAGS), e.g. change it to: >> >> cmd_syscall_syms = $(LD) $(LDFLAGS) -r -o $@ -R $< >> > > That fixes the problem (including the missing symbols seen after reverting > the offending patch). Thanks! Instead of adding $(LDFLAGS), how about using cmd_ld? Please see line 260 of scripts/Makefile.lib quiet_cmd_ld = LD $@ cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ $(filter-out FORCE,$^) -o $@ We can reuse it and $(LDFLAGS) is already there. I also noticed redundant "targets += gate-syms.o" I see "obj-y += gate-syms.o" and $(obj-y) is automatically added to "targets". The following diff is my proposal. If it is OK, I will squash it and update the thin-ar branch. diff --git a/arch/ia64/kernel/Makefile.gate b/arch/ia64/kernel/Makefile.gate index 8cd125a..263ab51 100644 --- a/arch/ia64/kernel/Makefile.gate +++ b/arch/ia64/kernel/Makefile.gate @@ -1,6 +1,6 @@ # The gate DSO image is built using a special linker script. -targets += gate.so gate-syms.o gate-dummy.o +targets += gate.so gate-dummy.o obj-y += gate-syms.o @@ -16,16 +16,13 @@ GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \ $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE $(call if_changed,gate) -# create an object file to resolve gate symbols -quiet_cmd_gate_syms = GATESYM $@ - cmd_gate_syms = $(LD) -r -o $@ -R $< - GATECFLAGS_gate-dummy.o = -r $(obj)/gate-dummy.o: $(obj)/gate.lds $(obj)/gate.o FORCE $(call if_changed,gate) +LDFLAGS_gate-syms.o := -r -R $(obj)/gate-syms.o: $(obj)/gate-dummy.o FORCE - $(call if_changed,gate_syms) + $(call if_changed,ld) # gate-data.o contains the gate DSO image as data in section .data..gate. # We must build gate.so before we can assemble it. diff --git a/arch/sh/kernel/vsyscall/Makefile b/arch/sh/kernel/vsyscall/Makefile index 99685e5..6ab108f 100644 --- a/arch/sh/kernel/vsyscall/Makefile +++ b/arch/sh/kernel/vsyscall/Makefile @@ -31,8 +31,6 @@ $(obj)/vsyscall-dummy.o: $(src)/vsyscall.lds \ $(obj)/vsyscall-trapa.o $(obj)/vsyscall-note.o FORCE $(call if_changed,syscall) -quiet_cmd_syscall_syms = SYSCALL $@ - cmd_syscall_syms = $(LD) -r -o $@ -R $< - +LDFLAGS_vsyscall-syms.o := -r -R $(obj)/vsyscall-syms.o: $(obj)/vsyscall-dummy.o FORCE - $(call if_changed,syscall_syms) + $(call if_changed,ld) diff --git a/arch/tile/kernel/vdso/Makefile b/arch/tile/kernel/vdso/Makefile index c615ec0..0603ce6 100644 --- a/arch/tile/kernel/vdso/Makefile +++ b/arch/tile/kernel/vdso/Makefile @@ -55,11 +55,9 @@ SYSCFLAGS_vdso_dummy.o = -r $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE $(call if_changed,vdsold) -quiet_cmd_vdso_sym = VDSOSYM $@ - cmd_vdso_sym = $(LD) -r -o $@ -R $< - +LDFLAGS_vdso-syms.o := -r -R $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE - $(call if_changed,vdso_sym) + $(call if_changed,ld) # strip rule for the .so file $(obj)/%.so: OBJCOPYFLAGS := -S -- Best Regards Masahiro Yamada