From nobody Tue Oct 18 16:53:33 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MsKgm259Bz4gCPm for ; Tue, 18 Oct 2022 16:53:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MsKgm1LJDz3Zs6; Tue, 18 Oct 2022 16:53:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666112020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4frahW08Evz+y5k0ZuzYFR+AibHT5Ys8rRSYJgOdWjI=; b=wSW4p+Pdzv3/w10PcHnVBdq1eNB5U1DdcbR8wnG4QeBASUPQhPWaD6dNdIT9XpxHLWEn3Y 0hl5+yDUWc4PkBThOOwD15f1fJ8JpJ0t/DYR71QHDkPNW6Wir+zxcWMO7/hIi/vmlQktib C7hUnY9DVY2Kn/VQkZVqJMV6K4X08pIt+erZA1SzyR1/NoMutX5/jnCMmRp4bSftTcJ1lJ iw+ckvrGXfAo1l3bwy15qEN0seLYBgA21lCs9AxuZldFo5CuM9ToYAVKT7k6ddvEPbGrcT v4cLUJHN2ORfGCNaaVXHZmJ09FzitfWiQ8sf8/4ETU3iwQiBxVDh+iQQcs2KHQ== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4MsKgl6H9wz1ZRW; Tue, 18 Oct 2022 16:53:39 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 80BBF2EEB2; Tue, 18 Oct 2022 18:53:37 +0200 (CEST) From: Kristof Provost To: freebsd-arm , Brooks Davis Subject: Running armv7 on aarch64 Date: Tue, 18 Oct 2022 18:53:33 +0200 X-Mailer: MailMate (1.14r5918) Message-ID: List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_1613E232-936B-41AA-95D4-FA7ACBD60BA6_=" Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666112020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4frahW08Evz+y5k0ZuzYFR+AibHT5Ys8rRSYJgOdWjI=; b=TQIC4EX9l7/Z+BA/1BnuV+C0/1bEQwXdMNt2N0ybTPtPXXiAQ17StNCSBOISE/VOtU1VKT Hz03pSjZnKh0aV7sWV45snfSS3ix94wLu03KRWrqpIp5pcf0Fcy6pKu+SZVTUlhTfNVuvY xlXi6L+iTXk6CkQ3BZ+S+csu7eAD2OEfzKPaZZzFo+GnGG4xaaLuxXA3gWsZWqiFjdfXaW 81guo96ubgm8NqClfTYCatjy9tOyTHE7EVdBMqjXmn2h8t6gT1Ft6iblKyPRWzlKRpPIR5 rJrGeT1lhT9owS0V8+yIxI+X1gLv0RyTJFajbO3hvAwJbiyYZbVNicekXIG6/A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666112020; a=rsa-sha256; cv=none; b=CrZp7HRoawTUCqf5FLdD94HjjRMZk258xAAQp1BFNz9q+jJp51ZMdk239GHaJpf8ujAA4i +nbNM82mCZ7bf9enZqLrdI7OUiMekl2641pMx1jLZwSN+oSESaxrNOa4AyV+am49LgmHcA UsmorZbz0tZxWXczQnGUr+rYmEL8wMnNzoqJ+qpqJRLe3jl8VT2o5NhvEGW7Fs6doPVJzS HWVQaojzcrNW8+Q1IUI6rTtfs++/ny8Rq4NV1Vb9vfgFgnl0U7zOSQSSMLzGafDM3261wJ BP6H5X81BIMrdjkDOdNzArr9EQ/Wx0wU5Tu8VTStuq+UEMW600aJL9nyzoFKsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --=_MailMate_1613E232-936B-41AA-95D4-FA7ACBD60BA6_= Content-Type: text/plain; charset=UTF-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit Hi, I’ve recently discovered that I can no longer run an armv7 binary on my aarch64 FreeBSD machine. $ /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id ELF binary type "9" not known. /bin/sh: /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id: Exec format error $ file /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 14.0 (1400066), stripped $ readelf -e /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id File: /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id ELF Header: Magic: 7f 45 4c 46 01 01 01 09 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: FreeBSD ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x20ef0 Start of program headers: 52 (bytes into file) Start of section headers: 8912 (bytes into file) Flags: 0x5000400, Version5 EABI, VFP Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 11 Size of section headers: 40 (bytes) Number of section headers: 28 Section header string table index: 27 Elf file type is EXEC (Executable file) Entry point 0x20ef0 There are 11 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000034 0x00010034 0x00010034 0x00160 0x00160 R 0x4 INTERP 0x000194 0x00010194 0x00010194 0x00015 0x00015 R 0x1 [Requesting program interpreter: /libexec/ld-elf.so.1] LOAD 0x000000 0x00010000 0x00010000 0x00ccc 0x00ccc R 0x10000 LOAD 0x000ccc 0x00020ccc 0x00020ccc 0x01294 0x01294 R E 0x10000 LOAD 0x001f60 0x00031f60 0x00031f60 0x000c8 0x000c8 RW 0x10000 LOAD 0x002028 0x00042028 0x00042028 0x000a0 0x00138 RW 0x10000 DYNAMIC 0x001f68 0x00031f68 0x00031f68 0x000c0 0x000c0 RW 0x4 GNU_RELRO 0x001f60 0x00031f60 0x00031f60 0x000c8 0x000c8 R 0x1 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0 NOTE 0x0001ac 0x000101ac 0x000101ac 0x00064 0x00064 R 0x4 ARM_EXIDX 0x00090c 0x0001090c 0x0001090c 0x00068 0x00068 R 0x4 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.tag .dynsym .gnu.version .gnu.version_r .gnu.hash .hash .dynstr .rel.dyn .ARM.exidx .rel.plt .rodata .ARM.extab 03 .text .init .fini .plt 04 .jcr .init_array .dynamic 05 .data .got.plt .bss 06 .dynamic 07 .jcr .init_array .dynamic 08 09 .note.tag 10 .ARM.exidx There are 28 section headers, starting at offset 0x22d0: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .interp PROGBITS 00010194 000194 000015 00 A 0 0 1 [ 2] .note.tag NOTE 000101ac 0001ac 000064 00 A 0 0 4 [ 3] .dynsym DYNSYM 00010210 000210 0002c0 10 A 8 1 4 [ 4] .gnu.version SUNW_versym 000104d0 0004d0 000058 02 A 3 0 2 [ 5] .gnu.version_r SUNW_verneed 00010528 000528 000050 00 A 8 2 4 [ 6] .gnu.hash GNU_HASH 00010578 000578 000030 00 A 3 0 4 [ 7] .hash HASH 000105a8 0005a8 000168 04 A 3 0 4 [ 8] .dynstr STRTAB 00010710 000710 0001e3 00 A 0 0 1 [ 9] .rel.dyn REL 000108f4 0008f4 000018 08 AI 3 0 4 [10] .ARM.exidx ARM_EXIDX 0001090c 00090c 000068 00 A 14 0 4 [11] .rel.plt REL 00010974 000974 000120 08 AI 3 22 4 [12] .rodata PROGBITS 00010a94 000a94 00021f 01 AMS 0 0 1 [13] .ARM.extab PROGBITS 00010cb4 000cb4 000018 00 A 0 0 4 [14] .text PROGBITS 00020ccc 000ccc 000ff0 00 AX 0 0 4 [15] .init PROGBITS 00021cc0 001cc0 000014 00 AX 0 0 16 [16] .fini PROGBITS 00021ce0 001ce0 000014 00 AX 0 0 16 [17] .plt PROGBITS 00021d00 001d00 000260 00 AX 0 0 16 [18] .jcr PROGBITS 00031f60 001f60 000004 00 WA 0 0 4 [19] .init_array INIT_ARRAY 00031f64 001f64 000004 00 WA 0 0 4 [20] .dynamic DYNAMIC 00031f68 001f68 0000c0 08 WA 8 0 4 [21] .data PROGBITS 00042028 002028 000004 00 WA 0 0 4 [22] .got.plt PROGBITS 0004202c 00202c 00009c 00 WA 0 0 4 [23] .bss NOBITS 00042100 0020c8 000060 00 WA 0 0 64 [24] .comment PROGBITS 00000000 0020c8 0000b6 01 MS 0 0 1 [25] .ARM.attributes ARM_ATTRIBUTES 00000000 00217e 000049 00 0 0 1 [26] .gnu_debuglink PROGBITS 00000000 0021c7 000010 00 0 0 1 [27] .shstrtab STRTAB 00000000 0021d7 0000f7 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) It’s not quite clear to me how this is supposed to work (now). On amd64 there’s a separate /libexec/ld-elf32.so.1, which we don’t have on aarch64. Is it supposed to be built? It’s broken on ab9293239c7d and e03b7883e97c at the very least. — Kristof --=_MailMate_1613E232-936B-41AA-95D4-FA7ACBD60BA6_= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi,

