[PATCH] D72571: [MIPS] Don't add R_(MICRO)MIPS_JALR relocations against data symbols

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 08:49:30 PST 2020


arichardson created this revision.
arichardson added reviewers: atanasyan, jrtc27, vstefanovic.
Herald added subscribers: llvm-commits, hiraditya, sdardis.
Herald added a project: LLVM.

The R_(MICRO)MIPS_JALR optimization only works when used against functions.
Using the relocation against a data symbol (e.g. function pointer) will
cause some linkers that don't ignore the hint in this case (e.g. LLD prior
to commit 5bab291b7b <https://reviews.llvm.org/rG5bab291b7bd043104abf1ca7977e8248684cae95>) to generate a relative branch to the data symbol
which crashes at run time. Before this patch, LLVM was erroneously emitting
these relocations against local-dynamic TLS function pointers and global
function pointers with internal visibility.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72571

Files:
  llvm/lib/Target/Mips/MipsISelLowering.cpp
  llvm/test/CodeGen/Mips/reloc-jalr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72571.237539.patch
Type: text/x-patch
Size: 10669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200112/09de0520/attachment.bin>


More information about the llvm-commits mailing list