[PATCH] D23195: [ARM] Add support for embedded position-independent code

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 03:32:58 PDT 2016


olista01 created this revision.
olista01 added reviewers: rengolin, t.p.northover, weimingz, srhines.
olista01 added a subscriber: llvm-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: samparker, rengolin, aemerson.

This patch adds support for some new relocation models to the ARM
backend:
- Read-only position independence (ROPI): Code and read-only data is
  accessed PC-relative. The offsets between all code and RO data
  sections are known at static link time. This does not affect
  read-write data.
- Read-write position independence (RWPI): Read-write data is accessed
  relative to the static base register (r9). The offsets between all
  writeable data sections are known at static link time. This does not
  affect read-only data.

These two modes are independent (they specify how different objects
should be addressed), so they can be used individually or together. They
are otherwise the same as the "static" relocation model, and are not
compatible with SysV-style PIC using a global offset table.

These modes are normally used by bare-metal systems or systems with
small real-time operating systems. They are designed to avoid the need
for a dynamic linker, the only initialisation required is setting r9 to
an appropriate value for RWPI code.

I have only added support to SelectionDAG, not FastISel, because
FastISel is currently disabled for bare-metal targets where these modes
would be used.

Repository:
  rL LLVM

https://reviews.llvm.org/D23195

Files:
  include/llvm/CodeGen/CommandFlags.h
  include/llvm/Support/CodeGen.h
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMConstantPoolValue.cpp
  lib/Target/ARM/ARMConstantPoolValue.h
  lib/Target/ARM/ARMFastISel.cpp
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ARMSubtarget.cpp
  lib/Target/ARM/ARMSubtarget.h
  lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
  lib/Target/TargetLoweringObjectFile.cpp
  test/CodeGen/ARM/arm-position-independence-jump-table.ll
  test/CodeGen/ARM/arm-position-independence.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23195.66919.patch
Type: text/x-patch
Size: 33165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/a53880e0/attachment.bin>


More information about the llvm-commits mailing list