[lld] bce6416 - [ELF] --pack-dyn-relocs=android: scan relocation serially after D133003

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 11:43:21 PDT 2022


Author: Fangrui Song
Date: 2022-09-21T11:43:13-07:00
New Revision: bce6416775ea1577f0a7f82cc012cf0c1b9d9ce5

URL: https://github.com/llvm/llvm-project/commit/bce6416775ea1577f0a7f82cc012cf0c1b9d9ce5
DIFF: https://github.com/llvm/llvm-project/commit/bce6416775ea1577f0a7f82cc012cf0c1b9d9ce5.diff

LOG: [ELF] --pack-dyn-relocs=android: scan relocation serially after D133003

https://reviews.llvm.org/D133003#3806508 can reproduce a non-determinism with
--threads=4. Making the config serial fixes non-determinism (by running the link
many times and compare output).

Added: 
    

Modified: 
    lld/ELF/Relocations.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index ecb0c48cee14..027f2c3636c4 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1541,10 +1541,11 @@ template <class ELFT> void elf::scanRelocations() {
   // directly processed by InputSection::relocateNonAlloc.
 
   // Deterministic parallellism needs sorting relocations which is unsuitable
-  // for -z nocombreloc. MIPS and PPC64 use global states which are not suitable
-  // for parallelism.
-  bool serial = !config->zCombreloc || config->emachine == EM_MIPS ||
-                config->emachine == EM_PPC64;
+  // for -z nocombreloc and does not currently work with
+  // AndroidPackedRelocationSection. MIPS and PPC64 use global states which are
+  // not suitable for parallelism.
+  bool serial = !config->zCombreloc || config->androidPackDynRelocs ||
+                config->emachine == EM_MIPS || config->emachine == EM_PPC64;
   parallel::TaskGroup tg;
   for (ELFFileBase *f : ctx->objectFiles) {
     auto fn = [f]() {


        


More information about the llvm-commits mailing list