From owner-freebsd-bugs@freebsd.org Mon Oct 15 15:44:43 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9018610DED9B for ; Mon, 15 Oct 2018 15:44:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 2CE05794D9 for ; Mon, 15 Oct 2018 15:44:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id E371110DED9A; Mon, 15 Oct 2018 15:44:42 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C194310DED99 for ; Mon, 15 Oct 2018 15:44:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A05A794D6 for ; Mon, 15 Oct 2018 15:44:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 9266320E22 for ; Mon, 15 Oct 2018 15:44:41 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w9FFifva037402 for ; Mon, 15 Oct 2018 15:44:41 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w9FFifBl037401 for bugs@FreeBSD.org; Mon, 15 Oct 2018 15:44:41 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 232291] ld.bfd (newer) and ld.lld (6 and imho 7) create empty sections when they should not Date: Mon, 15 Oct 2018 15:44:40 +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 Only Me X-Bugzilla-Who: bz@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc 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.27 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2018 15:44:43 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D232291 Bug ID: 232291 Summary: ld.bfd (newer) and ld.lld (6 and imho 7) create empty sections when they should not Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: bz@FreeBSD.org CC: arichardson@FreeBSD.org, dim@FreeBSD.org, emaste@freebsd.org Working on a possible solution for PR230857 it seemed that ld.bfd and ld.lld are bug compatible. The old version of ld.bfd currently in HEAD (GNU ld 2.17.50 [FreeBSD] 2007-07-03 , from before the branch of stable/12) seems to do the expected thing on certain statements with regards to "Dot". Newer versions of both ld.bfd (2.26) and ld.lld seem to fail to do the right thing. Strangely enough in old times that behaviour was not documented and worked,= for newer version is documented and fails. One of the possible solution for the above mentioned PR as initially outlin= ed in https://reviews.freebsd.org/D17512 was along the lines of the following linker script snippet: 39 SECTIONS 40 { 41 set_pcpu : 42 { 43 *(set_pcpu) 44 . =3D . + ABSOLUTE (___set_pcpu_pad) ; 45 } 46 } If ___set_pcpu_pad would be 0 the statement would be . =3D . + (sym=3D=3D0)= in which case, was the section non-existent/empty before should not be created. How= ever it is with lld and the above mentioned bfd version at least. According to https://sourceware.org/binutils/docs-2.31/ld/Output-Section-Discarding.html= #Output-Section-Discarding it should not be created: QUOTE >>> Other link script directives that allocate space in an output sec= tion will also create the output section. So too will assignments to dot even if= the assignment does not create space, except for =E2=80=98. =3D 0=E2=80=99, =E2= =80=98. =3D . + 0=E2=80=99, =E2=80=98. =3D sym=E2=80=99, =E2=80=98. =3D . + sym=E2=80=99 and =E2=80=98. =3D ALIGN (. !=3D 0, expr, 1= )=E2=80=99 when =E2=80=98sym=E2=80=99 is an absolute symbol of value 0 defined in the script. This allows you to force output of= an empty section with =E2=80=98. =3D .=E2=80=99. <<< We should make sure that the upstream linkers we use get fixed to properly = work as documented and as at least one seems to have in the past. Having bug-compatiility between the two is not helpful at all. While they are broken we might have to end up splattering sections over all kernel modules, adding BYTE(1)-kind padding to these sections and checking = this and filtering this out in the in-kernel linker, which is extra noise, extra size, extra complexity, .. otherwise not needed, as well as possible proble= ms with out-of-tree compiled kernel modules. --=20 You are receiving this mail because: You are the assignee for the bug.=