From patchwork Mon Jan 2 13:24:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 13086740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B89F2C4708E for ; Mon, 2 Jan 2023 13:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=v7NLHeZHjKDlOcs7cF2tVhz2WWVj/U2DWffRpz4j0Ao=; b=pzDMEMO8ygT/jt LE9XXF7rnMdY3eKBEeJ613jByD5kwuukdXwNECB2CFesrs3Dn13jSQZ6R+7ayxi9Sh0W9D1wLv4uo cT09OJn5l8kgCFhzJjrMqvfNQXP0vjSvYZ/xC7sIA6Gk8spAt4RyaJY0VY+VKGcLmPINPXUlXnoIf G9HzB+dCcuTA5pFOFrk8aacBbQnsjNscO7dR0+a9ZwecC6iZLhmConTUebN0zoZg5zON/snU9DzbL Dieg+9cHFOcZYnYMCJRAPi5CiN4N2GFaOfTch6VOiKfmddNAzKisKrZmWYQ/Z4u+kjzRAp/NbaLCv /ESRwCZQH6b7X5lwgZXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCKpG-00BXrR-14; Mon, 02 Jan 2023 13:26:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCKoP-00BXd8-9P for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2023 13:25:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5EC8B2F4; Mon, 2 Jan 2023 05:25:38 -0800 (PST) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2FB2C3F663; Mon, 2 Jan 2023 05:24:56 -0800 (PST) From: Kevin Brodsky To: linux-arm-kernel@lists.infradead.org Cc: Mark Rutland , Kevin Brodsky Subject: [boot-wrapper PATCH] model.lds.S: Quote file paths Date: Mon, 2 Jan 2023 13:24:46 +0000 Message-Id: <20230102132446.2056889-1-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_052516_184796_1E62F51D X-CRM114-Status: UNSURE ( 8.03 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Inserting arbitrary paths in a linker script verbatim can be problematic, even if they don't contain whitespaces, as ld has a special interpretation for certain special characters (such as @). Fix this by quoting all user-provided paths in model.lds.S using the preprocessor. Signed-off-by: Kevin Brodsky --- model.lds.S | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/model.lds.S b/model.lds.S index dacaa25ba9fd..e07cbc04b9fa 100644 --- a/model.lds.S +++ b/model.lds.S @@ -7,6 +7,9 @@ * found in the LICENSE.txt file. */ +#define _STR(s) #s +#define STR(s) _STR(s) + #ifdef BOOTWRAPPER_32 OUTPUT_FORMAT("elf32-littlearm") OUTPUT_ARCH(arm) @@ -17,13 +20,13 @@ OUTPUT_ARCH(aarch64) TARGET(binary) #ifdef XEN -INPUT(XEN) +INPUT(STR(XEN)) #endif -INPUT(KERNEL) +INPUT(STR(KERNEL)) INPUT(./fdt.dtb) #ifdef USE_INITRD -INPUT(FILESYSTEM) +INPUT(STR(FILESYSTEM)) #endif ENTRY(_start) @@ -36,14 +39,14 @@ SECTIONS */ .kernel (PHYS_OFFSET + KERNEL_OFFSET): { kernel__start = .; - KERNEL + STR(KERNEL) kernel__end = .; } #ifdef XEN .xen (PHYS_OFFSET + XEN_OFFSET): { xen__start = .; - XEN + STR(XEN) xen__end = .; } @@ -62,7 +65,7 @@ SECTIONS #ifdef USE_INITRD .filesystem (PHYS_OFFSET + FS_OFFSET): { filesystem__start = .; - FILESYSTEM + STR(FILESYSTEM) filesystem__end = .; } #endif