[llvm-branch-commits] [llvm] [GOFF] Add writing of section symbols (PR #133799)

Ulrich Weigand via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 3 09:19:34 PDT 2025


================
@@ -2759,6 +2760,12 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForLSDA(
 //===----------------------------------------------------------------------===//
 TargetLoweringObjectFileGOFF::TargetLoweringObjectFileGOFF() = default;
 
+void TargetLoweringObjectFileGOFF::getModuleMetadata(Module &M) {
+  // Set the main file name if not set previously by the tool.
+  if (getContext().getMainFileName().empty())
+    getContext().setMainFileName(M.getSourceFileName());
----------------
uweigand wrote:

Hmm.  This sets the common-code "MainFileName", where it otherwise wouldn't be set.  I'm not sure if this is causing any problems - but it would be a place where we behave differently than others, which is usually better to avoid ...

If it makes sense in general to default MainFileName to SourceFileName when compiling a module, maybe that could and should be done in common code.

Otherwise, could we instead set the name to MainFileName (as default) in initGOFFMCObjectFileInfo, and then override to SourceFileName here (if empty)?   Probably need to hold the Root/Ada names as members of TLOF then.


https://github.com/llvm/llvm-project/pull/133799


More information about the llvm-branch-commits mailing list