[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 18:15:57 PST 2024


nathanchance wrote:

I have noticed one other issue when testing with `CONFIG_DEBUG_INFO_BTF` that appears with both Clang and GCC:

```
ld.lld: error: .btf.vmlinux.bin.o: unknown file type
```

which is generated using `s390x-linux-gnu-objcopy`:

```
s390x-linux-gnu-objcopy --only-section=.BTF --set-section-flags .BTF=alloc,readonly --strip-all .tmp_vmlinux.btf .btf.vmlinux.bin.o
```

`file` seems to recognize this file the same when using Clang and GCC:

```
/tmp/clang-.btf.vmlinux.bin.o: ELF 64-bit MSB IBM S/390, version 1 (SYSV)
/tmp/gcc-.btf.vmlinux.bin.o:   ELF 64-bit MSB IBM S/390, version 1 (SYSV)
```

`readelf` says:

```
$ s390x-linux-gnu-readelf -a /tmp/gcc-.btf.vmlinux.bin.o
ELF Header:
  Magic:   7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              <unknown>: 103
  Machine:                           IBM S/390
  Version:                           0x1
  Entry point address:               0x100000
  Start of program headers:          64 (bytes into file)
  Start of section headers:          4693320 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         3
  Size of section headers:           64 (bytes)
  Number of section headers:         3
  Section header string table index: 2

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .BTF              PROGBITS         00000000011dd4ac  000000e8
       0000000000479c4a  0000000000000000   A       0     0     1
  [ 2] .shstrtab         STRTAB           0000000000000000  00479d32
       0000000000000010  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x00000000000000e8 0x0000000000100000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  R E    0x8
  LOAD           0x00000000000000e8 0x00000000012aa000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    0x8
  NOTE           0x0000000000000000 0x00000000011dd458 0x00000000011dd458
                 0x0000000000000000 0x0000000000000000         0x8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     
   02     

There is no dynamic section in this file.

There are no relocations in this file.

The decoding of unwind sections for machine type IBM S/390 is not currently supported.

No version information found in this file.
```

This does not show up with `ld.bfd`, is there some other bug here?

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


More information about the llvm-commits mailing list