[llvm] [z/OS][GOFF] Implement support for writing ESD + TXT records by the GOFFObjectWriter (PR #85851)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 01:30:56 PDT 2024


================
@@ -18,10 +18,63 @@
 namespace llvm {
 
 class MCSymbolGOFF : public MCSymbol {
+  Align Alignment;
----------------
uweigand wrote:

A "common" symbol is an uninitialized global variable, typically placed in .bss or the equivalent.  They're different from other symbols in that the .bss is not laid out by the assembler/compiler (it's all uninitialized, so there would be no point).  Instead, only the *linker* actually assigns offsets to symbols in .bss - that's why the linker needs to know alignment requirements for those.

For other symbols, they're assigned fixed offsets into their section already by the assembler/compiler, which is the point where any alignment requirements are fulfilled.  From there on, only the section itself carries any further alignment information that needs to be respected by the linker.

I think it should be straightforward to follow the same approach in GOFF:  for ED symbols generated from text sections, use the section alignment; similarly for PR symbols generated from (initialized) data sections.  If there are common symbols in .bss, you can generate a PR symbol for those using the common symbol alignment  - however, if you already forced all of these into sections of their own, you can instead just use the section alignment as well.

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


More information about the llvm-commits mailing list