Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4640480pxu; Tue, 13 Oct 2020 03:40:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbJuo4elFPyXQ3+FmlUV64pWkB97i8C4ZQeCVtoUw4wflh4QKqx5QKrfIS0NRYD5skIc6y X-Received: by 2002:aa7:d38d:: with SMTP id x13mr2987750edq.355.1602585617532; Tue, 13 Oct 2020 03:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602585617; cv=none; d=google.com; s=arc-20160816; b=XguEB+IwriQb+IKx0mrYDoBxci0VPJyU6GW+hkQCqT6syKfUEa4NycWauyczqDZVH8 u9OaCnYH8w7g++jYKH89ELco7bNc2lOk33kNR8bGfdFcpc86nv0/T64WaouI70UZBJjB MrUt6P/YD6nCTT09SROmxRJ5K+GcSDDlT1G+miMoPwFHOsVzh36OkgzZRMlp4whjqYFK Wh54sZ1BAkZFF9PBgR4iOQrJqvzJwi+ESQ2xtA1HApfpbRujeUpv9+salRAzcYg6ECsr RSx70G1bdqfCvKJT51VdgZFwD0Tnb3hjo1RDtc2oA/vNj494L9oQcP8u/aIma7HYuuRY uhfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hznOtUbTWNjEJYZsjBYfp17ENA2WPtrRZnCCOjoEFpg=; b=YLEnaSe2dCbVsDZyInlSxAZXwaNS8+Kow3UFSASsw7z3BlLtj+TCNsj5dxDQdznSRL obYXBfZB/6kFaEkO+fDbeKt1QJyp3Kidr9s6lMpWju50KnGFJef+ZSNv9U1dKyQ1tFJz USjJ2Wunlkhoprp7sMA6PpBZa7L+pVA4GNB1tqZ3eyKJS+Bi6klO6qTX30cCCY1Av2lO h0LB7mhCLMH1GLctz+eGjFR7UTS8YiKt7zUuzX62YAXkO/oARnZ/i9KlhBP2O2Eu2a5B bnMyPkrDrXFMbHqCiD9Vq0GyYxXv60BhBwcE7gQbKcYYK2NZE+JYz+PH+gyknQOrtsyA QWZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dwXUraXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn26si14145000edb.171.2020.10.13.03.39.55; Tue, 13 Oct 2020 03:40:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dwXUraXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732101AbgJLVLC (ORCPT + 99 others); Mon, 12 Oct 2020 17:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729366AbgJLVLC (ORCPT ); Mon, 12 Oct 2020 17:11:02 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EED6C0613D0 for ; Mon, 12 Oct 2020 14:11:02 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id b193so14723858pga.6 for ; Mon, 12 Oct 2020 14:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hznOtUbTWNjEJYZsjBYfp17ENA2WPtrRZnCCOjoEFpg=; b=dwXUraXOTIKRcxZp0pwYP1Y3/n3gOd1Dq6LzEx6rfD3EeWGFNXaEVc2LnZ43hGvxhS MCb1/J0RxXgroLEIMLgGrEr093nMx28OmuDFOtqPvj5hi9PqBgFKQx5pN/d17e6T9Gom itnPlTQvDOsFIAFxUjGZZ0ADAOaU+BmYJJrGsbpuBOP0RyBwwn/8vcthLx+3Ii18Wf37 nNpSFfPYX1bEUA/b2QAJ1FfgRVbTv6J/FIPcZBazae4+yoCvvYiDkIEQVFXkpRjVDDUP SduXSoJr4gUvwbd40c98CqJJLH7WwFhreaNYRthZAvNZzG04IcLR0t0aeLZp8s2TaoQV JSdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hznOtUbTWNjEJYZsjBYfp17ENA2WPtrRZnCCOjoEFpg=; b=bV2UPkhaBdZMZC1fpziMiwfNEGo7GsGuYDhuilz582cgc8E547wvL1+bpFYQVc4WrJ f48exwCL2VvEcKGZyY3+ugrpTZyxaH3nuDy5I8BL8HMVQsYUaOL/tny90RmsO0SUt6kr yiM7F/6AUOdRigmgO5HLK/o10btlhIAJH8hiIY3genJZXoBt5QcJm30Zy1f9CqjWm+k7 RgC0G9EaZypTz93cTH+T2qEgsVe4VEp8OR4cCitHRblqZ76qA0pSnVl/j1hqcPuifONU RjEPf2QK4ocKIDAJ7Kmf4/P8js5rjHtW8H3rRBbgdoD3IeT+RshFjGuEh7RxTHSrMdbt pmdA== X-Gm-Message-State: AOAM530hIVGQzbWKOklUkf5u2fV3Gn4p3aRSuS0U5+Vx6W9L/MZFFV6V NFWh08hfht7CuGeGtWEC+X5R86gn9x2v6+IGPYMXcEnv5+bK/Q== X-Received: by 2002:a62:6408:0:b029:154:dde2:a5eb with SMTP id y8-20020a6264080000b0290154dde2a5ebmr26213344pfb.30.1602537061565; Mon, 12 Oct 2020 14:11:01 -0700 (PDT) MIME-Version: 1.0 References: <20200928224854.3224862-1-natechancellor@gmail.com> In-Reply-To: <20200928224854.3224862-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Mon, 12 Oct 2020 14:10:50 -0700 Message-ID: Subject: Re: [PATCH] arm/build: Always handle .ARM.exidx and .ARM.extab sections To: Nathan Chancellor Cc: Kees Cook , Ingo Molnar , Russell King , Linux ARM , LKML , clang-built-linux , kernel test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 3:49 PM Nathan Chancellor wrote: > > After turning on warnings for orphan section placement, enabling > CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes > thousands of warnings when clang + ld.lld are used: > > $ scripts/config --file arch/arm/configs/multi_v7_defconfig \ > -d CONFIG_UNWINDER_ARM \ > -e CONFIG_UNWINDER_FRAME_POINTER > $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage > ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab' > ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text' > ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab' > ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab' > ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab' > ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text' > ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab' > > These sections are handled by the ARM_UNWIND_SECTIONS define, which is > only added to the list of sections when CONFIG_ARM_UNWIND is set. > CONFIG_ARM_UNWIND is a hidden symbol that is only selected when > CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never > handles these sections. According to the help text of > CONFIG_UNWINDER_ARM, these sections should be discarded so that the > kernel image size is not affected. My apologies for taking so long to review this. I have a suspicion that these come from forcing on configs that Kconfig/menuconfig would block, and aren't clang or lld specific, yet are exposed by the new linker warnings for orphan section placement (good). That said, we definitely have OEMs in Android land that still prefer the older unwinder. From https://developer.arm.com/documentation/ihi0038/b/ (click download in top left), section 4.4.1 "Sections" has a note: ``` Tables are not required for ABI compliance at the C/Assembler level but are required for C++. ``` Review-by: Nick Desaulniers Tested-by: Nick Desaulniers Please submit to: https://www.arm.linux.org.uk/developer/patches/add.php > > Fixes: 5a17850e251a ("arm/build: Warn on orphan section placement") > Link: https://github.com/ClangBuiltLinux/linux/issues/1152 > Reported-by: kernel test robot > Signed-off-by: Nathan Chancellor > --- > arch/arm/kernel/vmlinux.lds.S | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S > index 5f4922e858d0..a2c0d96b0580 100644 > --- a/arch/arm/kernel/vmlinux.lds.S > +++ b/arch/arm/kernel/vmlinux.lds.S > @@ -40,6 +40,10 @@ SECTIONS > ARM_DISCARD > #ifndef CONFIG_SMP_ON_UP > *(.alt.smp.init) > +#endif > +#ifndef CONFIG_ARM_UNWIND > + *(.ARM.exidx*) I don't think we need the wildcard, as without this line, I see: ld.lld: warning: :(.ARM.exidx) is being placed in '.ARM.exidx' though I do see binutils linker scripts use precisely what you have. So I guess that's fine. I guess we can't reuse `ARM_UNWIND_SECTIONS` since the ALIGN and linker-script-defined-symbols would be weird in a DISCARD clause? > + *(.ARM.extab*) > #endif > } > > > base-commit: 6e0bf0e0e55000742a53c5f3b58f8669e0091a11 > -- -- Thanks, ~Nick Desaulniers