[PATCH] D144356: [XCOFF] support the ref directive for object generation.
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 16:55:52 PST 2023
shchenz added inline comments.
================
Comment at: llvm/lib/MC/MCXCOFFStreamer.cpp:88
+ MCDataFragment *DF = getOrCreateDataFragment();
+ getAssembler().getWriter().recordRefSymbol(Symbol, DF);
+}
----------------
This would be very strange directly calling to XCOFFObjectWriter and skipping the abstract MC layer. For example, with this implementation I think you can not get the `MCFixups` for the refs in the `MCAssembler` dumping?
Is it possible to just create a `MCFixup` here and use existing logic to handle the relocations? With this method I think you don't need the `std::vector<std::pair<const MCSymbol *, const MCFragment *>> RefSymbolInfo` in the XCOFFObjectWriter.cpp, the `MCFixups` should all be attached to the `MCFragment` of the `MCSection`.
================
Comment at: llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll:104
+; OBJ-NEXT: 00000100 R_POS .main
+; OBJ-NEXT: 00000104 R_POS TOC
----------------
We also need a case that has `R_REF` relocation for `.text` section.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144356/new/
https://reviews.llvm.org/D144356
More information about the llvm-commits
mailing list