From owner-freebsd-bugs@freebsd.org Mon Mar 30 02:40:15 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C3AD26E09B for ; Mon, 30 Mar 2020 02:40:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 48rGs9634vz3wh9 for ; Mon, 30 Mar 2020 02:40:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id A5C2126E078; Mon, 30 Mar 2020 02:40:04 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A432526E076 for ; Mon, 30 Mar 2020 02:40:04 +0000 (UTC) (envelope-from bugzilla-noreply@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48rGrz4rDzz3wdf for ; Mon, 30 Mar 2020 02:40:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0437B99B for ; Mon, 30 Mar 2020 02:39:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 02U2dsXu076941 for ; Mon, 30 Mar 2020 02:39:54 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 02U2dsW0076940 for bugs@FreeBSD.org; Mon, 30 Mar 2020 02:39:54 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 245179] lld: wrong/misleading "SHF_MERGE section size must be a multiple of sh_entsize" Date: Mon, 30 Mar 2020 02:39:54 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: andrew@tao11.riddles.org.uk X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: mfc-stable12? mfc-stable11? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2020 02:40:15 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245179 Bug ID: 245179 Summary: lld: wrong/misleading "SHF_MERGE section size must be a multiple of sh_entsize" Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: andrew@tao11.riddles.org.uk CC: dim@FreeBSD.org, emaste@freebsd.org, kevans@freebsd.org Flags: mfc-stable12?, mfc-stable11? In function ObjFile::shouldMerge in lld/ELF/InputFiles.cpp: if (sec.sh_size % entSize) fatal(toString(this) + ": SHF_MERGE section size must be a multiple of sh_entsize"); uint64_t flags =3D sec.sh_flags; if (!(flags & SHF_MERGE)) return false; Notice that the size is checked _before_ looking at whether SHF_MERGE is se= t. This means that the error is produced for sections that do not have SHF_MER= GE set at all, which is either misleading or wrong. Judging by the report in #219717 where this was found, the BFD linker did n= ot care about sh_entsize of non-mergeable sections. If this check is only need= ed for mergeable sections, then surely it should be made _after_ SHF_MERGE is checked for. Since this check is skipped when -Wl,-O0 is in effect, I do not believe it = is actually necessary to check that size is a multiple of sh_entsize when not merging sections. If I'm wrong about that, though, then the check would nee= d to be both moved to somewhere else and changed to not mention SHF_MERGE in the error message. --=20 You are receiving this mail because: You are the assignee for the bug.=