From nobody Tue Jan 24 22:12:08 2023 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 4P1h610Rwpz3bfp3; Tue, 24 Jan 2023 22:12:09 +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 4P1h6070Cmz4Qdl; Tue, 24 Jan 2023 22:12:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dRpoRJthrglFttvqbbo1dC1PNsOwqzmZB0C9V1Dl9vw=; b=ka0yfWx+1mxxlx33rWpvJ1Yf7S76Zr1pSDnbJTTKi/hI/t8i0VkSoN3IT6iYAERbCLkqHo vtTL7+hKtHZcxRsr1VyEl7tWXXGZK54UHWc8DHjY177TlW3626+ThRdoDqzuS4kSru/+3A Hn9O7P9eDk7cELOQv19RYFzeYnpyJJrdtCnqe/gelBeZbzJsLqUfjYdLrGDr1Q93vyup3P OAjS3XJMlqyY8LkaEIECjKgn/n6mnXqVYoWPeLSo6ZXosYS5cfl2w12LkT/RC+irRWDnqu tCBV5L6LXABHY4lNPFMs55ff/5AtdmsuRB3c1NIef3HH+m+w2ECrZ/EjUUKi4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dRpoRJthrglFttvqbbo1dC1PNsOwqzmZB0C9V1Dl9vw=; b=yHV+S3ri0LeR+TbTeZqPb1hYSbawqHLEPEOYu4lzqCFbov/ZpNCOSPt0jQOua9zsaQJPKp GFr7V/4vxc+z2bI1ebNQrA3A9hbWJFwMqw1QonurHYoUzoIRzy2nGTUU9qZmOe6RMharqE ctpYYj2Z6px6MrrdJZL4qcz5y2zSTGRhIe740ZSXPSuAZRMTxJQQHneF6zNlajNwlk1KlB O/AmSgSVJhjCL4T14pNEIuPKfDXBt25XF6wy2UZgGoX48eoZrffOkASJWNvTXPO7F2uQYg Hf55TEgmxLS0p1+7xiHcla3wXO4Cv98YDK7uZCqEi08Bz8hEq9jCvw277nwIaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598329; a=rsa-sha256; cv=none; b=czjk057HemFilVKR7LR7Dvbib7ldUTPeOcEu8KAV19GBKU/EjPJ0x3LoPp79W/WdUjwi/f yCs5vzhB/mj4Zn7dLr94+gaUWKWW4WoiVAGYomwR8JbdiGvI+1LqXgkqegDJSmjDT35w2C OPVy1SUaoaJCtOpPzJGg1oo26PaNTv6ROJ3TZCqLC4SW1MT83lgNxeJvkjYPR7a0oi4jhu g1AQ1PpfeiOCTx8BM2uo0PU7kiIC3HK1ELCKA6FpmwIx25CPHk0eLTR7uA0ir5la7ddA+f CHBkXplqKqBhLrxnRtlr+AWxA9iNOCyJaNfoJqh2fIUp1GB3J/FA8XXCVedsAg== 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 4P1h605zQJzQgG; Tue, 24 Jan 2023 22:12:08 +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 30OMC8mA086620; Tue, 24 Jan 2023 22:12:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMC8fb086619; Tue, 24 Jan 2023 22:12:08 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:12:08 GMT Message-Id: <202301242212.30OMC8fb086619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: dba7abcda4a8 - stable/13 - stand: Go back to a.out format for /boot/loader 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dba7abcda4a8668e5949656afd5f19dbf072acb6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dba7abcda4a8668e5949656afd5f19dbf072acb6 commit dba7abcda4a8668e5949656afd5f19dbf072acb6 Author: Warner Losh AuthorDate: 2022-08-11 23:29:10 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:31 +0000 stand: Go back to a.out format for /boot/loader Turns out there's two hidden a.out dependencies. pxeldr.S assumes it has access to the a.out header from /boot/loader and cdboot.S assumes that /boot/loader is also a.out and doesn't use boot2. So, go back to making a.out files for these and adjust the size checks to use ls, but we only need to check loader.bin. Trim the size we check against by 2,000. The difference in size between loader and loader.bin is about 3000 bytes, but clang15 produces binaries that are a smidge bigger so we need to relax the check just a little and accept some additional risk for the moment. Add some comments to loader's Makefile about this. Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D36142 (cherry picked from commit 4c8ea3efe73c12d595472a7fc37177432a77858e) --- stand/i386/loader/Makefile | 12 ++++++------ stand/i386/pxeldr/Makefile | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 8b027b2edd61..539c736af38f 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -19,7 +19,7 @@ PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 VERSION_FILE= ${.CURDIR}/../loader/version -LOADERSIZE?= 510000 # Largest known safe size +LOADERSIZE?= 508000 # Largest known safe size for loader.bin .PATH: ${BOOTSRC}/i386/loader @@ -83,13 +83,13 @@ CFLAGS+= -I${BOOTSRC}/i386 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} - btxld -v -f elf -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ + btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADER}.bin - @set -- `${SIZE} ${.TARGET} | tail -1` ; x=$$((${LOADERSIZE}-$$4)); \ - echo "$$x bytes available"; test $$x -ge 0 ${LOADER}.bin: ${LOADER}.sym ${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC} + @set -- `ls -l ${.TARGET}` ; x=$$((${LOADERSIZE}-$$5)); \ + echo "$$x bytes available"; test $$x -ge 0 .if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader @@ -103,8 +103,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # Note: crt0.o needs to be first for pxeboot(8) to work. It assumes that the # startup code is located at the start of the loader and will jump # there. Although btx is more flexible than this, the emulated boot2 environment -# that pxeloader provides has none of that flexibility because it lacks access -# to the a.out/elf headers and assumes an entry point of 0. +# that pxeldr provides has none of that flexibility assumes an entry point of +# 0. In addition, pxeldr and cdboot assume that it is loading an a.out file. # # We must add it to the LDFLAGS instead of the OBJS because the former won't try # to clean it. When it is in OBJS, this cleaning can lead to races where diff --git a/stand/i386/pxeldr/Makefile b/stand/i386/pxeldr/Makefile index 3d27285968ce..790f5ed8f0e9 100644 --- a/stand/i386/pxeldr/Makefile +++ b/stand/i386/pxeldr/Makefile @@ -13,7 +13,6 @@ BOOT= pxeboot LDR= pxeldr ORG= 0x7c00 LOADER= loader -PXELDRSIZE?= 510000 # Largest known safe size .if defined(BOOT_PXELDR_PROBE_KEYBOARD) CFLAGS+=-DPROBE_KEYBOARD @@ -39,10 +38,10 @@ LDFLAGS+=${LDFLAGS_BIN} CLEANFILES+= ${LOADER} +# Note: pxeldr.S assumes a.out and will require changes for ELF if the output +# format is changed to ELF. ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} - btxld -v -f elf -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ + btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADERBIN} - @set -- `${SIZE} ${.TARGET} | tail -1` ; x=$$((${PXELDRSIZE}-$$4)); \ - echo "$$x bytes available"; test $$x -ge 0 .include