Kai Nacke 33872f1218
[GOFF] Add writing of section symbols (#133799)
Unlike other formats, the GOFF object file format uses a 2 dimensional structure
to define the location of data. For example, the equivalent of the ELF .text
section is made up of a Section Definition (SD) and a class (Element Definition;
ED). The name of the SD symbol depends on the application, while the class has
the predefined name C_CODE/C_CODE64 in AMODE31 and AMODE64 respectively.

Data can be placed into this structure in 2 ways. First, the data (in a text
record) can be associated with an ED symbol. To refer to data, a Label
Definition (LD) is used to give an offset into the data a name. When binding,
the whole data is pulled into the resulting executable, and the addresses
given by the LD symbols are resolved.

The alternative is to use a Part Definition (PR). In this case, the data (in
a text record) is associated with the part. When binding, only the data of
referenced PRs is pulled into the resulting binary.

Both approaches are used. SD, ED, and PR elements are modeled by nested
MCSectionGOFF instances, while LD elements are associated with MCSymbolGOFF
instances.

At the binary level, a record called "External Symbol Definition" (ESD) is used. The
ESD has a type (SD, ED, PR, LD), and depending on the type a different subset of
the fields is used.
2025-06-26 11:52:14 -04:00

36 lines
1.6 KiB
LLVM

; RUN: llc -mtriple s390x-ibm-zos < %s | FileCheck %s
; REQUIRES: systemz-registered-target
; CHECK: L#EPM_void_test_0: * @void_test
; CHECK: * XPLINK Routine Layout Entry
; CHECK: .long 12779717 * Eyecatcher 0x00C300C500C500
; CHECK: .short 197
; CHECK: .byte 0
; CHECK: .byte 241 * Mark Type C'1'
; CHECK: .long 8 * DSA Size 0x0
; CHECK: * Entry Flags
; CHECK: * Bit 1: 1 = Leaf function
; CHECK: * Bit 2: 0 = Does not use alloca
; CHECK: L#func_end0:
; CHECK: stdin#C CSECT
; CHECK: C_CODE64 CATTR
; CHECK: L#PPA1_void_test_0: * PPA1
; CHECK: .byte 2 * Version
; CHECK: .byte 206 * LE Signature X'CE'
; CHECK: .short 0 * Saved GPR Mask
; CHECK: .byte 128 * PPA1 Flags 1
; CHECK: * Bit 0: 1 = 64-bit DSA
; CHECK: .byte 128 * PPA1 Flags 2
; CHECK: * Bit 0: 1 = External procedure
; CHECK: * Bit 3: 0 = STACKPROTECT is not enabled
; CHECK: .byte 0 * PPA1 Flags 3
; CHECK: .byte 129 * PPA1 Flags 4
; CHECK: .short 0 * Length/4 of Parms
; CHECK: .long L#func_end0-L#EPM_void_test_0 * Length of Code
; CHECK: .long L#EPM_void_test_0-L#PPA1_void_test_0
; CHECK: * -- End function
define void @void_test() {
entry:
ret void
}