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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEE95C2B9F4 for ; Thu, 17 Jun 2021 16:12:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C3EBD613A9 for ; Thu, 17 Jun 2021 16:12:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3EBD613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE45182B15; Thu, 17 Jun 2021 18:12:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="WY2by/7n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7429C82B3D; Thu, 17 Jun 2021 18:12:46 +0200 (CEST) Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (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 17F2A82ADF for ; Thu, 17 Jun 2021 18:12:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x42e.google.com with SMTP id z26so5391836pfj.5 for ; Thu, 17 Jun 2021 09:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=k5scHUUleQ4M4952Ym6caZP0MXYLoGdaOYiV9hd3lsE=; b=WY2by/7niT8GnKRs3/cwPqK/ftE1u3IQJEvpkYh3/E7nNfzPNOqbE7vu2aoydLOZKN 9UZyoBJ43mlcw223CJS9Bu6aQevH93Rp0VAIXWHaWDdSaUZ8uHFFl3auE1hbdu+fzZiQ siRI/z+vVZ/BkzpxkkTZEbwEbzt3bKYasf3Mon+mtnrcUTBMavarkgCyR3YX947v8HUk UnBpUYUHvCgVsrKGoFlvdmKdut+bEFK5n1D9Ae7l5A0c5imy24Q3+IU9LZCxbbu7HdZ1 dxZRitFmFii0ji/zvgTikjYvEYQcoxuWXCfR7yIcPCSV4RbiJdTvKHCa5qASKBreKQPZ 0I7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=k5scHUUleQ4M4952Ym6caZP0MXYLoGdaOYiV9hd3lsE=; b=r4HZM5wKd6CwGNyVe1OeFwGKV+8ftVq+6caSEyhWO4B4qrCV2W+wdRyrg8AnMCxOMM FsoloZ2G6QRubrh4QsYtf7pjSjZYnLAh3ixj9RkoYycbRJO/vlEpol2rJpk//WRQ/o5N qM+gzELvF5h7AFpbOCNEebu6ZPDarj5NYhjS3lGF5tU/nQ/IYVPS3ClYsUhcoYo9RP73 eahEK7g/4KBDC9PNPFhuDxxnEsDBZB0i1Z2LdSwNFOau/k+hAW+WMpY4F5x633s/iV4M nu/HzJhMUx8cPFuNTB5f8dYZHo0OnlUOizktrY2ZveInalrehpbapktfe8FfNNP3/ql6 utiQ== X-Gm-Message-State: AOAM530//Zl+Zuwaf7UTDwh/bw1TtaT6DUvEwTGp06I0PCqKGDm265pJ cxnNOUHJdK1lpcj0NdbuUPE= X-Google-Smtp-Source: ABdhPJwIjeklRGHRvP+sJLOe3UgieLXqF8cXyGg/z3B3q2dWfbZ745RrQwPDk9iWsUd7njttlXVDJA== X-Received: by 2002:aa7:838b:0:b029:2ea:3332:dd8a with SMTP id u11-20020aa7838b0000b02902ea3332dd8amr743711pfm.74.1623946361314; Thu, 17 Jun 2021 09:12:41 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id b123sm5740991pfg.62.2021.06.17.09.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 09:12:40 -0700 (PDT) From: Bin Meng To: Simon Glass , Tom Rini , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH] x86: Discard .note.gnu.property sections Date: Fri, 18 Jun 2021 00:12:28 +0800 Message-Id: <20210617161228.30746-1-bmeng.cn@gmail.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.34 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.2 at phobos.denx.de X-Virus-Status: Clean When switching to kernel.org x86_64 gcc 11.1.0 toolchain, u-boot.rom built from qemu-x86_defconfig no longer boots anymore. Investigation shows that U-Boot fails at a very early stage during the boot process, in fdtdec_prepare_fdt() where fdt_check_header() complains that there is not a valid device tree found at gd->fdt_blob which points to _end. Now _end points to an allocated section .note.gnu.property which of course is wrong. This issue is however not seen when using the default Ubuntu 20.04 gnu toolchain (gcc 9.3.0 with binutils 2.34). Further investigation shows that it is caused by a behavior change of binutils v2.36 which is part of the kernel.org gcc 11.1.0 toolchain, via the following commit: 939b95c77bf2 ("Linux/x86: Configure gas with --enable-x86-used-note by default") In fact, there was already a regression bug report [1] for binutils two months ago, but the binutils folks did not think it is a bug :( To resolve this, there are several options: * pass -Wa,-mx86-used-note=no to gas * pass -R .note.gnu.property to objcopy * discard the section in the linker script Linux kernel uses the discard way [2], so let's do the same for U-Boot. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=27753 [2] commit 4caffe6a28d3 ("x86/vdso: Discard .note.gnu.property sections in vDSO") Signed-off-by: Bin Meng --- arch/x86/cpu/u-boot.lds | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index a283c290ee..22fde01e74 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -105,6 +105,7 @@ SECTIONS /DISCARD/ : { *(.plt*) } /DISCARD/ : { *(.interp*) } /DISCARD/ : { *(.gnu*) } + /DISCARD/ : { *(.note.gnu.property) } #ifdef CONFIG_X86_16BIT_INIT /* -- 2.25.1