[llvm-branch-commits] [llvm] [GOFF] Add writing of section symbols (PR #133799)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 9 17:22:52 PDT 2025
================
@@ -2759,6 +2762,29 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForLSDA(
//===----------------------------------------------------------------------===//
TargetLoweringObjectFileGOFF::TargetLoweringObjectFileGOFF() = default;
+void TargetLoweringObjectFileGOFF::getModuleMetadata(Module &M) {
+ // Construct the default names for the root SD and the ADA PR symbol.
+ StringRef FileName = sys::path::stem(M.getSourceFileName());
+ if (FileName.size() > 1 && FileName.starts_with('<') &&
+ FileName.ends_with('>'))
+ FileName = FileName.substr(1, FileName.size() - 2);
+ DefaultRootSDName = Twine(FileName).concat("#C").str();
----------------
AidoP wrote:
The default root section should be a private section, a section with a name of 1 space. The source file name affecting ABI is quite surprising and could easily lead to linker errors, especially when taking just the stem. For example, `clang src/a.c src/impl/a.c` would have issues.
Additionally I'm not sure if the file name can be relied on at all here. Is it guaranteed to be provided by a compiler frontend? Does it make sense for the file name to be interpreted as UTF-8 then converted to IBM-1047? It also needs to be normalised to deal with characters that are invalid for symbol names.
https://github.com/llvm/llvm-project/pull/133799
More information about the llvm-branch-commits
mailing list