I=E2=80=99ve recently discovered that I can no longer run= an armv7 binary on my aarch64 FreeBSD machine.

$ =
/usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id
ELF binary type "9" not known.
/bin/sh: /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin=
/id: Exec format error
$ file /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/i=
d
/usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id: ELF =
32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked=
, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 14.0 (1400=
066), stripped
$ readelf -e /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr=
/bin/id

File: /usr/local/poudriere/jails/pfSense_plus-devel-main_armv7/usr/bin/id=

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 09 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            FreeBSD
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x20ef0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          8912 (bytes into file)
  Flags:                             0x5000400, Version5 EABI, VFP
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         11
  Size of section headers:           40 (bytes)
  Number of section headers:         28
  Section header string table index: 27

Elf file type is EXEC (Executable file)
Entry point 0x20ef0
There are 11 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align=

  PHDR           0x000034 0x00010034 0x00010034 0x00160 0x00160 R   0x4
  INTERP         0x000194 0x00010194 0x00010194 0x00015 0x00015 R   0x1
      [Requesting program interpreter: /libexec/ld-elf.so.1]
  LOAD           0x000000 0x00010000 0x00010000 0x00ccc 0x00ccc R   0x100=
00
  LOAD           0x000ccc 0x00020ccc 0x00020ccc 0x01294 0x01294 R E 0x100=
