Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2947937pxu; Mon, 7 Dec 2020 22:26:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDuvVmgL5JO1Z3WSMbKzhQs5FmIxc1oLMcYJtwBca7rShMyCgoAEzGiFYuEHp+4qQrwD1w X-Received: by 2002:a50:fe87:: with SMTP id d7mr16141769edt.381.1607408777371; Mon, 07 Dec 2020 22:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607408777; cv=none; d=google.com; s=arc-20160816; b=jEINy94ufUwDVLLTLMMEeHaAbNKYM20YtWB7r/G01rzlO+6WqphMBEpoxkzQdWKsV2 FIojVwpP0ZM/YNvOKJoRS55dmOCpWpQx4s7tM/vVfAPhFVDYheoZX3eKSZNd6I9Ibg5u 9IoFNpyucRqI7L4x7QiV968SYmQu8egwUxxe6GSK0SWmf/f7e79FK1bZxbwdyxEva399 jeSiZm5XpCGHRaFU6srWBKE0iGg6KaBMc2alDgJGjNhXneV5Sv64zwYhwJgpMGmmdweU ljoJ2UYncDqNUTpQYqOG8on/sjNfLSsHOGjitGV1pENJIU8/1Dg64zJq7VqPtzhL8nQm xU7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=e1pDmuZWJgETEHbU+21FKLtGXbFndqwbo33SoyyNrOA=; b=SnxqfFssIMr+ekIcj5Ue89g9N2ispztm/RP/xSxh4QO4rghy3c+BcBMsZGM58l9x0n zVqihtOk1Xh8zg79KMRCcM/T+xQa3Nlj6XSI744FZybcoOZA5Ytlw8Eirb1VT4e4gKQw 2Sruk++MrSaQW09oAsBN9N7IaCEdMz9bTAE6r4GDlHRUdNj9RFy3ILuJ/CgAH/P+eVsd mnI/oVIXkXeZXv8CldVwM1zGohC24rlOYm2XpHZmgYgWyXDFKMTWuoGs0G/FIGYWkAn6 KgXZYvr9J1MKHO0vJFmtKuS2zMSErUveYwD1pcqYLCieCxblgR6ckOoE5O6zRY8GWsxI inww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I4pGl9G+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si8009798ejd.747.2020.12.07.22.25.54; Mon, 07 Dec 2020 22:26:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I4pGl9G+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725766AbgLHFrg (ORCPT + 99 others); Tue, 8 Dec 2020 00:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgLHFrf (ORCPT ); Tue, 8 Dec 2020 00:47:35 -0500 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CBBCC0613D6 for ; Mon, 7 Dec 2020 21:46:55 -0800 (PST) Received: by mail-qt1-x849.google.com with SMTP id v18so13065334qta.22 for ; Mon, 07 Dec 2020 21:46:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=e1pDmuZWJgETEHbU+21FKLtGXbFndqwbo33SoyyNrOA=; b=I4pGl9G+/ClTNHjjMWUUmjtSXe/KWlnklWFAGVruixzJ9ve1HKTFph5J7/+L7CQ1eM enCTzlPt6VMoKaxfarFSHypXGTG5f2bXP7LSKasBrsZgIeaA3h7v3/jXSllSTmsrL9q4 f0EMIhE+TrKstlvPRLehje0YKMuu99R62Oc58ziQV/oVRCfoMxpyQtmaQ/oVATruw8gx 44dr+OlKv3K5cfIRBUcsGtV/XnXKbplNp6v9eB3FsnKqYLrym4w7yUmAMeaDwVMn5xRo FP+owZ35Kgp5aAbP/fCgsme+64nA8KZsWUmEWS14LmBNfBXDfTdPK51JcOZlzdcxZrI8 U71A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=e1pDmuZWJgETEHbU+21FKLtGXbFndqwbo33SoyyNrOA=; b=poelaeK7mEQX27BrUpDka+Wlx1/5B6C3Oa3703Xjmjm+e4tXjsFoHXEoRvA3wgD2UC Ram3jVfzgxG16DLlajPVVQUFgPdKSwCZom9WB7j8lur/kj+56v6B8isTPiP9zi2e2FpH V3IwY7p6FJarOiozw4FpRbCBY3uaby5wJzNlPViubjultEX/43XqDYuyF+POrMGNc3HX 8Qka+gcRWX+flQTbjer7rqE4JHW4PAE9HBOshQVT8/N/8gu8blEpCfnQ7ArTmVOu2ZKF 3dTizeamS4VJBW76Na7f6I8gLWfEmuK+H72GFLqB/rS+Oja6Wny9ZKr+7t70Un2CCTYH 1JlA== X-Gm-Message-State: AOAM533SGCuvzqHdAZD8ltlB0707MBRW0l4WpLLJN3vp2+EMUD7XQ0YB MutCAOW4BJnMe6sQp+grZ0+hgy27ptnu Sender: "maskray via sendgmr" X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) (user=maskray job=sendgmr) by 2002:a0c:a8d4:: with SMTP id h20mr7977172qvc.52.1607406414446; Mon, 07 Dec 2020 21:46:54 -0800 (PST) Date: Mon, 7 Dec 2020 21:46:46 -0800 In-Reply-To: <20201203202737.7c4wrifqafszyd5y@google.com> Message-Id: <20201208054646.2913063-1-maskray@google.com> Mime-Version: 1.0 References: <20201203202737.7c4wrifqafszyd5y@google.com> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH v2] firmware_loader: Align .builtin_fw to 8 From: Fangrui Song To: Arnd Bergmann , linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , Nick Desaulniers , Fangrui Song , kernel test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arm64 references the start address of .builtin_fw (__start_builtin_fw) with a pair of R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_LDST64_ABS_LO12_NC relocations. The compiler is allowed to emit the R_AARCH64_LDST64_ABS_LO12_NC relocation because struct builtin_fw in include/linux/firmware.h is 8-byte aligned. The R_AARCH64_LDST64_ABS_LO12_NC relocation requires the address to be a multiple of 8, which may not be the case if .builtin_fw is empty. Unconditionally align .builtin_fw to fix the linker error. 32-bit architectures could use ALIGN(4) but that would add unnecessary complexity, so just use ALIGN(8). Fixes: 5658c76 ("firmware: allow firmware files to be built into kernel image") Link: https://github.com/ClangBuiltLinux/linux/issues/1204 Reported-by: kernel test robot Signed-off-by: Fangrui Song Acked-by: Arnd Bergmann --- Change in v2: * Use output section alignment instead of inappropriate ALIGN_FUNCTION() --- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b2b3d81b1535..b97c628ad91f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -459,7 +459,7 @@ } \ \ /* Built-in firmware blobs */ \ - .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ + .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) { \ __start_builtin_fw = .; \ KEEP(*(.builtin_fw)) \ __end_builtin_fw = .; \ -- 2.29.2.576.ga3fc446d84-goog