[PATCH] D159543: [BOLT] Fix .relr section addend patching
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 08:50:04 PDT 2023
yota9 created this revision.
yota9 added reviewers: maksfb, rafauler, Amir.
Herald added subscribers: treapster, ayermolo, kristof.beyls.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a project: All.
yota9 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch fixes 2 problems:
1. For aarch64: If the function body is empty emit constant islands
alignment before emiting function symbols, so aligning nops won't be
part of CI data and we won't address them i.e. with
getNewFunctionOrDataAddress on patching. The test is unsing relr
section patching, previosly it would fail because of wrong alinment of
mytextP function since it the symbol won't be 8 bytes aligned (alignment
nop would be emited inside of CI) and relr patching would have to create
new relocation entry and .relr.dyn section doesn't have enough space for it.
2. The new relocation offset in .relr section patching was calculated
wrong. Pass the new file offset to lambda instead of re-calculating it
in it. Test removes relocation from mytext section, so in case of wrong
offset calculation we won't emit right addend value.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159543
Files:
bolt/lib/Core/BinaryEmitter.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/test/AArch64/constant_island_pie_update.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159543.557247.patch
Type: text/x-patch
Size: 4417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230922/e9df68cb/attachment.bin>
More information about the llvm-commits
mailing list