Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3059066ybt; Mon, 29 Jun 2020 14:11:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMxfRvfrxtOznD+1gr60AhFKq3qVQm1Y6rjHypqG0l9p69FM2/Cu0QhaqCARCNNvO/vHWU X-Received: by 2002:a17:906:1998:: with SMTP id g24mr11025380ejd.11.1593465106917; Mon, 29 Jun 2020 14:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593465106; cv=none; d=google.com; s=arc-20160816; b=JQbBryFWXH2UrnndGR4q/+4MExSXS1+GLClKcHHbI47iZlSBs9pIY/cw7qu1c+hBtY b0iXq2wgA9rn4V8+VQyKVTwZB825a6y1L00oba8RmWw3nV79Zn4sCb/g16lUm9NfT6G3 +Nw153uPCX/zvAdXMZrURK80miBHSY2dex+yX4Qz+Dwt4sYf1Z0vFUVwwouQLSHnqknl OP95ej8y1aRLRryqwJnEEKs86PkrzQ9fCD1ji2q1ILTYJoRPq4yNAqlcUpnZS34qbeDz jW42gf7+403mOOoLkoyFHwhJ+MVIB/pShP1K5qDi5oBGD3DBjS6/6dBUbZPaLF7GNaIB 9cug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A9vYBl6N6MRqlb442wGyMbL/DRsRFl0/FAE55Sinfr4=; b=pte2k8mDHJzgvKUAdjJGiy26F9aqCOPbaX3CoF1MsAkcv/3USc6NH3F4NiIOEsdCeb LSSpL4n7DktrEBmefdutFLxdRenElfEHWXgwanO4rByjXQNRpddq+Z2alS81Q8GwtS2n 7lWVrOBG+eiJNjGYwII+7ufr/gzgcjBKmt+mwrR+EecgnPVO69BnNEkvTyi1ll6Ef06q kdAOQfQD3dTToRX17FJ6mQCrn+z8a5E0ePDjDZl1V0/CpiRVqejA6toYDHz/fUHfbPxW mkETkpnOzY4khznT77chzKO1mDh7MPLraqsyauf6lvzsxPultCGt5RndtXoA+L/Pet4b VVyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gFrAFx3F; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv20si381828ejb.420.2020.06.29.14.11.24; Mon, 29 Jun 2020 14:11:46 -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=@kernel.org header.s=default header.b=gFrAFx3F; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390437AbgF2VIo (ORCPT + 99 others); Mon, 29 Jun 2020 17:08:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:45478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730324AbgF2TAT (ORCPT ); Mon, 29 Jun 2020 15:00:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5333C254F3; Mon, 29 Jun 2020 15:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593446049; bh=vEjf/A/Kuk4YUAnfqpXqh4UJDM3Zzu27UFabstohaUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFrAFx3FByWmQZmM9OIcoVfMsfN04qTeAze0mPT8VKH/Qz3rFSHdGX24He1pQh+aU DYX2BTj+JajscGIp7R41cNx/FKXpFaHfpbLO9pHHt2GoiJsqGK7SwbwkrgeG5lEJci vGgQEQBRVw2uEyfuIa/n30c8tIEeQbfNon5eddlA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nick Desaulniers , Andrew Morton , Nathan Chancellor , Fangrui Song , Jeremy Fitzhardinge , Thomas Gleixner , Vincenzo Frascino , Ilie Halip , Linus Torvalds , Sasha Levin Subject: [PATCH 4.4 052/135] elfnote: mark all .note sections SHF_ALLOC Date: Mon, 29 Jun 2020 11:51:46 -0400 Message-Id: <20200629155309.2495516-53-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629155309.2495516-1-sashal@kernel.org> References: <20200629155309.2495516-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.229-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.229-rc1 X-KernelTest-Deadline: 2020-07-01T15:53+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Desaulniers [ Upstream commit 51da9dfb7f20911ae4e79e9b412a9c2d4c373d4b ] ELFNOTE_START allows callers to specify flags for .pushsection assembler directives. All callsites but ELF_NOTE use "a" for SHF_ALLOC. For vdso's that explicitly use ELF_NOTE_START and BUILD_SALT, the same section is specified twice after preprocessing, once with "a" flag, once without. Example: .pushsection .note.Linux, "a", @note ; .pushsection .note.Linux, "", @note ; While GNU as allows this ordering, it warns for the opposite ordering, making these directives position dependent. We'd prefer not to precisely match this behavior in Clang's integrated assembler. Instead, the non __ASSEMBLY__ definition of ELF_NOTE uses __attribute__((section(".note.Linux"))) which is created with SHF_ALLOC, so let's make the __ASSEMBLY__ definition of ELF_NOTE consistent with C and just always use "a" flag. This allows Clang to assemble a working mainline (5.6) kernel via: $ make CC=clang AS=clang Signed-off-by: Nick Desaulniers Signed-off-by: Andrew Morton Reviewed-by: Nathan Chancellor Reviewed-by: Fangrui Song Cc: Jeremy Fitzhardinge Cc: Thomas Gleixner Cc: Vincenzo Frascino Link: https://github.com/ClangBuiltLinux/linux/issues/913 Link: http://lkml.kernel.org/r/20200325231250.99205-1-ndesaulniers@google.com Debugged-by: Ilie Halip Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- include/linux/elfnote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h index 278e3ef053369..56c6d9031663d 100644 --- a/include/linux/elfnote.h +++ b/include/linux/elfnote.h @@ -53,7 +53,7 @@ .popsection ; #define ELFNOTE(name, type, desc) \ - ELFNOTE_START(name, type, "") \ + ELFNOTE_START(name, type, "a") \ desc ; \ ELFNOTE_END -- 2.25.1