From nobody Mon Nov 08 17:30:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7C7718379EC; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HnynF2F0Gz4mJ9; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D2CC15CA9; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8HUfvl037562; Mon, 8 Nov 2021 17:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8HUfPL037561; Mon, 8 Nov 2021 17:30:41 GMT (envelope-from git) Date: Mon, 8 Nov 2021 17:30:41 GMT Message-Id: <202111081730.1A8HUfPL037561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 2f4812936a2c - stable/12 - Fix lld warning "SHF_MERGE section size must be a multiple of sh_entsize" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2f4812936a2ccaadd260f6bbaacd677e6079d9d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2f4812936a2ccaadd260f6bbaacd677e6079d9d0 commit 2f4812936a2ccaadd260f6bbaacd677e6079d9d0 Author: Dimitry Andric AuthorDate: 2021-11-08 10:19:59 +0000 Commit: Dimitry Andric CommitDate: 2021-11-08 17:29:35 +0000 Fix lld warning "SHF_MERGE section size must be a multiple of sh_entsize" Merge commit 56decd982dc0 from llvm git (by Fangrui Song): [ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections Fixes https://bugs.llvm.org/show_bug.cgi?id=45370 Fixes https://github.com/Clozure/ccl/issues/273 .stab holds a table of 12-byte entries. GNU as before 2.35 incorrectly sets sh_entsize(.stab) to 20 on 64-bit architectures: https://sourceware.org/bugzilla/show_bug.cgi?id=25768 We should not emit the confusing error: "SHF_MERGE section size (...) must be a multiple of sh_entsize (20) Reviewed By: grimar, psmith Differential Revision: https://reviews.llvm.org/D77368 Direct commit to stable/12, since newer branches have this fix already. PR: 245179 Reported by: andrew@tao11.riddles.org.uk --- contrib/llvm-project/lld/ELF/InputFiles.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/llvm-project/lld/ELF/InputFiles.cpp b/contrib/llvm-project/lld/ELF/InputFiles.cpp index 43978cd66c61..21d528be6927 100644 --- a/contrib/llvm-project/lld/ELF/InputFiles.cpp +++ b/contrib/llvm-project/lld/ELF/InputFiles.cpp @@ -417,6 +417,9 @@ StringRef ObjFile::getShtGroupSignature(ArrayRef sections, template bool ObjFile::shouldMerge(const Elf_Shdr &sec, StringRef name) { + if (!(sec.sh_flags & SHF_MERGE)) + return false; + // On a regular link we don't merge sections if -O0 (default is -O1). This // sometimes makes the linker significantly faster, although the output will // be bigger. @@ -452,10 +455,7 @@ bool ObjFile::shouldMerge(const Elf_Shdr &sec, StringRef name) { Twine(sec.sh_size) + ") must be a multiple of sh_entsize (" + Twine(entSize) + ")"); - uint64_t flags = sec.sh_flags; - if (!(flags & SHF_MERGE)) - return false; - if (flags & SHF_WRITE) + if (sec.sh_flags & SHF_WRITE) fatal(toString(this) + ":(" + name + "): writable SHF_MERGE section is not supported");