Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1975372ybl; Sat, 11 Jan 2020 06:33:02 -0800 (PST) X-Google-Smtp-Source: APXvYqz/+jkKuaAE9tpPOEYyQSQsM1F8N2CJDK+cZl0de62WaJWBFsYPQSMgdRFTJqqPyM+o7gVm X-Received: by 2002:aca:5582:: with SMTP id j124mr6114958oib.20.1578753182898; Sat, 11 Jan 2020 06:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578753182; cv=none; d=google.com; s=arc-20160816; b=F2lMJKD2CH3ipcyrgucEbeM8UJ3PG6cYAii5AJaIFIn+GSPp1aw701CpdF8fHqKPMG 83itRY5MR+unMNU0ChxUX5FIVWcDSDvf68+myvIUkMmyVXPnJK7u4n91rBO+DYGDyBpN GiypBwG/QCSgoJUFmtcPqrbhWiwnEFjimdGzdBkr45ZWSOoA6BQAs3+5sX/vLPxOJTV9 XMAatB0eUKaJLEPttfq3GqI/nwbTx8ZdTWl1d2vFZ5p2n0OdOrKAY1RYE+i5qkY8suOG sPb9InIOHEmWmUe3gHrZIYyb5y1XW5BdnZncNCJ1811fgS7OJi/Cb8HT/VdzPSeWfkif IPew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=+k+ZcQN7YeRcJdb4geEcSTxP7Qits5hDK6mcL9UWElI=; b=kl2wGD3RyfRUJ7nogXpXvtEnnMbNjg23GqT4vDCNxEK4eM1zV15JKM7lWSaAeOi5o2 IeHWqi0ZzPToLHxMLbmqYhjfVhGGYEyTi4ffMb+A4TI40Slqjrlk7ABWku+9Z4dXVNhy 5LK+uj6yD61pTdUCRh7px6q+5gejsNK2jvKXS/dgZfL9MO+KRGlhwxWtUGixPAFz9RJ5 QHKbuIDEIWptv9T+pWC1IGaFtVvC5BT1Dqr8k5LPlzOG9cKw1t73uaVDUEbKM3VRBbWo O2DLpCRRC6MzcCzekz7uH6PPR08vCkVAvXrd+0VGFYIJATNYT+7Ro6RkViU+wmLqJ+9J IPTA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m90si3559469otc.259.2020.01.11.06.32.50; Sat, 11 Jan 2020 06:33:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729784AbgAKObz (ORCPT + 99 others); Sat, 11 Jan 2020 09:31:55 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:58275 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729743AbgAKObz (ORCPT ); Sat, 11 Jan 2020 09:31:55 -0500 X-Originating-IP: 79.86.19.127 Received: from [192.168.0.12] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alexandre@ghiti.fr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D0921E0002; Sat, 11 Jan 2020 14:31:50 +0000 (UTC) From: Alexandre Ghiti Subject: Re: linux-next: build warning after merge of the bpf-next tree To: Palmer Dabbelt Cc: Stephen Rothwell , daniel@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, zong.li@sifive.com References: <20191018105657.4584ec67@canb.auug.org.au> <20191028110257.6d6dba6e@canb.auug.org.au> Message-ID: Date: Sat, 11 Jan 2020 09:31:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/10/20 7:20 PM, Palmer Dabbelt wrote: > On Fri, 10 Jan 2020 14:28:17 PST (-0800), alexandre@ghiti.fr wrote: >> Hi guys, >> >> On 10/27/19 8:02 PM, Stephen Rothwell wrote: >>> Hi all, >>> >>> On Fri, 18 Oct 2019 10:56:57 +1100 Stephen Rothwell >>> wrote: >>>> Hi all, >>>> >>>> After merging the bpf-next tree, today's linux-next build (powerpc >>>> ppc64_defconfig) produced this warning: >>>> >>>> WARNING: 2 bad relocations >>>> c000000001998a48 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_start >>>> c000000001998a50 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_end >>>> >>>> Introduced by commit >>>> >>>>    8580ac9404f6 ("bpf: Process in-kernel BTF") >>> This warning now appears in the net-next tree build. >>> >>> >> I bump that thread up because Zong also noticed that 2 new >> relocations for >> those symbols appeared in my riscv relocatable kernel branch following >> that commit. >> >> I also noticed 2 new relocations R_AARCH64_ABS64 appearing in arm64 >> kernel. >> >> Those 2 weak undefined symbols have existed since commit >> 341dfcf8d78e ("btf: expose BTF info through sysfs") but this is the fact >> to declare those symbols into btf.c that produced those relocations. >> >> I'm not sure what this all means, but this is not something I expected >> for riscv for >> a kernel linked with -shared/-fpie. Maybe should we just leave them to >> zero ? >> >> I think that deserves a deeper look if someone understands all this >> better than I do. > > Can you give me a pointer to your tree and how to build a relocatable > kernel? > Weak undefined symbols have the absolute value 0, So according to you the 2 new relocations R_RISCV_64 are normal and should not be modified at runtime right ? > but the kernel is linked at > an address such that 0 can't be reached by normal means.  When I added > support > to binutils for this I did it in a way that required almost no code -- > essetially I just stopped dissallowing x0 as a possible base register > for PCREL > relocations, which results in 0 always being accessible.  I just > wanted to get > the kernel to build again, so I didn't worry about chasing around all the > addressing modes.  The PIC/PIE support generates different relocations > and I > wouldn't be surprised if I just missed one (or more likely all) of them. > > It's probably a simple fix, though I feel like every time I say that > about the > linker I end up spending a month in there... You can find it here: https://github.com/AlexGhiti/riscv-linux/tree/int/alex/riscv_relocatable_v1 Zong fixed the bug introduced by those 2 new relocations and everything works like a charm, so I'm not sure you have to dig in the linker :) Alex