Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3526993ybl; Sun, 12 Jan 2020 20:35:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzvGVML5EZ5wpDVbX/KzcH3+PKy/QDGdiPWKnCZ46t5RklflqnZFzuGElbleUDVjS0f0RTu X-Received: by 2002:a9d:da2:: with SMTP id 31mr11268736ots.319.1578890127662; Sun, 12 Jan 2020 20:35:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578890127; cv=none; d=google.com; s=arc-20160816; b=Ft8+FkELIeYS0+586N0rAv64Z4Qkfaz6QPaurQIbUUjdFlq+jisKOhc9DcrdUkUndK jsndyZ3hbRVJ6Ri+PRCQmfnI9hyqD0kGC0NplDsladP06X2+xi1lstKU8tEQFgVB//0o EWNqKLmcFnDRU/MkyxkJpEXCb1jbJIXJmqdYM6nHNzZ7tNHFHi2LAFBk1d4CuPR+12on VZK1VGbuLHlO7oU3jeiyXIvXmwn2smt4d0+Ph4B51sOcipcGWQpke+KSMvVPlzWeICiM WmglJDnw2BCFoTpwpAJiwuq+mqBfwCql8ks3Q4+DdFDPSCm3to93+tpJuxkwsrkXHtID A97w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0SADaU9gu70a2Bm0Kanw0/QkZVrOHiIb+3LRKLBcUWk=; b=TAAVyE3N4mP4KXCBJAdfTAMDbnb/H4JO5WgrqqCDnx5nmq8btplbrPGgSdbJM8+BvC C14Vz/urdFipNZkGad7B/aIzKBqbVpq1NxrbLNAp3TAoLZ4byJs0yTjk6W23OyDiHAJc dAa/TLzCSjodI8/KKV7gN82cv7Pw84Gs8wZTMwtmSEkbaOoq6EsWOYDJaV0ldcvBKfUz yOSrz06ATV2AZmMKqpgkT0s8DL1lo8n6cozyw9lvn/EPeDPrCe1EzKmZdDAkBSAG/l7f yU9smJnzaRH5NPDv8Wg2SnX5mQGx0GykA8+JUbRUtqwr/hi1NoFb/lq3gqD69shRyQAP +VoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=OxFJ5+uP; 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 q131si4956494oig.203.2020.01.12.20.35.15; Sun, 12 Jan 2020 20:35:27 -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=@sifive.com header.s=google header.b=OxFJ5+uP; 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 S2387623AbgAMEdv (ORCPT + 99 others); Sun, 12 Jan 2020 23:33:51 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:33584 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387540AbgAMEdv (ORCPT ); Sun, 12 Jan 2020 23:33:51 -0500 Received: by mail-ot1-f65.google.com with SMTP id b18so7816419otp.0 for ; Sun, 12 Jan 2020 20:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0SADaU9gu70a2Bm0Kanw0/QkZVrOHiIb+3LRKLBcUWk=; b=OxFJ5+uPpMQkwvT9Qje5xmITqR1pEl3memtQG8Of66iLLXIir/M+praEuySJUPpWqx B7k8EbjZfdkqQtjY7IOgRq/+bLOoJw0+Spj1+UCP9x0BoGO+r6hPIyQ9fl/tDsd1miBa RD7OyyUJkbYPcTYY11AR32jO97qb5LBnOc6cysWfFY761YIxTiErD/jyiKNnNneKy8Ek VJ8n3eNNluAdNyiiQrPSN050ayi1RvZbWNM07Dwfo+GwlQrh4LBz2p+loFt7Ezh9PzS5 hRO1OvgiH8Xrlt5JLkPpxi2yPu9JEOjmeygncihU08HnpWE6Bz4mej+gZFrOGt7W+9CS eUqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0SADaU9gu70a2Bm0Kanw0/QkZVrOHiIb+3LRKLBcUWk=; b=dZ3hqufn/hUBOuAMi/2vlpM2A7trHZEdHvzMOPPPDbpVGmOjEmOGp1/Vkf2eZgbd0f TegEmRDVMYTYKpz6F7K6FU4nsqGltctdjglVZYXGAOFbGy9rZaM8Jrf2BxBwZTSdzvP4 UsFXbtpfeTYiJ9bG+jaD6PSCy5/NHeSIu0ThbvIizMRiwqdlRUgqh2i+tBUCvsBIvr2j Gx22o+KZcp6XrJxoQV5h8diQUk63cpNAxHH4oYF939l55bTu/yg4Ot/Ta2lOQE1fBx2f u0VnHowgD4z4PZRl+D7daDitHLgVQbbJVM1eE3MXQ95B2uFNyXop2maMb7rtp9Y0YlDu bPzQ== X-Gm-Message-State: APjAAAWJen2/FMIvgI9RiqQj74wHjWWpTMXHZrJbaKvKmtLb+2vkA/Zf yhbqgW+u5/N8HIb6U/FwsrNNhN3wBch1gLZRtgiioeGmU18= X-Received: by 2002:a9d:2c68:: with SMTP id f95mr12075160otb.33.1578890030841; Sun, 12 Jan 2020 20:33:50 -0800 (PST) MIME-Version: 1.0 References: <20191018105657.4584ec67@canb.auug.org.au> <20191028110257.6d6dba6e@canb.auug.org.au> In-Reply-To: From: Zong Li Date: Mon, 13 Jan 2020 12:33:40 +0800 Message-ID: Subject: Re: linux-next: build warning after merge of the bpf-next tree To: Alexandre Ghiti Cc: Palmer Dabbelt , Stephen Rothwell , daniel@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org, linux-next@vger.kernel.org, "linux-kernel@vger.kernel.org List" , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 11, 2020 at 10:31 PM Alexandre Ghiti wrote: > > > 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 :) > I'm not quite familiar with btf, so I have no idea why there are two weak symbols be added in 8580ac9404f6 ("bpf: Process in-kernel BTF") as well, According on relocation mechanism, maybe it is unnecessary to handle weak undefined symbol at this time, because there is no substantive help to relocate the absolute value 0. I just simply ignore the non-relative relocation types to make processing can go forward, and it works for me based on v5.5-rc5. > Alex >