diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index 80087e9ee59b..9f49605d89c5 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -1196,8 +1196,10 @@ void PPC64::scanSectionImpl(InputSectionBase &sec, Relocs rels) { case R_PPC64_TOC16_LO: // Record the TOC entry (.toc + addend) as not relaxable. if (sym.isSection() && isa(sym) && - cast(sym).section->name == ".toc") + cast(sym).section->name == ".toc") { + std::lock_guard lock(ctx.relocMutex); ctx.ppc64noTocRelax.insert({&sym, addend}); + } expr = R_GOTREL; break; case R_PPC64_TOC16_HA: diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 0000f1b4d905..7b4d7217e045 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -1184,11 +1184,9 @@ template void elf::scanRelocations(Ctx &ctx) { // copy relocations, etc. Note that relocations for non-alloc sections are // 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 = !ctx.arg.zCombreloc || ctx.arg.emachine == EM_MIPS || - ctx.arg.emachine == EM_PPC64; + // MIPS modifies MipsGotSection during relocation scanning, which is not + // suitable for parallelism. + bool serial = ctx.arg.emachine == EM_MIPS; parallel::TaskGroup tg; auto outerFn = [&]() { for (ELFFileBase *f : ctx.objectFiles) { diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 2da3f1afeb82..3c08c392ff21 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -4564,7 +4564,7 @@ template void elf::createSyntheticSections(Ctx &ctx) { ctx, relaDynName, threadCount); else part.relaDyn = std::make_unique>( - ctx, relaDynName, ctx.arg.zCombreloc, threadCount); + ctx, relaDynName, /*combreloc=*/true, threadCount); if (ctx.hasDynsym) { add(*part.dynSymTab); diff --git a/lld/test/ELF/combreloc.s b/lld/test/ELF/combreloc.s index 08e404c66676..8e76de912bb4 100644 --- a/lld/test/ELF/combreloc.s +++ b/lld/test/ELF/combreloc.s @@ -32,11 +32,11 @@ # NOCOMB: Relocations [ # NOCOMB-NEXT: Section ({{.*}}) .rela.dyn { # NOCOMB-NEXT: 0x3418 R_X86_64_RELATIVE - 0x3420 -# NOCOMB-NEXT: 0x33F8 R_X86_64_64 aaa 0x0 -# NOCOMB-NEXT: 0x3400 R_X86_64_64 ccc 0x0 -# NOCOMB-NEXT: 0x3408 R_X86_64_64 bbb 0x0 -# NOCOMB-NEXT: 0x3410 R_X86_64_64 aaa 0x0 # NOCOMB-NEXT: 0x23F0 R_X86_64_GLOB_DAT aaa 0x0 +# NOCOMB-NEXT: 0x33F8 R_X86_64_64 aaa 0x0 +# NOCOMB-NEXT: 0x3410 R_X86_64_64 aaa 0x0 +# NOCOMB-NEXT: 0x3408 R_X86_64_64 bbb 0x0 +# NOCOMB-NEXT: 0x3400 R_X86_64_64 ccc 0x0 # NOCOMB-NEXT: } .globl aaa, bbb, ccc