This is an archive of the discontinued LLVM Phabricator instance.

[ELF][RISCV] Treat R_RISCV_{ADD,SET,SUB}* as link-time constants
ClosedPublic

Authored by MaskRay on Jun 11 2019, 11:33 PM.

Details

Summary

R_RISCV_{ADD,SET,SUB}* are expected to be used as local label
computation. Add a new RelExpr R_RISCV_ADD to represent them.

R_RISCV_ADD is treated as a link-time constant because otherwise
R_RISCV_{ADD,SET,SUB}* are not allowed in a non-writable section in
-pie/-shared mode.

In glibc Scrt1.o, .rela.eh_frame contains such relocations. With D63076
and this patch, I can run -pie/-shared programs linked against glibc.

Note llvm-mc cannot currently produce R_RISCV_SET* so they are not
tested.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Jun 11 2019, 11:33 PM
Herald added a project: Restricted Project. · View Herald Transcript
ruiu accepted this revision.Jun 11 2019, 11:48 PM

LGTM

This revision is now accepted and ready to land.Jun 11 2019, 11:48 PM
This revision was automatically updated to reflect the committed changes.