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 32E2BC4708D for ; Wed, 7 Dec 2022 20:49:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E1EF282A12; Wed, 7 Dec 2022 21:49:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="uX01tu3s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A73B83600; Wed, 7 Dec 2022 21:49:50 +0100 (CET) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 538E182A0A for ; Wed, 7 Dec 2022 21:49:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-wr1-x429.google.com with SMTP id o5so29926066wrm.1 for ; Wed, 07 Dec 2022 12:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=igTz9+Wv8BWnFvEKeJH271QfJjb9VCR9bMarsHVQeuo=; b=uX01tu3sPJf9/Fu2/1miTXf15HHWESe7G2VG91/zj44E0dMNI2mloKN59SWu9cuNUk vgvzw9IDRxbu+j1a10A7jdMq0QPLQ2mkqltRN8dWIneazWVubdoVY9WjfsRCB1zM3gai l/pYCuYTyetm1ewzuw7qRvfV0/0tOHC6h1daQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=igTz9+Wv8BWnFvEKeJH271QfJjb9VCR9bMarsHVQeuo=; b=xAJljzMoO+YemUKP9Pgj/cHIUWaufPbc6Lh5lgBRayAUKAw2K3rQuuLE4oE6qSnxHZ UU3eijp+jM2AotBCdPbX3wYeqCzDAR1CtH/4+PDz73NeLRGGipcG1tA1L0An75UzMjIo zWjyKCevpWHSf4vEdM02u+ckZwe3Fnmr+HlRs+ddN3IZ1BWLhYKtt/1ZLYsu6K0UlpZV 2k48B330wjroAfHE1Epvi7GGia9/O3y7wiA6EFudSJ6MhQocrRmcCAATqDIMZH6xh8RX gjvriTswGTg+tF5mdGLImjejSWPz9Uv+wD1aZy9AZSXgp60tPt1Jk0pN24FA3tx61f6D IReA== X-Gm-Message-State: ANoB5pmbf0zmMCBxMZZXotTOtdM4wvh/QkJcAhxfLJrbLbx11XvGCUGJ qxCzn0hQ0xhwkRlvYnIuKU4DfQl79zJGeBmO X-Google-Smtp-Source: AA0mqf5HKS+NxzNkmgyfmDxY/dlQDPbo1E//zkSeex1U8wJDNyMuMRf2F0Ajen4ta9rhdy7/eikmLw== X-Received: by 2002:a05:6000:114e:b0:242:257f:3006 with SMTP id d14-20020a056000114e00b00242257f3006mr21947285wrx.147.1670446185615; Wed, 07 Dec 2022 12:49:45 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-158f-15c0-8c6a-f9d3.res6.spectrum.com. [2603:6081:7b00:6400:158f:15c0:8c6a:f9d3]) by smtp.gmail.com with ESMTPSA id z16-20020a5d4d10000000b00241c712916fsm24849372wrt.0.2022.12.07.12.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 12:49:45 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas Subject: [PATCH] Makefile: link with --no-warn-rwx-segments Date: Wed, 7 Dec 2022 15:49:43 -0500 Message-Id: <20221207204943.1352360-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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