[PATCH] D77694: [WIP][RISCV][ELF] Linker relaxation support

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 16:55:13 PDT 2020


jrtc27 created this revision.
Herald added subscribers: llvm-commits, evandro, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, mgrang, edward-jones, zzheng, MaskRay, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, krytarowski, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.

This is a proof-of-concept implementation for R_RISCV_ALIGN that I've had lying
around for a while. I just rebased it, but it has not been build tested, let
alone run. It was previously able to link a working FreeBSD kernel, though, and
compared bit-for-bit identical to an -mno-relax build. I'm posting this here as
it came up on IRC and I figured it would be best to share it and avoid
duplicating work (and perhaps also promoting a bit more discussion about how to
implement this correctly in LLD; the mutableData/makeMutableDataCopy is a bit
of a gross hack that could potentially go wrong if consumers of data hang on to
now-stale pointers, and it would be nice if we could instead just
mprotect/mremap/etc the mapping and let the OS CoW as needed whilst retaining
the same address, although given I work on CHERI and CHERI has minor issues
with the mprotect/mremap interface _increasing_ permissions, perhaps I should
not be pushing for that).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77694

Files:
  lld/ELF/Arch/RISCV.cpp
  lld/ELF/InputSection.cpp
  lld/ELF/InputSection.h
  lld/ELF/Relocations.cpp
  lld/ELF/Relocations.h
  lld/ELF/Target.cpp
  lld/ELF/Target.h
  lld/ELF/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77694.255860.patch
Type: text/x-patch
Size: 14942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200407/5c354167/attachment-0001.bin>


More information about the llvm-commits mailing list