Thread (4 messages) 4 messages, 3 authors, 2020-02-04

Re: [PATCH v2] powerpc: Do not consider weak unresolved symbol relocations as bad

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2020-01-31 09:18:33
Also in: linux-next, lkml

Alex Ghiti [off-list ref] writes:
On 1/18/20 12:03 PM, Alexandre Ghiti wrote:
quoted
Commit 8580ac9404f6 ("bpf: Process in-kernel BTF") introduced two weak
symbols that may be unresolved at link time which result in an absolute
relocation to 0. relocs_check.sh emits the following warning:

"WARNING: 2 bad relocations
c000000001a41478 R_PPC64_ADDR64    _binary__btf_vmlinux_bin_start
c000000001a41480 R_PPC64_ADDR64    _binary__btf_vmlinux_bin_end"

whereas those relocations are legitimate even for a relocatable kernel
compiled with -pie option.

relocs_check.sh already excluded some weak unresolved symbols explicitly:
remove those hardcoded symbols and add some logic that parses the symbols
using nm, retrieves all the weak unresolved symbols and excludes those from
the list of the potential bad relocations.

Reported-by: Stephen Rothwell <redacted>
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
---

Changes in v2:
- Follow Stephen advice of using grep -F instead of looping over weak symbols
   using read, patch is way smaller and cleaner.
- Add missing nm in comment

  arch/powerpc/Makefile.postlink     |  4 ++--
  arch/powerpc/tools/relocs_check.sh | 20 ++++++++++++--------
  2 files changed, 14 insertions(+), 10 deletions(-)
...
Hi guys,


Any thought about that ?

I do think this patch makes the whole check about absolute relocations 
clearer.
And in the future, it will avoid anyone to spend some time on those 
"bad" relocations
which actually aren't.
Sorry I missed the v2. Will pick it up.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help