00
  LOAD           0x001f60 0x00031f60 0x00031f60 0x000c8 0x000c8 RW  0x100=
00
  LOAD           0x002028 0x00042028 0x00042028 0x000a0 0x00138 RW  0x100=
00
  DYNAMIC        0x001f68 0x00031f68 0x00031f68 0x000c0 0x000c0 RW  0x4
  GNU_RELRO      0x001f60 0x00031f60 0x00031f60 0x000c8 0x000c8 R   0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0
  NOTE           0x0001ac 0x000101ac 0x000101ac 0x00064 0x00064 R   0x4
  ARM_EXIDX      0x00090c 0x0001090c 0x0001090c 0x00068 0x00068 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.tag .dynsym .gnu.version .gnu.version_r .gnu.hash=
 .hash .dynstr .rel.dyn .ARM.exidx .rel.plt .rodata .ARM.extab
   03     .text .init .fini .plt
   04     .jcr .init_array .dynamic
   05     .data .got.plt .bss
   06     .dynamic
   07     .jcr .init_array .dynamic
   08
   09     .note.tag
   10     .ARM.exidx
There are 28 section headers, starting at offset 0x22d0:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk=
 Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0=
   0  0
  [ 1] .interp           PROGBITS        00010194 000194 000015 00   A  0=
   0  1
  [ 2] .note.tag         NOTE            000101ac 0001ac 000064 00   A  0=
   0  4
  [ 3] .dynsym           DYNSYM          00010210 000210 0002c0 10   A  8=
   1  4
  [ 4] .gnu.version      SUNW_versym     000104d0 0004d0 000058 02   A  3=
   0  2
  [ 5] .gnu.version_r    SUNW_verneed    00010528 000528 000050 00   A  8=
   2  4
  [ 6] .gnu.hash         GNU_HASH        00010578 000578 000030 00   A  3=
   0  4
  [ 7] .hash             HASH            000105a8 0005a8 000168 04   A  3=
   0  4
  [ 8] .dynstr           STRTAB          00010710 000710 0001e3 00   A  0=
   0  1
  [ 9] .rel.dyn          REL             000108f4 0008f4 000018 08  AI  3=
   0  4
  [10] .ARM.exidx        ARM_EXIDX       0001090c 00090c 000068 00   A 14=
   0  4
  [11] .rel.plt          REL             00010974 000974 000120 08  AI  3=
  22  4
  [12] .rodata           PROGBITS        00010a94 000a94 00021f 01 AMS  0=
   0  1
  [13] .ARM.extab        PROGBITS        00010cb4 000cb4 000018 00   A  0=
   0  4
  [14] .text             PROGBITS        00020ccc 000ccc 000ff0 00  AX  0=
   0  4
  [15] .init             PROGBITS        00021cc0 001cc0 000014 00  AX  0=
   0 16
  [16] .fini             PROGBITS        00021ce0 001ce0 000014 00  AX  0=
   0 16
  [17] .plt              PROGBITS        00021d00 001d00 000260 00  AX  0=
   0 16
  [18] .jcr              PROGBITS        00031f60 001f60 000004 00  WA  0=
   0  4
  [19] .init_array       INIT_ARRAY      00031f64 001f64 000004 00  WA  0=
   0  4
  [20] .dynamic          DYNAMIC         00031f68 001f68 0000c0 08  WA  8=
   0  4
  [21] .data             PROGBITS        00042028 002028 000004 00  WA  0=
   0  4
  [22] .got.plt          PROGBITS        0004202c 00202c 00009c 00  WA  0=
   0  4
  [23] .bss              NOBITS          00042100 0020c8 000060 00  WA  0=
   0 64
  [24] .comment          PROGBITS        00000000 0020c8 0000b6 01  MS  0=
   0  1
  [25] .ARM.attributes   ARM_ATTRIBUTES  00000000 00217e 000049 00      0=
   0  1
  [26] .gnu_debuglink    PROGBITS        00000000 0021c7 000010 00      0=
   0  1
  [27] .shstrtab         STRTAB          00000000 0021d7 0000f7 00      0=
   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific=
)

It=E2=80=99s not quite clear to me how this is supposed t= o work (now). On amd64 there=E2=80=99s a separate /libexec/ld-elf32.so.1,= which we don=E2=80=99t have on aarch64. Is it supposed to be built?

It=E2=80=99s broken on ab9293239c7d and e03b7883e97c at t= he very least.

=E2=80=94
Kristof

--=_MailMate_1613E232-936B-41AA-95D4-FA7ACBD60BA6_=--