[lld] [llvm] [XCOFF] Display branch-absolute targets in hex. (PR #72532)

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 03:44:11 PST 2023


================
@@ -0,0 +1,37 @@
+# RUN: llvm-objdump -d %p/Inputs/abs32.o | \
----------------
chenzheng1030 wrote:

Is it necessary to generate an object that can pass `ld -r` for this patch? I assume we only need to correctly dump the assembly code?

Below yaml for XCOFF64 can get an object which can be disassembled by llvm-objdump.
```
--- !XCOFF
FileHeader:
  MagicNumber:     0x1F7
  NumberOfSections: 1
  CreationTime:    1701859282
  AuxiliaryHeaderSize: 0
  Flags:           0x0
Sections:
  - Name:            .text
    Address:         0x0
    Size:            0x18
    FileOffsetToData: 0x60
    FileOffsetToRelocations: 0x78
    FileOffsetToLineNumbers: 0x0
    NumberOfRelocations: 0x2
    NumberOfLineNumbers: 0x0
    Flags:           [ STYP_TEXT ]
    SectionData:     4800000341800003480012364BFFFFE24180234A4180FF02
    Relocations:
      - Address:         0x0
        Symbol:          0x1
        Info:            0x99
        Type:            0x18
      - Address:         0x6
        Symbol:          0x1
        Info:            0x8F
        Type:            0x18
Symbols:
  - Name:            .file
    Section:         N_DEBUG
    StorageClass:    C_FILE
    NumberOfAuxEntries: 0
  - Name:            .function
    Section:         N_UNDEF
    StorageClass:    C_EXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 0
  - Name:            ''
    Section:         .text
    StorageClass:    C_HIDEXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 1
  - Name:            .main
    Section:         .text
    StorageClass:    C_EXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 2
StringTable:
  Strings:
    - .file
    - .function
    - .text
    - .main
```

and below yaml is for XCOFF32:
```
--- !XCOFF
FileHeader:
  MagicNumber:     0x1DF
  NumberOfSections: 1
  CreationTime:    1701859282
  AuxiliaryHeaderSize: 0
  Flags:           0x0
Sections:
  - Name:            .text
    Address:         0x0
    Size:            0x18
    FileOffsetToData: 0x3C
    FileOffsetToRelocations: 0x54
    FileOffsetToLineNumbers: 0x0
    NumberOfRelocations: 0x2
    NumberOfLineNumbers: 0x0
    Flags:           [ STYP_TEXT ]
    SectionData:     4800000341800003480012364BFFFFE24180234A4180FF02
    Relocations:
      - Address:         0x0
        Symbol:          0x4
        Info:            0x99
        Type:            0x18
      - Address:         0x6
        Symbol:          0x4
        Info:            0x8F
        Type:            0x18
Symbols:
  - Name:            ''
    Section:         .text
    StorageClass:    C_HIDEXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 1
  - Name:            .main
    Section:         .text
    StorageClass:    C_EXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 2
  - Name:            .function
    Section:         N_UNDEF
    StorageClass:    C_EXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        StorageMappingClass:    XMC_PR
        SymbolAlignmentAndType: 0
```



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


More information about the llvm-commits mailing list