================
@@ -239,6 +298,63 @@ class GOFFWriter {
 GOFFWriter::GOFFWriter(raw_pwrite_stream &OS, MCAssembler &Asm)
     : OS(OS), Asm(Asm) {}
 
+void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) {
+  if (Section.isSD()) {
+    GOFFSymbol SD(Section.getName(), Section.getId(),
+                  Section.getSDAttributes());
+    writeSymbol(SD);
+  }
+
+  if (Section.isED()) {
+    GOFFSymbol ED(Section.getName(), Section.getId(),
+                  Section.getParent()->getId(), Section.getEDAttributes());
+    if (Section.requiresLength())
+      ED.SectionLength = Asm.getSectionAddressSize(Section);
+    writeSymbol(ED);
+  }
+
+  if (Section.isPR()) {
+    GOFFSymbol PR(Section.getName(), Section.getId(),
+                  Section.getParent()->getId(), Section.getPRAttributes());
+    PR.SectionLength = Asm.getSectionAddressSize(Section);
+    if (Section.requiresNonZeroLength()) {
----------------
redstar wrote:

For this specific case I do not know what happens under the hood.
For an externally callable function, a function descriptor is generated in the 
ADA by the _binder_. From the LLVM point of view, the ADA would still be empty. 
The simple example is:
```
void empty() {}
```
Here, the ADA is empty. Still, the binder generates the function descriptor. A 
caller of this function can use a function descriptor in its own compilation 
unit:
```
        DC      R(empty)
        DC      V(empty)
```
I would expect that I get a binder error on `R(empty)` if no associated data 
area was given for the code section. But I have not tried.

https://github.com/llvm/llvm-project/pull/133799
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to