[PATCH] D152944: [BOLT] Mark sections read-only based on PT_GNU_RELRO segment

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 11:52:25 PDT 2023


Amir created this revision.
Amir added a reviewer: bolt.
Herald added subscribers: treapster, ayermolo, pengfei.
Herald added a reviewer: rafauler.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Handle PT_GNU_RELRO segment in accordance with Linux Standard Base
chapter 12:

> PT_GNU_RELRO

The array element specifies the location and size of a segment which may
be made *read-only* after relocations have been processed.

Perform a readelf-style mapping check between this segment and sections,
mark sections as read-only.

Update gotpcrelx.s test as we start recognizing `jmp *foo at GOTPCREL(%rip)` as
fixed indirect jump and convert it to a tail call with `X86::JMP32m` opcode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152944

Files:
  bolt/include/bolt/Core/BinarySection.h
  bolt/include/bolt/Rewrite/RewriteInstance.h
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/X86/gotpcrelx.s
  bolt/test/X86/pt_gnu_relro.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152944.531450.patch
Type: text/x-patch
Size: 6493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230614/34115b88/attachment.bin>


More information about the llvm-commits mailing list