Bug 263244 - archivers/7-zip: fix build on armv7
Summary: archivers/7-zip: fix build on armv7
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Max Brazhnikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-12 16:33 UTC by Robert Clausecker
Modified: 2022-04-22 15:29 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (makc)
fuz: merge-quarterly?


Attachments
archivers/7-zip: fix build on armv7 (7.85 KB, patch)
2022-04-12 16:33 UTC, Robert Clausecker
fuz: maintainer-approval? (makc)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Clausecker freebsd_committer freebsd_triage 2022-04-12 16:33:39 UTC
Created attachment 233171 [details]
archivers/7-zip: fix build on armv7

The port current does not build on armv7.  To fix this problem...

 - extend HWCAP detection patch to use correct auxvals on armv6/armv7
 - disable optimised AES, CRC, SHA-1, and SHA-256 kernels on armv6/armv7
   as they don't build with base clang

An unfortunate side effect is that now the armv7 binary does not make use of any of the available instruction set extensions, even though it is capable of detecting their availability.  Unfortunately clang support for NEON intrinsics is very spotty on 32 bit ARM.  If desired, USE_GCC=yes and removing the patches that disable the optimised AES, CRC, SHA-1, and SHA-256 implementations might be a good way to obtain a binary with these in.

Tested with Poudriere on armv7 arm64 FreeBSD 13.
Please MFH if possible.
Comment 1 Max Brazhnikov freebsd_committer freebsd_triage 2022-04-13 07:58:04 UTC
(In reply to Robert Clausecker from comment #0)
> If desired, USE_GCC=yes and removing the patches that disable the optimised AES, CRC, SHA-1, and SHA-256 implementations might be a good way to obtain a binary with these in.

I'm fine with any solution. What's your preference?
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2022-04-13 12:36:22 UTC
(In reply to Max Brazhnikov from comment #1)

I'm open to anything.  You are the maintainer, you need to make the decisions.

Building with GCC would produce a better binary for armv6/armv7, but I think most armv6/armv7 systems FreeBSd supports do not have the required instruction set extensions anyway (though I would have to check).  On the other hand, using clang removes a heavy dependency which makes things easier for source builders.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-04-18 11:43:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=96151ece4c41ec9a060a5347704f1a51323dd57f

commit 96151ece4c41ec9a060a5347704f1a51323dd57f
Author:     Max Brazhnikov <makc@FreeBSD.org>
AuthorDate: 2022-04-18 11:40:48 +0000
Commit:     Max Brazhnikov <makc@FreeBSD.org>
CommitDate: 2022-04-18 11:40:48 +0000

    archivers/7-zip: fix build on armv6/armv7

    - Extend HWCAP detection patch to use correct auxvals on armv6/armv7.
    - Disable optimised AES, CRC, SHA-1, and SHA-256 kernels on armv6/armv7
      as they don't build with base clang.

    PR:             263244
    Submitted by:   Robert Clausecker

 archivers/7-zip/Makefile                        |  5 ++++
 archivers/7-zip/files/patch-C_7zCrc.c (new)     | 11 +++++++
 archivers/7-zip/files/patch-C_Aes.c (new)       | 11 +++++++
 archivers/7-zip/files/patch-C_AesOpt.c (new)    | 38 +++++++++++++++++++++++++
 archivers/7-zip/files/patch-C_CpuArch.c         | 26 +++++++++++------
 archivers/7-zip/files/patch-C_Sha1Opt.c (new)   | 11 +++++++
 archivers/7-zip/files/patch-C_Sha256Opt.c (new) | 11 +++++++
 7 files changed, 104 insertions(+), 9 deletions(-)
Comment 4 Max Brazhnikov freebsd_committer freebsd_triage 2022-04-18 11:44:21 UTC
Committed, thanks!
Comment 5 Robert Clausecker freebsd_committer freebsd_triage 2022-04-18 11:56:28 UTC
(In reply to Max Brazhnikov from comment #4)

Please don't forget to MFH the patch.
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-04-22 15:29:54 UTC
A commit in branch 2022Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=93a0e053b7f8dd451ae4b4ac377f20a45e8df188

commit 93a0e053b7f8dd451ae4b4ac377f20a45e8df188
Author:     Max Brazhnikov <makc@FreeBSD.org>
AuthorDate: 2022-04-18 11:40:48 +0000
Commit:     Max Brazhnikov <makc@FreeBSD.org>
CommitDate: 2022-04-22 15:27:46 +0000

    archivers/7-zip: fix build on armv6/armv7

    - Extend HWCAP detection patch to use correct auxvals on armv6/armv7.
    - Disable optimised AES, CRC, SHA-1, and SHA-256 kernels on armv6/armv7
      as they don't build with base clang.

    PR:             263244
    Submitted by:   Robert Clausecker

    (cherry picked from commit 96151ece4c41ec9a060a5347704f1a51323dd57f)

 archivers/7-zip/Makefile                        |  5 ++++
 archivers/7-zip/files/patch-C_7zCrc.c (new)     | 11 +++++++
 archivers/7-zip/files/patch-C_Aes.c (new)       | 11 +++++++
 archivers/7-zip/files/patch-C_AesOpt.c (new)    | 38 +++++++++++++++++++++++++
 archivers/7-zip/files/patch-C_CpuArch.c         | 26 +++++++++++------
 archivers/7-zip/files/patch-C_Sha1Opt.c (new)   | 11 +++++++
 archivers/7-zip/files/patch-C_Sha256Opt.c (new) | 11 +++++++
 7 files changed, 104 insertions(+), 9 deletions(-)