[PATCH] D117612: [BOLT] Update dynamic relocations from section relocations
Maksim Panchenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 24 00:47:34 PST 2022
maksfb added inline comments.
================
Comment at: bolt/include/bolt/Core/Relocation.h:56
+ /// the relocation is read from DT_JMPREL, otherwise it came from DT_RELA.
+ bool IsJmpRel = false;
+
----------------
Instead of introducing this flag, could we change the rewriter to classify relocation types based on the input?
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:4820
+ if (!Offset || !EndOffset) {
+ errs() << "BOLT_ERROR: Invalid offsets for dynamic relocation\n";
+ exit(1);
----------------
================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:4825
+ if (Offset + sizeof(NewRelA) > EndOffset) {
+ errs() << "BOLT_ERROR: Offset overflow for dynamic relocation\n";
+ exit(1);
----------------
================
Comment at: bolt/test/runtime/AArch64/Inputs/runtime_relocs.c:2
+int a = 1;
+__attribute__((used)) int *b = &a; //R_*_ABS64
+
----------------
================
Comment at: bolt/test/runtime/AArch64/Inputs/runtime_relocs.c:10-11
+int inc(int var) {
+ ++a; //R_*_GLOB_DAT
+ ++t1; //R_*_TLSDESC
+ return var + 1;
----------------
================
Comment at: bolt/test/runtime/AArch64/runtime_relocs.c:9
+// RUN: llvm-bolt %t.exe -o %t.bolt.exe -use-old-text=0 -lite=0
+// RUN: LD_PRELOAD=%t.bolt.so %t.bolt.exe
+
----------------
Is it necessary to run the binary?
================
Comment at: bolt/test/runtime/AArch64/runtime_relocs.c:48
+
+extern int a; //R_*_COPY
+
----------------
================
Comment at: bolt/test/runtime/AArch64/runtime_relocs.c:50
+
+extern __thread int t1; //R_*_TLS_TPREL64
+
----------------
================
Comment at: bolt/test/runtime/AArch64/runtime_relocs.c:52
+
+int inc(int a); //R_*_JUMP_SLOT
+
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117612/new/
https://reviews.llvm.org/D117612
More information about the llvm-commits
mailing list