[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 14:08:50 PST 2022


maksfb added inline comments.


================
Comment at: bolt/include/bolt/Core/Relocation.h:50-52
+  /// The dynamic relocations stores the symbol value used to patch dynamic
+  /// relocations.
   uint64_t Value;
----------------
I feel uneasy about overloading the `Value` field. An alternative will be to keep `MCSymbol -> index` map for dynamic symbols. What do you think?


================
Comment at: bolt/include/bolt/Rewrite/RewriteInstance.h:439
 
+  /// Stores true if relocation of specified type is came from .rela.plt
+  std::map<uint64_t, bool> IsJmpRelocation;
----------------



================
Comment at: bolt/include/bolt/Rewrite/RewriteInstance.h:440
+  /// Stores true if relocation of specified type is came from .rela.plt
+  std::map<uint64_t, bool> IsJmpRelocation;
+
----------------
`DenseMap` is a better choice, maybe even `IndexedMap`.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:2138
+    if (IsJmpRel)
+      IsJmpRelocation[Type] = true;
+
----------------
Does it make sense to pre-populate the map with types that are known to be jump relocations?


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