[PATCH] D86879: [XCOFF][AIX] Handle TOC entries that could not be reached by positive range in small code model

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 13:14:16 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:595
+    return MCBinaryExpr::createAdd(
+        Expr, MCConstantExpr::create(-Adjustment, OutContext), OutContext);
+  };
----------------
jasonliu wrote:
> hubert.reinterpretcast wrote:
> > How would this relate to `XCOFFObjectWriter::recordRelocation`?
> > 
> > I notice that there's a line there:
> > ```
> > FixedValue = SectionMap[SymASec]->Address - TOCCsects.front().Address;
> > ```
> > 
> > Does the new expression formed here mean that we should account for it through `Target.getConstant()`?
> From the testing I have done, there seems to be no particular action need to be taken there (except removing that report_fatal_error in there), as the value we put into the instruction could already wrap around naturally when it goes out of the range.
I think we should add the `Target.getConstant()` because it could show up for using the TD storage mapping class or maybe for integrated assembly. The `report_fatal_error` enforces a constraint that the no wraparound is necessary at that stage. As in, we may want the object-writing path to require input that would also work on the assembly-writing path.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86879/new/

https://reviews.llvm.org/D86879



More information about the llvm-commits mailing list