From nobody Fri Sep 20 22:16:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1649936868; cv=none; d=zohomail.com; s=zohoarc; b=RNsExGy1CDhnS91qbQwm2Kiaa0lF5896hhcQR4M3SRvV/pdhmUps35NNh9GcbdPScaDOANeoyy2J0TSMAF9BVI96amRsGjEa+ZGWH9HOxAwFUr79vMl3miYAvcvoG+K/Y/BcXCjkXiHtFZXoJ4oWEjAOiHq+D7V0AcIL+r/fJ/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649936868; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SpzHKi/qU/jz1J8RmcMw35yp2Hpy/1gnA8uA0WbHf/U=; b=krA2BRjx23MbKHuBVBelRQtBUwtrj8DWnOrqjJf7nfVTws3HB0XfgBiVh2vYjzfqcyaGai4eyjgWN5c3Ck1c0GOY3IgooyI/vN9iVn9iqgClZQpf1afFVd1oLa3ZczYtiSZD32CZ/+2MINiiVZRMAS/YMKCGyflKZixW5fDxOSg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16499368680191007.3967360996851; Thu, 14 Apr 2022 04:47:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.304648.519352 (Exim 4.92) (envelope-from ) id 1nexwb-0001ak-1k; Thu, 14 Apr 2022 11:47:25 +0000 Received: by outflank-mailman (output) from mailman id 304648.519352; Thu, 14 Apr 2022 11:47:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwa-0001YU-Qr; Thu, 14 Apr 2022 11:47:24 +0000 Received: by outflank-mailman (input) for mailman id 304648; Thu, 14 Apr 2022 11:47:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwZ-0000HT-RL for xen-devel@lists.xenproject.org; Thu, 14 Apr 2022 11:47:23 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a4aed2f9-bbe8-11ec-8fbd-03012f2f19d4; Thu, 14 Apr 2022 13:47:21 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a4aed2f9-bbe8-11ec-8fbd-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1649936841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Uae8bFBeN10HyzNO9f3vkE192c+nPR4Tmdy4ORjMWo=; b=QyJKBNfETaZFBx9x6flcsKxBzets1VirHoH5WuarCncq1qpo94KkGg7T ibb9bMLZ0Gjt57Hh/gbzoCdmQjLwT7d9tsUhWgkl8/bNsBWkk0rQz/A2M flskMcKFzp/h9BwRcqQo0+ZZViLBJyCTG5qA6ubsa+fkthgebE87DqCiA s=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 68829285 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:3qtVSaxbzqvftlcWBCt6t+c7xirEfRIJ4+MujC+fZmUNrF6WrkVSm jRKD27Xb//ZYDeheYgjPI2xo0IE78SAydZiSlM5/CAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX9JZS5LwbZj2NY02IThWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NpllLXsQg0sFYT2mOlNSj9gNwJlO7xiweqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DFYUToHx/ixreCu4rW8vrSKTW/95Imjw3g6iiGN6AN 5pDOGA/MXwsZTVXFXY3U80+w9yRuSL6fz1GpWyRnfYotj27IAtZj+G2bYu9lsaxbdpRtlaVo CTB5WuRKjMwOcGbyDGF2mmxneKJliT+MKoCGbv9+vN0jVm7wm0IFAZQRVa9ueO+iEO1R5RYM UN8x8Y1hfFsrgrxFIC7BkDm5i7f1vIBZzZOO8wTtAqHz4H92QaUVnEidhpic9o3kPZjEFTGy WS1t9/uADVutpicRnSc6qqYoFuOBMQFEYMRTXRaFFVYurEPtKl210uSFYg7TMZZm/WvQVnNL ya2QD/Sbln5peoCzO2F8F/OmFpATbCZH1dutm07so9Ihz6VhbJJhaT1sTA3Dt4ade51q2VtW lBeyqByC8hUU/mweNSlGrllIV1T296LMSfHnXlkFIQ7+jKm9haLJN4MsWEkfB43bp1fJFcFh XM/XysLtfe/21PwM8dKj3+ZUZx2ncAM6/y4PhwrUja+SscoL1LWlM2fTUWRw3rsgCARfVIXY v+mnTKXJS9CU8xPlWPuL89EiOND7n1ulAv7GMGgpzz6gOX2WZJgYepcWHOUcPsD5b+JyC2Mt Y432z2ikE4EDoUTo0D/rOYuELz9BSFiW8un+pANK7brz8gPMDhJNsI9CIgJI+RN95m5XM+Rl p1hcie0EGbCuEA= IronPort-HdrOrdr: A9a23:bW9B1KxCe+7/0kMB+zqiKrPwFr1zdoMgy1knxilNoRw8SK2lfq eV7YwmPH7P+U8ssR4b6LO90cW7Lk80sKQFhbX5Xo3SOjUO2lHYTr2KhLGKq1aLdkHDH6xmpM BdmsBFeabN5DNB7foSjjPXLz9Z+qjjzJyV X-IronPort-AV: E=Sophos;i="5.90,259,1643691600"; d="scan'208";a="68829285" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Anthony PERARD Subject: [PATCH 1/3] x86/build: Rework binary conversion for boot/{cmdline,reloc}.c Date: Thu, 14 Apr 2022 12:47:06 +0100 Message-ID: <20220414114708.4788-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220414114708.4788-1-andrew.cooper3@citrix.com> References: <20220414114708.4788-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1649936869621100002 There is no need to opencode .got.plt size check; it can be done with linker asserts instead. Extend the checking to all dynamic linkage sections, and drop the $(OBJDUMP) pass. Furthermore, instead of removing .got.plt specifically, take only .text when converting to a flat binary. This makes the process invariant of .text's position relative to the start of the binary, which avoids needing to disca= rd all sections, and removes the need to work around sections that certain linkers are unhappy discarding. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Anthony PERARD --- xen/arch/x86/boot/Makefile | 13 +--------- xen/arch/x86/boot/build32.lds | 58 +++++++++++++++++++--------------------= ---- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index ca8001c72b23..09d1f9f75394 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -22,19 +22,8 @@ $(head-srcs): %.S: %.bin (od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=3D$$0}' | \ sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@ =20 -# Drop .got.plt during conversion to plain binary format. -# Please check build32.lds for more details. %.bin: %.lnk - $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | \ - while read idx name sz rest; do \ - case "$$name" in \ - .got.plt) \ - test $$sz !=3D 0c || continue; \ - echo "Error: non-empty $$name: 0x$$sz" >&2; \ - exit $$(expr $$idx + 1);; \ - esac; \ - done - $(OBJCOPY) -O binary -R .got.plt $< $@ + $(OBJCOPY) -j .text -O binary $< $@ =20 %.lnk: %.o $(src)/build32.lds $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o = $@ $< diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds index 1ab941879312..d8fb9170ca40 100644 --- a/xen/arch/x86/boot/build32.lds +++ b/xen/arch/x86/boot/build32.lds @@ -31,44 +31,36 @@ SECTIONS *(.bss.*) } =20 + /* Dynamic linkage sections. Collected simply so we can check they're e= mpty. */ + .got : { + *(.got) + } .got.plt : { - /* - * PIC/PIE executable contains .got.plt section even if it is not = linked - * with dynamic libraries. In such case it is just placeholder for - * _GLOBAL_OFFSET_TABLE_ symbol and .PLT0. .PLT0 is filled by dyna= mic - * linker and our code is not supposed to be loaded by dynamic lin= ker. - * So, from our point of view .PLT0 is unused. This means that the= re is - * pretty good chance that we can safely drop .got.plt as a whole = here. - * Sadly this is not true. _GLOBAL_OFFSET_TABLE_ is used as a refe= rence - * for relative addressing (and only for that thing) and ld compla= ins if - * we remove .got.plt section here because it cannot find required= symbol. - * However, _GLOBAL_OFFSET_TABLE_ is no longer needed in final out= put. - * So, drop .got.plt section during conversion to plain binary for= mat. - * - * Please check build32.mk for more details. - */ *(.got.plt) } - - /* - * Discarding .shstrtab is not supported by LLD (LLVM LD) and will trigg= er an - * error. Also keep the rest of the control sections to match GNU LD beh= avior. - */ - .shstrtab : { - *(.shstrtab) + .igot.plt : { + *(.igot.plt) } - .strtab : { - *(.strtab) + .iplt : { + *(.iplt) } - .symtab : { - *(.symtab) + .plt : { + *(.plt) } - - /DISCARD/ : { - /* - * Discard everything else, to prevent linkers from putting - * orphaned sections ahead of .text, which needs to be first. - */ - *(*) + .rela : { + *(.rela.*) } } + +ASSERT(SIZEOF(.got) =3D=3D 0, ".got non-empty") +/* + * At least GNU ld 2.30 and earlier fail to discard the generic part of + * .got.plt when no actual entries were allocated. Permit this case alongs= ide + * the section being empty. + */ +ASSERT(SIZEOF(.got.plt) =3D=3D 0 || + SIZEOF(.got.plt) =3D=3D 3 * 4, "unexpected .got.plt size") +ASSERT(SIZEOF(.igot.plt) =3D=3D 0, ".igot.plt non-empty") +ASSERT(SIZEOF(.iplt) =3D=3D 0, ".iplt non-empty") +ASSERT(SIZEOF(.plt) =3D=3D 0, ".plt non-empty") +ASSERT(SIZEOF(.rela) =3D=3D 0, "leftover relocations") --=20 2.11.0 From nobody Fri Sep 20 22:16:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1649936868; cv=none; d=zohomail.com; s=zohoarc; b=To5SrRiPcGFOXhQBdHVgH6fTR5jbHPE2g1xR/NNKkR/M/BYsJpP4d3d1pOCG/VJo+bRHw/F5eHBRh6HbIEFOWFh5KWPlKnF7Hj/uISPHsIeAwbk6otT0Jq9nV2WP5TnFR87g5xg1cGAlU7dg9UgMjqfrqkWBDNWlQECWW+DMukI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649936868; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pRM0hUR6X41ICTp/XxnnCCauoH3JSX3YS8WdHvHE9xM=; b=LFbEyTS/jaSO3eyjilNYttjAOBWIOGazI/Kw5OlTkz83I5tvmiqTc3BX99/Yi4tbeXn15r199tfPkDwZS8FFSc/Y26PDo9eZVVGSFtd2223R2KsUCPG5WhWr3bEz5BS1b+2HR1BS2TCHAi87HNmrO8TeWTG/0GZk/l0Gqumgyzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1649936868008806.1633328501471; Thu, 14 Apr 2022 04:47:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.304647.519335 (Exim 4.92) (envelope-from ) id 1nexwZ-00019Q-L1; Thu, 14 Apr 2022 11:47:23 +0000 Received: by outflank-mailman (output) from mailman id 304647.519335; Thu, 14 Apr 2022 11:47:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwZ-00018Q-E7; Thu, 14 Apr 2022 11:47:23 +0000 Received: by outflank-mailman (input) for mailman id 304647; Thu, 14 Apr 2022 11:47:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwY-0000HT-RA for xen-devel@lists.xenproject.org; Thu, 14 Apr 2022 11:47:22 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a45c59e1-bbe8-11ec-8fbd-03012f2f19d4; Thu, 14 Apr 2022 13:47:20 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a45c59e1-bbe8-11ec-8fbd-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1649936840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+qQkIV3HBke5CTXRiQlZD/OE4VAVlxsLpbZwbQuQSMI=; b=etLfSynhN03yGbY9uIPgHJZQJ2puM2qnUmpcPmupTeQRyzxbciyNvsvj Yy3rqdMOPHHNSQggM2evJxgI1+WOnc/FvnhuzqKiz/b+mTUOCnCJMR+vn Oum8foclr3dir3M7TU17kTWK01yehk2OcZuzSC1pix1EDAgayjWsFfr2B 4=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 68353100 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:vODzhq1sn9LzIsIItPbD5dZxkn2cJEfYwER7XKvMYLTBsI5bpzVRn WQaXD+CM/zZNDSjc4xyPYzipEwBsZWHzt82TwY+pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOCn9xGQ7InQLlbGILes1htZGEk1EE/NtTo5w7Rj2tIx3YDga++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1E7peObjgJJ5bilcBNVhAIAhxVMapvreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHCOo8Ft24m5jbeFfs8GrjIQrnQ5M8e1zA17ixLNaiOP JdCMGI3BPjGSxtwIAwoT7kYoMOXiXXuch9mhwLKtJNitgA/yyQuieOwYbI5YOeiWsF9jkue4 GXc8AzRIDsXKdiewjqt6W+3i6nEmiaTcJIfEvi0++BnhHWXx3cPE1sGWF2ju/67h0WiHdVFJ CQpFjEG9PZoshbxF5+kAkP+8CXsUgMgt8R4GrYx1iay6rPvzQu9Vm0NHi98Q9AhnZpjLdA17 WOhk9TsDD1plbSaT3OB67uZxQ+P1TgpwXwqPnFdE1ZcizX3iMRq10+UEI4/eEKgpoetcQwc1 Qxmu8TXa187qccQn5u28lnc695HjsiYF1Vljuk7s4/M0++YWGJHT9HwgbQ4xawZRGp8crVnl CJV8yR5xLpQZaxhbATXHI0w8EiBvp5pygH0j191BIUG/D+w4XOldo04yGggeBY5aJ5dJ2OyO xK7VeZtCHl7ZirCgUhfOdzZNijX5fK4SYSNug78M7KinaSdhCfYpXozNCZ8LkjmkVQ2kLFXB HtoWZ3EMJruMow+lGDeb75EidcDn3lirUuOFcGT50n2itK2OS/KIYrpxXPTN4jVGovf+16Lm zueXuPXoyhivBrWO3CJqt9CcQpXdRDWx/ne8qRqSwJKGSI+cElJNhMb6elJl1BN90iNqtr1w w== IronPort-HdrOrdr: A9a23:YdKSUaPGy+HEEcBcTvmjsMiBIKoaSvp037Eqv3oedfUzSL3gqy nOpoV86faaslYssR0b9exofZPwJE80lqQFhrX5X43SPzUO0VHAROoJgLcKgQeQfxEWntQtrZ uIGJIeNDSfNzdHZL7BkWuFL+o= X-IronPort-AV: E=Sophos;i="5.90,259,1643691600"; d="scan'208";a="68353100" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Anthony PERARD Subject: [PATCH 2/3] x86/build: Don't convert boot/{cmdline,head}.bin back to .S Date: Thu, 14 Apr 2022 12:47:07 +0100 Message-ID: <20220414114708.4788-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220414114708.4788-1-andrew.cooper3@citrix.com> References: <20220414114708.4788-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1649937772201100001 There's no point wasting time converting binaries back to asm source. Just use .incbin directly. Explain in head.S what these binaries are. Also, align the blobs. While there's very little static data in the blobs, they should have at least 4 byte alignment. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Anthony PERARD Cleanup to $(head-srcs) deferred to the subsequent patch to make the change legible. --- xen/arch/x86/boot/Makefile | 9 ++++----- xen/arch/x86/boot/head.S | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 09d1f9f75394..294ac2418583 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -7,7 +7,10 @@ targets +=3D $(head-srcs:.S=3D.o) =20 head-srcs :=3D $(addprefix $(obj)/, $(head-srcs)) =20 -$(obj)/head.o: $(head-srcs) +# For .incbin - add $(obj) to the include path and add the dependencies +# manually as they're not included in .d +$(obj)/head.o: AFLAGS-y +=3D -Wa$(comma)-I$(obj) +$(obj)/head.o: $(head-srcs:.S=3D.bin) =20 CFLAGS_x86_32 :=3D $(subst -m64,-m32 -march=3Di686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) @@ -18,10 +21,6 @@ CFLAGS_x86_32 +=3D -I$(srctree)/include $(head-srcs:.S=3D.o): CFLAGS_stack_boundary :=3D $(head-srcs:.S=3D.o): XEN_CFLAGS :=3D $(CFLAGS_x86_32) -fpic =20 -$(head-srcs): %.S: %.bin - (od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=3D$$0}' | \ - sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@ - %.bin: %.lnk $(OBJCOPY) -j .text -O binary $< $@ =20 diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 3db47197b841..0fb7dd3029f2 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -777,11 +777,17 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret =20 + /* + * cmdline and reloc are written in C, and linked to be 32bit PIC = with + * entrypoints at 0 and using the stdcall convention. + */ + ALIGN cmdline_parse_early: -#include "cmdline.S" + .incbin "cmdline.bin" =20 + ALIGN reloc: -#include "reloc.S" + .incbin "reloc.bin" =20 ENTRY(trampoline_start) #include "trampoline.S" --=20 2.11.0 From nobody Fri Sep 20 22:16:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1649936864; cv=none; d=zohomail.com; s=zohoarc; b=dxo9w1yjZ2OYFF2mykF5M1S2kDc8JE64KaSD8QIUAxTBY2sjqCNTBz13QkRwBGG2Qv/fO5lsDPUUV84LR3RIwWflm39hBCNmKOb9wLU9xLvi5RbsYwsi+8kp1IJ76B3/zbuq/3ReUosiE7AzrrNYbH13NLxFHj6rJqNCFByy33A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649936864; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U7tXb3AnsZtLYvo+srp65N3iDbfwYbGMTn0RJQ/tLl4=; b=bxc4ZvMiSqEnUScW4pBJDbXhqIcH/HCVY0fE9OjJ5rMYSfQCsQlzeHidQTJj56AWjOisDgTaDnDuKsjM3kS2ZBhTf5S8WK8lZzAIL+J/d9quRv4woGcBsm2OCjhAhcvLUwrdQprKDYkeqUQYU8//lrL8hNO7Bc6KdM61/oRuX8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16499368641461013.9369498566399; Thu, 14 Apr 2022 04:47:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.304646.519329 (Exim 4.92) (envelope-from ) id 1nexwZ-00015Y-8v; Thu, 14 Apr 2022 11:47:23 +0000 Received: by outflank-mailman (output) from mailman id 304646.519329; Thu, 14 Apr 2022 11:47:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwZ-00015R-5W; Thu, 14 Apr 2022 11:47:23 +0000 Received: by outflank-mailman (input) for mailman id 304646; Thu, 14 Apr 2022 11:47:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nexwX-0000HT-R1 for xen-devel@lists.xenproject.org; Thu, 14 Apr 2022 11:47:21 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a35e2510-bbe8-11ec-8fbd-03012f2f19d4; Thu, 14 Apr 2022 13:47:20 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a35e2510-bbe8-11ec-8fbd-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1649936840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0s1yCBflD3p2q66QNUN1vJ9nlrel+PCFiTRjaDEozt8=; b=T+WRhVlZtU0wpD4hPfsk4Vn9w23aA/V+riqBYqR/7Yas3c55iBHI3AGG +kw3RY1PWAV7zZNMGzLTF5Sw4pSIMY4vMb4jbtCu2JkASj7hRjra92VdS tCKuMp6n3Rm+6ZkQkRkZbOQ5Rfg6JAuF7DEvpI8FIi3loKy2cLxYNoGb+ E=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 68829284 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:0Ks8dq4J9j4PxqPoJoan2gxRtDTHchMFZxGqfqrLsTDasY5as4F+v mAbDG+Ob/yMZDPwLo9+YN+x9kkOu8TUz9RhQQpurHxgHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0XqPp8Zj2tQy2YTgX1vU0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurSRYFsiNKjnsd4dXklBNRlaHrZA6Zv+dC3XXcy7lyUqclPpyvRqSko3IZcZ6qB8BmQmG f4wcW5XKErZ3qTvnez9GrIEascLdaEHOKs2vH16wC6fJvEhWZ3ZGI3B5MNC3Sd2jcdLdRrbT 5RJOWA+NkScC/FJEgsrDZgUp8K3ulXAQydHlF6vp/M6xXeGmWSd15CyaYGIK7RmX/59gUKwt m/AuWPjDXkyFvaS1D6E+XKEnfLUkGXwX4d6PK218LtmjUOewkQXCQYKTh2rrP+hkEm8VtlDb UsO9UITQbMarRLxCIOnBlvh/SDC7kV0t8ds//MSySjRwaDRyC+jBmVUVxh5TP89st4SfGl/v rOWpO/BCTtqubyTbHuS8LaIsD+/URQowX8+iTwsFlVcvYS6yG0npleWF4s4Tvbp5jHgMWuoq w1muhTSkFn6YSQj86ygtW7KjDu3znQiZl5kv16HNo5JA+4QWWJEW2BKwQWDhRqjBNzAJrVkg JTis5LPhAzpJcvT/BFhuM1XQNmUCwy5GDPdm0VzOJIq6i6g/XWuFagJvm0vdB0xa5hYImS0C KM2he+3zMUCVJdNRfUpC79d9uxwlfSwfTgbfq28giVyjmhZK1bcoXAGib+41GHxikk8+ZzTy r/AGftA+U0yUPw9pBLvHr91+eZymkgWmDOCLbimnk/P+efPOxaopUItbQLmRvon95mNvAi92 48Zb6NmPT0EC7agCsQWmKZORW03wY8TXMmo8J0GKrTeemKL2ggJUpfs/F/oQKQ994w9qwsC1 ivVtpNwoLYnuUD6FA== IronPort-HdrOrdr: A9a23:xLfyg6OVQ0I0hcBcTvujsMiBIKoaSvp037Eqv3oRdfUzSL3hqy nOpoVj6faaskdzZJhNo7+90ey7MBfhHP1OkO8s1NWZLWvbUQKTRekIh+aP/9SjIVyYygc079 YaT0EUMr3N5DZB4/oSmDPIduod/A== X-IronPort-AV: E=Sophos;i="5.90,259,1643691600"; d="scan'208";a="68829284" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Anthony PERARD Subject: [PATCH 3/3] x86/build: Clean up boot/Makefile Date: Thu, 14 Apr 2022 12:47:08 +0100 Message-ID: <20220414114708.4788-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220414114708.4788-1-andrew.cooper3@citrix.com> References: <20220414114708.4788-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1649936866128100002 There are no .S intermediate files, so rework in terms of head-bin-objs. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Anthony PERARD --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Anthony PERARD I'm slightly -1 on this, because head-bin-objs :=3D $(addprefix $(obj)/,$(head-bin-objs)) is substantial obfuscation which I'd prefer to bin. Anthony: Why does dropping the targets +=3D line interfere with incremental builds? With it gone, *.bin are regenerated unconditionally, but I can't s= ee what would cause that, nor why the normal dependencies on head.o don't work. --- xen/arch/x86/boot/Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 294ac2418583..527f3e393037 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -1,16 +1,17 @@ obj-bin-y +=3D head.o -head-srcs :=3D cmdline.S reloc.S =20 -nocov-y +=3D $(head-srcs:.S=3D.o) -noubsan-y +=3D $(head-srcs:.S=3D.o) -targets +=3D $(head-srcs:.S=3D.o) +head-bin-objs :=3D cmdline.o reloc.o =20 -head-srcs :=3D $(addprefix $(obj)/, $(head-srcs)) +nocov-y +=3D $(head-bin-objs) +noubsan-y +=3D $(head-bin-objs) +targets +=3D $(head-bin-objs) + +head-bin-objs :=3D $(addprefix $(obj)/,$(head-bin-objs)) =20 # For .incbin - add $(obj) to the include path and add the dependencies # manually as they're not included in .d $(obj)/head.o: AFLAGS-y +=3D -Wa$(comma)-I$(obj) -$(obj)/head.o: $(head-srcs:.S=3D.bin) +$(obj)/head.o: $(head-bin-objs:.o=3D.bin) =20 CFLAGS_x86_32 :=3D $(subst -m64,-m32 -march=3Di686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) @@ -18,8 +19,8 @@ CFLAGS_x86_32 +=3D -Werror -fno-builtin -g0 -msoft-float CFLAGS_x86_32 +=3D -I$(srctree)/include =20 # override for 32bit binaries -$(head-srcs:.S=3D.o): CFLAGS_stack_boundary :=3D -$(head-srcs:.S=3D.o): XEN_CFLAGS :=3D $(CFLAGS_x86_32) -fpic +$(head-bin-objs): CFLAGS_stack_boundary :=3D +$(head-bin-objs): XEN_CFLAGS :=3D $(CFLAGS_x86_32) -fpic =20 %.bin: %.lnk $(OBJCOPY) -j .text -O binary $< $@ @@ -27,4 +28,4 @@ $(head-srcs:.S=3D.o): XEN_CFLAGS :=3D $(CFLAGS_x86_32) -f= pic %.lnk: %.o $(src)/build32.lds $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o = $@ $< =20 -clean-files :=3D cmdline.S reloc.S *.lnk *.bin +clean-files :=3D *.lnk *.bin --=20 2.11.0