This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by arichardson on Jan 12 2020, 8:44 AM.

Details

Summary

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) 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.

Diff Detail

Event Timeline

arichardson created this revision.Jan 12 2020, 8:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2020, 8:44 AM

Unit tests: pass. 61774 tests passed, 0 failed and 780 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

This revision is now accepted and ready to land.Jan 13 2020, 5:21 AM
This revision was automatically updated to reflect the committed changes.