Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5899369imb; Fri, 8 Mar 2019 05:04:13 -0800 (PST) X-Google-Smtp-Source: APXvYqydnDVCcb4LLiqHzgpES3rygXynfAaPDHLU+THWl3BQRC4+0iyhjmeY8OiWZAV5UN37leg3 X-Received: by 2002:a63:ca:: with SMTP id 193mr16607487pga.288.1552050253125; Fri, 08 Mar 2019 05:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552050253; cv=none; d=google.com; s=arc-20160816; b=YDS7kH7ZHq/kEXx3b9p9Gvst0Ay8hhLcU3hn/8PUsiphT0MsqwMSmItw1meIDqfFRa 1C+X+TNQYnIB7/i7GnYeihsr9z+gJOyE/NkmdFvW08m0R8GKstdLfAQ8ydPuwFt7iyWe H3NU7HiumgGJdLAZpFsOVIw3HGrLPq60HMQOyFG5QU8+T25HCOOSQXHc4CCcd3GHfNo0 PeR6OiLLFEwo86A1rwjh1ITxkzlYZG6xyCiLOePhms1TkgSw3ZMnL/SbEZQUmJlJdTvw 02wKS7BEDS30SD2DQRBFV241xf1RGURUQ/CLr7B2hyUud/CprZf7+nveBVhiNI8laxwt C64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1hms/5IsZhU5jpk430jeUjgKow1Cl2U2/bwfLiqsmlw=; b=y6gneiHDyqbOjZ78jCeBKtjxDx1ylT0gqHelRJoRs5z7mgwPvGjeG254piXZuMZeq7 XwkDytSw2kZFkVu+iQpolcqvMYseQtpbKH2DtJTQ4IX7zIcDkLDycpOLopRSvufNU5nQ MDITIN0yWJnmjVGWd1M0w7ge5U78mUyoCwK+4rIYARCZtw9aUOHac+kRr4hd89oj3BiW 3Y+YQhjIySqP2t5CBDfIGZw9v0e1+KphoNz2ei8HDGSIxcgHcZ+at0tBGgWQqzp8S3+j Ffrok4YWvh0JabpcQXOb01BxToC6r4HGN6ZBKeq3q7N37qD9ZjtI6EHNfYhxEjfFcU6e fW6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tjywWtwf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si6654305pgt.131.2019.03.08.05.03.55; Fri, 08 Mar 2019 05:04:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tjywWtwf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727888AbfCHM7h (ORCPT + 99 others); Fri, 8 Mar 2019 07:59:37 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:34138 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbfCHM7g (ORCPT ); Fri, 8 Mar 2019 07:59:36 -0500 Received: by mail-yw1-f66.google.com with SMTP id u205so16218184ywe.1 for ; Fri, 08 Mar 2019 04:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1hms/5IsZhU5jpk430jeUjgKow1Cl2U2/bwfLiqsmlw=; b=tjywWtwfNsRFziPnarakLQeBHqcExzZlpEP69AabIt5Jj00gXL5SLW/FzXDyRUOFrY afzvZjnR6Q1GyaMitkg8iy/W1MLsXZ+SGMaoMilCPRNmycasHPwOvYE+aGYPALqiLB2z r3Qb7dNoBBT1vmzNmY3MPt3g9NPBjT3WB1Sx3LP6o+v3ku45XQoMTrk8Eh12CTikY9rr GNNsibkb0VeMbUb6eO28tE/HcyB1UuDujs2L2p+1nbPfSOYfPGhEJkCKppLSbcPzBXvU 7VAm8mmhugnDugkz9v8iP0E2aEYB0xdXXobPeo7i702m285GLPTgx34Bl01m2SPj9gxY fqsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1hms/5IsZhU5jpk430jeUjgKow1Cl2U2/bwfLiqsmlw=; b=rndfOJ31a047sNGQc/HAdSi5VYfL2EcfvTevPfjXQwwUY8f3fEsosNDbvn/0Za33tM DvGmuABaoaUmo2kY99+aFGx2jB1Sz+EZwTULN9RGxQPicnHaNx+qMULL0vKrhlhIM1Ks Ew0HxvJy9e469bx54i+JkS10bEbWbK25DJ6bKpp75GRMddJnOQdWotFy6Kdgf0rw53v0 ocEqKmLdfvgGp8uZnjiZW2tnn0Ftngs/Iiciok6rnYRqWAPz8KtTuexrHfkGSsUDTmnf XBOlOCNjPDQR2FnVl4qooNio5/VL4yredF8XC1hzngO/i4TU6XxeHOX3HB7ydt0mADjJ VlPA== X-Gm-Message-State: APjAAAVkGMugePUor/CNVudXoo8vAziTGeqyg/4uHCdwgwmRV41kW6+f nJU6jVDgs5g6J3jcO/djN/o= X-Received: by 2002:a81:9a8d:: with SMTP id r135mr14065733ywg.188.1552049975020; Fri, 08 Mar 2019 04:59:35 -0800 (PST) Received: from laptop.localdomain ([185.175.33.171]) by smtp.gmail.com with ESMTPSA id g82sm3057775ywg.60.2019.03.08.04.59.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 04:59:34 -0800 (PST) From: Yasha Cherikovsky To: Ralf Baechle , Paul Burton , James Hogan , linux-mips@linux-mips.org Cc: Yasha Cherikovsky , linux-kernel@vger.kernel.org Subject: [PATCH 1/1] MIPS: Ensure ELF appended dtb is relocated Date: Fri, 8 Mar 2019 14:58:51 +0200 Message-Id: <20190308125851.31806-2-yasha.che3@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190308125851.31806-1-yasha.che3@gmail.com> References: <20190308125851.31806-1-yasha.che3@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fixes booting with the combination of CONFIG_RELOCATABLE=y and CONFIG_MIPS_ELF_APPENDED_DTB=y. Sections that appear after the relocation table are not relocated on system boot (except .bss, which has special handling). With CONFIG_MIPS_ELF_APPENDED_DTB, the dtb is part of the vmlinux ELF, so it must be relocated together with everything else. Fixes: 069fd766271d ("MIPS: Reserve space for relocation table") Signed-off-by: Yasha Cherikovsky Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org --- arch/mips/kernel/vmlinux.lds.S | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index cb7e9ed7a453..33ee0d18fb0a 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -140,6 +140,13 @@ SECTIONS PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) #endif +#ifdef CONFIG_MIPS_ELF_APPENDED_DTB + .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) { + *(.appended_dtb) + KEEP(*(.appended_dtb)) + } +#endif + #ifdef CONFIG_RELOCATABLE . = ALIGN(4); @@ -164,11 +171,6 @@ SECTIONS __appended_dtb = .; /* leave space for appended DTB */ . += 0x100000; -#elif defined(CONFIG_MIPS_ELF_APPENDED_DTB) - .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) { - *(.appended_dtb) - KEEP(*(.appended_dtb)) - } #endif /* * Align to 64K in attempt to eliminate holes before the -- 2.21.0