From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC733C4332F for ; Fri, 9 Dec 2022 19:29:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A732E85254; Fri, 9 Dec 2022 20:29:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rOIZbEd6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C720785279; Fri, 9 Dec 2022 20:29:37 +0100 (CET) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2738781417 for ; Fri, 9 Dec 2022 20:29:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x62d.google.com with SMTP id fc4so13715241ejc.12 for ; Fri, 09 Dec 2022 11:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JcnZxCoBPMJ1/VKQhhavafK4f3ogVeTAx3lY8lf42vs=; b=rOIZbEd6miAuo1N6JRlVvfPi75YsT/NFQoz0LuD55hhzQvKI2otwN2cvyVOCHn94Co nQv4zvojojzGUAEL+Y8rNCryvFKPhC0z2lh8n63K5VfZStbDTp1ADx8H6vcS+VuPsuBY bMTQtPEZvlLqogstD8mE63IuXuo28CZMOy5CgXaVU730KkmTUNBcYKg/rXHvaYLNVSEH Iqtxa+AwuY3pGFvMTNWNHX3rxIf+3krvR5oNurZEyg+aGpSK/GoNk3hrIqJzT9cQ+6yH q3kTOXU2tcXuLeU5AcgcGMQ6thJCFcBUS1WGrFWWrxIsyuGJlRE6n3HRHajfXt1s7oJk g/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JcnZxCoBPMJ1/VKQhhavafK4f3ogVeTAx3lY8lf42vs=; b=Dfkbi8YKLieKHx0ovCMgOBwJQnmiVVIFtwmyzDTIMMW6wc9BBpKlNcMWTlNiLZwxSM HPp1jII+aaDiCFqt0NFbZD++bd/h6Prji2bPFEeV7vlX7opJBzPMCWY/upTz/1yvvdfE auVfnJ7zP3f+N5BLs8/k0oU6B8FCeZK+GAaV44+iqic0EDSlnldLmDYWMYlFp0SWjODu EStQ91OiJAzmCQ5vaag94tM1GGIUbdsYP/HoovTStvjYZJEP35+B7AvIiasyKzZ8hiTV Q7WBPwWyL4MB6EdSgWTJHcxZzFke6kPzSnpkVvaTSTFLcHzziQp8bNrYyp1Tt5eIpwCD KXWQ== X-Gm-Message-State: ANoB5pkPJyINsgGdUrokp+2FvjYoUpKMVRLk1FLcwH+XWnNn4qaFO8u4 mAfCRHPr0Sw1YbNwGYjGya5GqQ== X-Google-Smtp-Source: AA0mqf5WSYcu5bKgi6bqUSxfnAh7gPqVeVErdqCggbmAvT2irMwejfc7w96b6wdCSI8qEBYtG5CaWA== X-Received: by 2002:a17:907:8a22:b0:78d:f455:b4d8 with SMTP id sc34-20020a1709078a2200b0078df455b4d8mr6978653ejc.63.1670614174697; Fri, 09 Dec 2022 11:29:34 -0800 (PST) Received: from hera (ppp078087234022.access.hol.gr. [78.87.234.22]) by smtp.gmail.com with ESMTPSA id ia4-20020a170907a06400b007c0f90792ffsm251629ejc.89.2022.12.09.11.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 11:29:34 -0800 (PST) Date: Fri, 9 Dec 2022 21:29:32 +0200 From: Ilias Apalodimas To: Tom Rini Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: Re: [PATCH] Makefile: link with --no-warn-rwx-segments Message-ID: References: <20221207204943.1352360-1-trini@konsulko.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221207204943.1352360-1-trini@konsulko.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Wed, Dec 07, 2022 at 03:49:43PM -0500, Tom Rini wrote: > We borrow from the Linux Kernel 0d362be5b142 ("Makefile: link with -z > noexecstack --no-warn-rwx-segments") here to disable the RWX segment > linking warnings. We do not also bring in -z noexecstack as that > requires auditing and using ".note.GNU-stack" on assembly functions > which do need this feature. Further, we now introduce KBUILD_EFILDFLAGS > so that we can also pass --no-warn-rwx-segments when linking EFI > applications, and those do explicitly pass -z execstack. > > Cc: Heinrich Schuchardt > Cc: Ilias Apalodimas > Signed-off-by: Tom Rini > --- > Makefile | 2 ++ > scripts/Makefile.lib | 6 ++++-- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 11efc4180414..839733836d9b 100644 > --- a/Makefile > +++ b/Makefile > @@ -806,6 +806,8 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS) > KBUILD_AFLAGS += $(KAFLAGS) > KBUILD_CFLAGS += $(KCFLAGS) > > +KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments) > + > KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g) > > # Use UBOOTINCLUDE when you must reference the include/ directory. > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib > index 8e13bf2b986d..ac45a8847859 100644 > --- a/scripts/Makefile.lib > +++ b/scripts/Makefile.lib > @@ -425,9 +425,11 @@ cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j \ > $(obj)/%.efi: $(obj)/%_efi.so > $(call cmd,efi_objcopy) > > +KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro > +KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments) > quiet_cmd_efi_ld = LD $@ > -cmd_efi_ld = $(LD) -nostdlib -zexecstack -znocombreloc -T $(EFI_LDS_PATH) \ > - -shared -Bsymbolic -znorelro -s $^ -o $@ > +cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -T $(EFI_LDS_PATH) \ > + -shared -Bsymbolic -s $^ -o $@ > > EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) > > -- > 2.25.1 > Reviewed-by: Ilias Apalodimas