Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8363901ybl; Thu, 16 Jan 2020 15:24:05 -0800 (PST) X-Google-Smtp-Source: APXvYqw39l0cW89l82wDfzWXMjNOX7Y7zqmr8Mi8NHyObXsKEhmtRmD3ck7VHgTK9G+PW90si7KO X-Received: by 2002:aca:c415:: with SMTP id u21mr1315226oif.49.1579217045246; Thu, 16 Jan 2020 15:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579217045; cv=none; d=google.com; s=arc-20160816; b=EzbE8AwtCwdfjAAufz+ns42bKfOUuB25bwkjTFoJHL9t9yhuqomRM9LbQlIZKybqmo sN4TCzbJZvFooqPqSYNkv2yF7utmZxPsOx8oo57oCkHtbxcANb8ot0j8u0C/DV6wKB5B pKgv/0Fs1IuiSBQztMAYEnGxGDA/5ewnFcuo7CTkb0hpIKQPp64zLXiXEuZL56Ta6xC1 tbhaYDot5vpddypptxlgBC7dD3ELyAM7/WsS4e7+azasTmkL/OQ6UZdDtVeKRouF6ZW4 HGWxpnZR4kSEBnyQ3hIyeB30ZMet3rqpGr9KLvi53JwmkPBxpD0EwKhUBAiuhKEBoA2t jo3g== 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:from:references:cc:to:subject; bh=afUCpHua98VKzalcaRa3K9HxPic8J/nPE3YVre9CeuQ=; b=dw9C11mocCHBdR3h+oGnqK/GMXQxvnt7Czglc2bsy04J82+MZdjcA7x4Ryphfc7eS3 PCe6y6aeUU0zgcEuLvFUJ98SNfbsG+2Q6aU4cZk2X3v26SEdPhbXm9gjy/es2boA2K2b TfLNHY8gZwwOgsmHtgQTHXkFHOUb6DoBzBL9+FJS2NF5c2n7AKIKUsrolxovDT7uvPoU H/4K33nZafi8WCwy7+fQdPdWkJwxjQA7TrNDsGgBl0egYtIKEC/AT1gdrdh12Akn7e6y pqu/UsCgMn0JETlWTjSWyYrOwTnog4uKg2I7dqcaYmKZjZ1unnA24QmykBWPuxt4TYqi chSw== 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 e26si2314068otp.140.2020.01.16.15.23.53; Thu, 16 Jan 2020 15:24:05 -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 S1730535AbgAPTtY (ORCPT + 99 others); Thu, 16 Jan 2020 14:49:24 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:56709 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729331AbgAPTtY (ORCPT ); Thu, 16 Jan 2020 14:49:24 -0500 Received: from [192.168.0.12] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id DC94C240002; Thu, 16 Jan 2020 19:49:19 +0000 (UTC) Subject: Re: [PATCH] powerpc: Do not consider weak unresolved symbol relocations as bad To: Stephen Rothwell Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , linux-next@vger.kernel.org, Zong Li , Palmer Dabbelt References: <20200115204648.7179-1-alex@ghiti.fr> <20200116103932.2e603cf9@canb.auug.org.au> From: Alex Ghiti Message-ID: Date: Thu, 16 Jan 2020 14:49:19 -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: <20200116103932.2e603cf9@canb.auug.org.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephen, On 1/15/20 6:39 PM, Stephen Rothwell wrote: > Hi Alexandre, > > Thanks for sorting this out. Just a few comments below. > > On Wed, 15 Jan 2020 15:46:48 -0500 Alexandre Ghiti wrote: >> >> # Have Kbuild supply the path to objdump so we handle cross compilation. > ^ > "and nm" > >> +# Remove from the bad relocations those that match an undefined weak symbol >> +# which will result in an absolute relocation to 0. >> +# Weak unresolved symbols are of that form in nm output: >> +# " w _binary__btf_vmlinux_bin_end" >> +undef_weak_symbols=$($nm "$vmlinux" | awk -e '$1 ~ /w/ { print $2 }') >> + >> +while IFS= read -r weak_symbol; do >> + bad_relocs="$(echo -n "$bad_relocs" | sed "/$weak_symbol/d")" >> +done <<< "$undef_weak_symbols" > This is not a bash script, and the above is a bashism :-( > Also, my version of awk (mawk) doesn't have a -e option. > > How about something like : > > undef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }') > if [ "$undef_weak_symbols" ]; then > bad_relocs="$(echo "$bad_relocs" | grep -F -w -v "$undef_weak_symbols")" > fi > > Or do this near the top and add the grep to the others. Yes that's quite better, thanks, I'll send a new version tomorrow. Thanks again, Alex