diff options
| -rw-r--r-- | lld/ELF/Writer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 5bd06d0fe0e..a7d80827a80 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -312,10 +312,11 @@ void Writer<ELFT>::scanRelocs( // Here we are creating a relocation for the dynamic linker based on // a relocation from an object file, but some relocations need no - // load-time fixup. Skip such relocation. + // load-time fixup when the final target is known. Skip such relocation. bool CBP = canBePreempted(Body, NeedsGot); - bool NoDynrel = Target->isRelRelative(Type) || Target->isSizeReloc(Type); - if (!CBP && (NoDynrel || !Config->Shared)) + bool NoDynrel = Target->isRelRelative(Type) || Target->isSizeReloc(Type) || + !Config->Shared; + if (!CBP && NoDynrel) continue; if (CBP) |

