Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965749AbeAKTiP (ORCPT + 1 other); Thu, 11 Jan 2018 14:38:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965724AbeAKTiN (ORCPT ); Thu, 11 Jan 2018 14:38:13 -0500 Date: Thu, 11 Jan 2018 13:38:10 -0600 From: Josh Poimboeuf To: Markus Cc: Greg Kroah-Hartman , lkml , Ingo Molnar Subject: Re: objtool segfault with ORC unwinder enabled Message-ID: <20180111193810.27aguyr6viurhijm@treble> References: <1537667.mbZVOcHbLR@markus> <1574206.L1kTMSv4rA@markus> <20180111182057.psy4plwhfsetkuzc@treble> <5972474.su1l06OAAG@markus> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3xnjldigeiqaxdmw" Content-Disposition: inline In-Reply-To: <5972474.su1l06OAAG@markus> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 11 Jan 2018 19:38:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --3xnjldigeiqaxdmw Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Thu, Jan 11, 2018 at 07:52:00PM +0100, Markus wrote: > On Thursday, 11 January 2018 19:20:57 CET Josh Poimboeuf wrote: > > On Thu, Jan 11, 2018 at 07:11:03PM +0100, Markus wrote: > > > On Thursday, 11 January 2018 05:25:51 CET Josh Poimboeuf wrote: > > > > On Wed, Jan 10, 2018 at 10:13:00PM -0600, Josh Poimboeuf wrote: > > > > > On Wed, Jan 10, 2018 at 06:14:56PM +0100, Markus wrote: > > > > > > On Thursday, 4 January 2018 19:25:12 CET Markus wrote: > > > > > > > On Thursday, 4 January 2018 18:32:03 CET Josh Poimboeuf wrote: > > > > > > > > On Thu, Jan 04, 2018 at 05:56:30PM +0100, Markus wrote: > > > > > > > > > On Thursday, 4 January 2018 16:46:13 CET Josh Poimboeuf wrote: > > > > > > > > > > I don't see anything unusual there. Are there any Gentoo > > > > > > > > > > patches > > > > > > > > > > against either the kernel or GCC which would strip unused > > > > > > > > > > symbols? > > > > > > > > > > > > > > > > > > The kernel is the vanilla kernel. (4.14.11 and also 4.15-rc6) > > > > > > > > > Its not a gentoo specific gcc patch. (Then every gentoo user > > > > > > > > > would > > > > > > > > > be > > > > > > > > > affected?) > > > > > > > > > > > > > > > > > > But I enabled ld.gold as default linker like 5 years ago. > > > > > > > > > Never > > > > > > > > > had a > > > > > > > > > problem with this. > > > > > > > > > > > > > > > > > > Is ld.gold supposed to fail here? > > > > > > > > > > > > > > > > > > I switched back to ld.bfd and it seems to work. > > > > > > > > > > > > > > > > Ah, that explains it. With CONFIG_MODVERSIONS, the linker does > > > > > > > > some > > > > > > > > work after gcc, but before objtool. Can you try this patch? > > > > > > > > (Note > > > > > > > > this > > > > > > > > isn't the final patch, as this breaks the CONFIG_MODVERSIONS=n > > > > > > > > case.) > > > > > > > > > > > > Any more final patch I should test? > > > > > > > > > > Sorry, this fell off my radar. I'll try to get a final patch soon. > > > > > (But feel free to keep bugging me if I don't!) > > > > > > > > Ok, this should be the final patch (no description yet though). Want to > > > > test it? > > > > > > Tried to apply to 4.14.13 and 4.15-rc7. Neither applied cleanly. > > > Manually editing just breaks the build with many "open: No such file or > > > directory". > > > > > > Dont know what went wrong. Can you maybe append patch as file? > > > > Sure, patch is attached, based on 4.15-rc7. > > Applies cleanly to 4.15-rc7. But still: > HOSTCC scripts/asn1_compiler > HOSTCC scripts/extract-cert > CC init/main.o > open: No such file or directory > make[1]: *** [scripts/Makefile.build:317: init/main.o] Error 1 > make: *** [Makefile:1015: init] Error 2 > > > Reverting that patch makes it build again. Weird. Here's a version which should hopefully give a better error message. -- Josh --3xnjldigeiqaxdmw Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="objtool-gold-v2.patch" diff --git a/scripts/Makefile.build b/scripts/Makefile.build index cb8997ed0149..6f0c0c409e67 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -265,12 +265,18 @@ else objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable) endif +ifdef CONFIG_MODVERSIONS +objtool_o := $(@D)/.tmp_$(@F) +else +objtool_o := $(@) +endif + # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file cmd_objtool = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ - $(__objtool_obj) $(objtool_args) "$(@)";) + $(__objtool_obj) $(objtool_args) "$(objtool_o)";) objtool_obj = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ $(__objtool_obj)) @@ -286,16 +292,16 @@ objtool_dep = $(objtool_obj) \ define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call cmd_and_fixdep,cc_o_c) \ + $(call echo-cmd,objtool) $(cmd_objtool) \ $(cmd_modversions_c) \ $(cmd_checkdoc) \ - $(call echo-cmd,objtool) $(cmd_objtool) \ $(call echo-cmd,record_mcount) $(cmd_record_mcount) endef define rule_as_o_S $(call cmd_and_fixdep,as_o_S) \ - $(cmd_modversions_S) \ - $(call echo-cmd,objtool) $(cmd_objtool) + $(call echo-cmd,objtool) $(cmd_objtool) \ + $(cmd_modversions_S) endef # List module undefined symbols (or empty line if not enabled) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 24460155c82c..cc56e7ac8122 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -358,6 +358,7 @@ struct elf *elf_open(const char *name, int flags) elf->fd = open(name, flags); if (elf->fd == -1) { + fprintf(stderr, "objtool: can't open file %s\n", name); perror("open"); goto err; } --3xnjldigeiqaxdmw--