[PATCH] D152944: [BOLT] Set IsRelro section attribute based on PT_GNU_RELRO segment
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 16 14:41:43 PDT 2023
maksfb added inline comments.
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:419
+ if (Sec.sh_type == ELF::SHT_NOBITS)
+ return Phdr.p_type == ELF::PT_TLS;
+
----------------
We call this function only when `Phdr.p_type == ELF::PT_GNU_RELRO`. Do you plan to use it for more checks?
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:468
+
+Error RewriteInstance::checkGnuRelroSegment() {
+ using ELFT = ELF64LE;
----------------
Rename.
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:490
+ };
+ if (Expected<ELFT::PhdrRange> PHsOrErr = Obj.program_headers())
+ llvm::for_each(PHsOrErr.get(), UpdateSectionsForSegment);
----------------
We check the validity of `program_headers()` in `discoverStorage()`. Let's use `cantFail()` here.
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:1788
}
if (HasDebugInfo && !opts::UpdateDebugSections && !opts::AggregateOnly) {
----------------
Let's call the new function from here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152944/new/
https://reviews.llvm.org/D152944
More information about the llvm-commits
mailing list