From nobody Thu Aug 11 23:30:00 2022 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 4M3jhS3dfqz4Yky3; Thu, 11 Aug 2022 23:30:00 +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 4M3jhS39QTz3ltD; Thu, 11 Aug 2022 23:30:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660260600; 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=GiF9GIGwv5htOlpAXSQIYQ2RyZBxNLkqGg3t8lRjKT8=; b=AJUsdbPaGmX2Pavc6IGkk4nmz/2CDi/QCBhcx1mGmY1vi/ekzZMdgvd9BQRBhJ6TGUYHXr BQo53vNDwjHL8mtcQ8ykajDGzXbe+js8JR81U2pWZOc1I/iJnCFOC6njm/OBSExcB6BmUJ E/OA3cwAKrUz68vArhJb5Ai/lNCDQdEjGxLHM/xH+GZpP1KryDvkX/w6uzcp7aUA8vqsDu yKsViRkryaNxrQOxGvM1tKVMNTaSxaE8L6f32vn8D7FoFbtbGCnxsxm1vriqpF9Q5F7tEx Py/IWYYJuuxovRbH/wM71dSvWreedDZjAJaw1jTJY/DHW/i8kSP46MPb+PsE6w== 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 4M3jhS26xpz18hp; Thu, 11 Aug 2022 23:30:00 +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 27BNU0sG026155; Thu, 11 Aug 2022 23:30:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BNU0nN026141; Thu, 11 Aug 2022 23:30:00 GMT (envelope-from git) Date: Thu, 11 Aug 2022 23:30:00 GMT Message-Id: <202208112330.27BNU0nN026141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4c8ea3efe73c - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4c8ea3efe73c12d595472a7fc37177432a77858e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660260600; 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=GiF9GIGwv5htOlpAXSQIYQ2RyZBxNLkqGg3t8lRjKT8=; b=VZTWfcvku0eaw/dPtM+PUtCbETwlWCqVs5cC17D1runLXeRNnCOh4eLqtHYB7sYaxGDqwt 7vM08Ps12p1OOnaucLke/u/4gAdH2BYFjoot+u4uyvM08R9uxYyGnePCUIHjLHsH/wj3V6 o2X492hx4zUZTZBJDxmRydpr3bLTF9+lTS+lTlUyilj41D0Eky1UySgmoPdTfLmO03L4+P dIz+TDb9ekURibaxGIMZ3DCzrg2DsdSCeIXmR8Km/BeSIxVsdICVUr0WGTaiyEDrlQznTb KgYl24kpSoBxqVAXrCZPdrwybUW+MGVaoO8+KlISq8s/NjJPkkbYgFUPRl+3Aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660260600; a=rsa-sha256; cv=none; b=t4j2C3HsQn0jbvbrSJtC4iMOXZo6x2AX3u7GdnQAfvd1UspEQg/hymWX9oZIeR7Y1/hd1t MoPbmwTaYB1wVN/hUeOsWXl6tWXV+bnFvJ10yaxQ35dCqY6rRMFCUI+pQqAashyp5JlFGP DHMn+/xZbCDu0O4moiqb7fupTCJ+8wURYLbRZhI/gfEi93krEhu3ZHOIWLh18FEHhEQ5ZJ 4zTR47q7UlgypLcysw3T0d8JttBNtSA6qKkVFoAw7Sym8pnSbj076pGrdYBQnueXYwOmdG +DLVp5r0zxJP+K0P8FgnAvlIMGAdNNI1cX2IC7fqdFg7j0rHe8N1dzHLPQOSdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c8ea3efe73c12d595472a7fc37177432a77858e commit 4c8ea3efe73c12d595472a7fc37177432a77858e Author: Warner Losh AuthorDate: 2022-08-11 23:29:10 +0000 Commit: Warner Losh CommitDate: 2022-08-11 23:29:10 +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 --- 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