Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp751284lqb; Fri, 15 Mar 2024 05:46:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUTWLyU6VBol2WDA7SJ6cnD5qhK9mODvvr9oYjfD3F2wt+bOHy82ZbV6clUDwh4T6BGnGjs32ZiRlf7H6h18uuQUyBG4i0cDahkkMiww== X-Google-Smtp-Source: AGHT+IGlRCPVRqbMllw3H4c8NwiUiDEArE2FdtJorPrmOI7F+CDAsWDfhhEEP7taw7HMRAdX77vq X-Received: by 2002:a17:906:298b:b0:a46:1861:ffdb with SMTP id x11-20020a170906298b00b00a461861ffdbmr2889880eje.35.1710506803079; Fri, 15 Mar 2024 05:46:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710506803; cv=pass; d=google.com; s=arc-20160816; b=WiAcqTLytZ2gxYgngKLCwPrasQYSF01lb7mPPfBRlU8PI1KzVZ5ugsdbOG06wJkgZC WcgtK36o7Rf8ql0ckg2Jo72mpM8kfxvZc/LrxkoINMUPvoL2ZZ5JUzpWs8ZEYtuAe1vz PzXN+teaswve68IGJaNY4YeZPOvLyVkDFUJVWN9WdcwvPpsIdpp6vJODoDVNi3QvMC1F HpfIUxI9XBaIoUqzvMm3rblznIca+4H25cDaM3GDbtNU1eg6RftkSo2vYUhaoIsubVHS x8LXQB/3kTsAyRihF5IrQwL0VJZWjyxhRNV5pbCjdbIhvh/aLOikMJ+CEmTMhKT5S+YW ckNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=oblVSvzBxp0ZpfurpzRuswbTr88/gt4o0IlCcS6gWEM=; fh=uc7UeJN5sK2YpKVC0jU5hEIfpXOcHbzgKV1OxpA0Hts=; b=CvRJBtH/GHgW65Ubk+q5HrUxrRYcbvXiLA65HmE1iqKeXkDnSc4r8mHkqg8Aeo7emo eifC7J4SdV6AdvNpEBHzOES+sdiY7QEK75tJYtLjgTrY6ZXymX8zPEmA0iz11HMjQAsf OccrDijMT+P9bo1nN7+2xOqV29zQjEnhP70w6Qb3WqXo3Ia4YwOXvqp5x1peI2Nx95fY iGSJIcMK97Ar3mo63vLmBr6oHepWtPSiDvAjEOuM8kRI8MXqAn8xZ46M/wAo7hNCbwGj JCz4Q8y4+Xn8oq8M4Ih/6tfVFLoJKmmz5C9sKtTA1r5Fnl0xPjulgFqP8txqBmmW6POI +oxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HKA1JLl0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i10-20020a170906a28a00b00a466b217280si1694020ejz.759.2024.03.15.05.46.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 05:46:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HKA1JLl0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9FC0C1F21956 for ; Fri, 15 Mar 2024 12:46:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B372C24B28; Fri, 15 Mar 2024 12:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HKA1JLl0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB527249F1 for ; Fri, 15 Mar 2024 12:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710506794; cv=none; b=a1pUEXOhgNBnX2kRieUzRc1Zug8vzKn7LwfBUCV6MH1R2v6Bun/qwazQ+iUqsq33M4OF/BT3qOjmBYlGFzhN6ZDzc4xWLj9kToymqE08Vb8Pzzs0ygVqdBTkNDZzVIOvmS5eaAj7vxAhAhPO6SDM83/yeAv+piVrWHNt2XdB3XQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710506794; c=relaxed/simple; bh=rqJ7R+Y+vyOPWW6w+w+qtUwG6Z3ku9AaPwFrCMaepeo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=esXjf36tGqGFCPHpqQYKKLq9UyQ/bv2j6QqQNVLHwp+klpxxJ+4YBHj9JdOWoCYcyr/nG8ZeddLOataswOPNHJFNDTr/haVkwzWFaDs10tFUC7bnyYq1zPgAbszcGjIUKa75XtqemcZYtV5U6NcsUQWpjSj+AbvjsLcWm/6qD7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HKA1JLl0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 755DCC433A6 for ; Fri, 15 Mar 2024 12:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710506794; bh=rqJ7R+Y+vyOPWW6w+w+qtUwG6Z3ku9AaPwFrCMaepeo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HKA1JLl04VtUAP/1tVF8Qc4hpR5Y7kfbOwaZrC8xXJxKecqkTQhV4zxyCT1KQG84A w4lEvEOdlwcYw07i+idIKophhkjtgolOk+BRI1NBrsAeUeptVgVV+T6fG3rJ/N8UDM HLsprVIafz1lEZb41bccrKhqtnue40urqVwL+LxBf3eAbekHaWZntbGvGbPR6n42Bc 8MSoK9JbWHfFm2GP+e7Jik13DPHKRX66DHAua8OjqPEr6NVCutpa77M51LbYW6rNx/ 7szTUsP9r+FMw75iEnsXuXsq+G1O9eCk+MnUBgQO7Ypq89ft4OS2Q0Mb5GmSz8xwfH n5aBdOxXr9SUw== Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-513dc9d6938so304388e87.2 for ; Fri, 15 Mar 2024 05:46:34 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUuBY0SQg3Wifz7qNZYoJr+Q6/d6rCqf34mZzgXEuvu1hblJozy0xMF194X3oiRe9LsD+nyCKRk2h/eL1ad1S33LiI/rxj1MD75JJwF X-Gm-Message-State: AOJu0YxXYJHzqocbyP1/XV4gSS/a/yykbJ0FK7OJjdy3LfnR+rwAag0P AHrAqX/Sj4cAhrSE29JwayCvKpfuAsyXXmWWqC4o1j8VZMXo2zeAUTyg8J4a63oZZaOCpD2/i0f iLbhjqbsBK/cH9LS6d/gIq+pS9zI= X-Received: by 2002:a19:f50f:0:b0:513:ce42:e2d0 with SMTP id j15-20020a19f50f000000b00513ce42e2d0mr3114680lfb.46.1710506792718; Fri, 15 Mar 2024 05:46:32 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240315063154.696633-1-liuyuntao12@huawei.com> <31f3a3fe-b16f-47a9-8c41-80fc0a236d52@huawei.com> In-Reply-To: <31f3a3fe-b16f-47a9-8c41-80fc0a236d52@huawei.com> From: Ard Biesheuvel Date: Fri, 15 Mar 2024 13:46:21 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH-next v3] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION To: "liuyuntao (F)" Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Russell King , Andrew Davis , Andrew Morton , "Kirill A. Shutemov" , Geert Uytterhoeven , Jonathan Corbet , Mike Rapoport , Rob Herring , Thomas Gleixner , Linus Walleij , Fangrui Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 15 Mar 2024 at 13:22, liuyuntao (F) wrote: > > > > On 2024/3/15 20:13, Ard Biesheuvel wrote: > > On Fri, 15 Mar 2024 at 13:10, liuyuntao (F) wr= ote: > >> > >> > >> > >> On 2024/3/15 19:51, Arnd Bergmann wrote: > >>> On Fri, Mar 15, 2024, at 12:48, liuyuntao (F) wrote: > >>>> On 2024/3/15 18:46, Ard Biesheuvel wrote: > >>>>> @@ -28,6 +28,7 @@ > >>>>> -DEFI_HAVE_MEMCHR -DEFI_HAVE_= STRRCHR \ > >>>>> -DEFI_HAVE_STRCMP -fno-builti= n -fpic \ > >>>>> $(call cc-option,-mno-single-= pic-base) > >>>>> +cflags-$(CONFIG_ARM) :=3D $(filter-out -fdata-sections, = $(CFLAGS-y)) > >>>>> cflags-$(CONFIG_RISCV) +=3D -fpic -DNO_ALTERNATIVE -mno= -relax > >>>>> cflags-$(CONFIG_LOONGARCH) +=3D -fpie > >>>> > >>>> Another error: > >>>> cannot initialize array of =E2=80=98short unsigned int=E2=80=99 from= a string literal > >>>> with type array of =E2=80=98unsigned int=E2=80=99 > >>>> 17 | static const efi_char16_t shim_MokSBState_name[] =3D L"MokS= BStateRT"; > >>> > >>> The line sets cflags-y to an empty string. > >>> > >>> It probably should have been > >>> > >>> cflags-$(CONFIG_ARM) :=3D $(filter-out -fdata-sections, $(c= flags-y)) > >>> > >>> (small cflags instead of CFLAGS). > >>> > > > > Oops indeed. > > > >> Oh, my mistake, after fixed this bug, still this error: > >>> arm-linux-gnueabi-ld: warning: orphan section `.data.efi_loglevel' fr= om `drivers/firmware/efi/libstub/printk.stub.o' being placed in section `.d= ata.efi_loglevel' > >>> arm-linux-gnueabi-ld: warning: orphan section `.data.screen_info_guid= ' from `drivers/firmware/efi/libstub/screen_info.stub.o' being placed in se= ction `.data.screen_info_guid' > >>> arm-linux-gnueabi-ld: warning: orphan section `.data.cpu_state_guid' = from `drivers/firmware/efi/libstub/arm32-stub.stub.o' being placed in secti= on `.data.cpu_state_guid' > >>> arm-linux-gnueabi-ld: warning: orphan section `.data.efi_nokaslr' fro= m `drivers/firmware/efi/libstub/efi-stub-helper.stub.o' being placed in sec= tion `.data.efi_nokaslr' > >> > >> The -fdata-sections option is present in the KBUILD_CFLAGS_KERNEL > >> variable; altering cflags-y only affect the KBUILD_CFLAGS variable. > >> It seems that the -fdata-sections option needs to be removed from the > >> KBUILD_CFLAGS_KERNEL variable. > > > > Indeed. > > > > So > > > > KBUILD_CFLAGS_KERNEL :=3D $(filter-out -fdata-sections,$(KBUILD_CFLAGS_= KERNEL)) > > > > (assuming I got it right this time without build testing) > > Um, it not worked,too, same error. Aren't you missing a 'L' ? > > --- a/drivers/firmware/efi/libstub/Makefile > > +++ b/drivers/firmware/efi/libstub/Makefile > > @@ -28,6 +28,7 @@ cflags-$(CONFIG_ARM) +=3D -DEFI_HAVE_STRLEN = -DEFI_HAVE_STRNLEN \ > > -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR= \ > > > > ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION > > KBUILD_CFLAGS_KERNEL +=3D -ffunction-sections -fdata-sections > > KBUILD_RUSTFLAGS_KERNEL +=3D -Zfunction-sections=3Dy > > LDFLAGS_vmlinux +=3D --gc-sections > > endif > > -DEFI_HAVE_STRCMP -fno-builtin -fpic \ > > $(call cc-option,-mno-single-pic-bas= e) > > +KBUILD_CFLAGS_KERNE :=3D $(filter-out -fdata-sections, $(KB= UILD_CFLAGS_KERNE)) > > cflags-$(CONFIG_RISCV) +=3D -fpic -DNO_ALTERNATIVE -mno-relax > > cflags-$(CONFIG_LOONGARCH) +=3D -fpie > >