[llvm] [PPC] Don't emit overflow error on branches accross different sections. (PR #206812)
Zarko Todorovski via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 05:20:34 PDT 2026
================
@@ -553,6 +553,36 @@ static MCSectionXCOFF *getContainingCsect(const MCSymbolXCOFF *XSym) {
return XSym->getRepresentedCsect();
}
+// Checks that the section that contains the fragment F and the section
+// that contains the Target are different.
+static bool haveDifferentSections(const MCFragment &F, MCValue Target) {
+ const MCSymbol *TargetSym = Target.getAddSym();
+ if (!TargetSym)
+ return false;
+
+ // Target is externally defined.
+ if (!TargetSym->isDefined())
+ return true;
+
+ const MCSection *FragSection = F.getParent();
+ const MCSection *TargetSection = TargetSym->getFragment()->getParent();
+ return TargetSection != FragSection;
+}
+
+static bool callOverflows(MCFixupKindInfo Info, uint64_t FixedValue) {
+ if (Info.TargetSize != 24)
+ report_fatal_error("Unexepected call fixup kind for XCOFF");
+
+ return !isIntN(26, FixedValue);
+}
+
+static uint64_t normalizeCallOffset(MCFixupKindInfo Info, uint64_t Offset) {
+ if (Info.TargetSize != 24)
+ report_fatal_error("Unexepected call fixup kind for XCOFF");
----------------
ZarkoT wrote:
```suggestion
report_fatal_error("Unexpected call fixup kind for XCOFF");
```
https://github.com/llvm/llvm-project/pull/206812
More information about the llvm-commits
mailing list