[PATCH] D119787: [ELF][PPC64] Fix assertion failure for branches to hidden undefined weak for -no-pie

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 14:54:57 PST 2022


MaskRay created this revision.
MaskRay added reviewers: PowerPC, nemanjai, sfertile, stefanp.
Herald added subscribers: shchenz, kbarton, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Reported by Stefan Pintilie in D119773 <https://reviews.llvm.org/D119773>.

For a branch to a hidden undefined weak symbol, there is an
`assert(sym->getVA());` failure in PPC64LongBranchTargetSection::writeTo for a
-no-pie link. The root cause is that we unnecessarily produce a dynamic
relocation for a -no-pie link.

Fix this by changing the condition to just `s.isUndefined()`. See the inline
comment.

Rename ppc64-weak-undef-call.s to ppc64-undefined-weak.s to be consistent with
other architectures.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119787

Files:
  lld/ELF/Arch/PPC64.cpp
  lld/test/ELF/ppc64-undefined-weak.s
  lld/test/ELF/ppc64-weak-undef-call-shared.s
  lld/test/ELF/ppc64-weak-undef-call.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119787.408633.patch
Type: text/x-patch
Size: 4014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/bf310f77/attachment.bin>


More information about the llvm-commits mailing list