Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 881131

Summary: sys-boot/refind-0.13.3.1 - clang-15: error: unknown argument: -fno-tree-loop-distribute-patterns
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Viorel Munteanu <ceamac>
Status: RESOLVED WONTFIX    
Severity: normal CC: proxy-maint, sputnick, sveyret
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/32710
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: emerge-info.txt
emerge-history.txt
environment
etc.clang.tar.bz2
etc.portage.tar.bz2
sys-boot:refind-0.13.3.1:20221112-130908.log
temp.tar.bz2
Patch to work around unnecessary optimisation and non-standard c.

Description Toralf Förster gentoo-dev 2022-11-12 18:08:21 UTC
make[2]: Entering directory '/var/tmp/portage/sys-boot/refind-0.13.3.1/work/refind-0.13.3.1/filesystems'
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
clang -Os -fno-strict-aliasing -fno-tree-loop-distribute-patterns -fno-stack-protector -fshort-wchar -Wall -fno-PIE -DEFIX64 -DEFI_FUNCTION_WRAPPER -m64 -mno-red-zone  -fpic -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol -I../include -I../refind -I../libeg -I../mok -DFSTYPE=ext2 -I.  "-DEFIAPI=__attribute__((ms_abi))"  \
      -D__MAKEWITH_GNUEFI -c fsw_ext2.c -o fsw_ext2.o
clang-15: error: unknown argument: '-fno-tree-loop-distribute-patterns'
clang-15: error: unknown argument: '-fno-tree-loop-distribute-patterns'
clang-15: error: unknown argument: '-fno-tree-loop-distribute-patterns'

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_hardened-j4-20221111-181859

  -------------------------------------------------------------------

GNUMAKEFLAGS="$GNUMAKEFLAGS --jobserver-style=pipe"
GNUMAKEFLAGS="$GNUMAKEFLAGS --shuffle"
CC=clang
CXX=clang++
gcc-config -l:
 [1] x86_64-pc-linux-gnu-12 *
clang/llvm (if any):
clang version 15.0.4
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin
Configuration file: /etc/clang/clang.cfg
/usr/lib/llvm/15
15.0.4
Python 3.10.8
Available Ruby profiles:
  (none found)
Available Rust versions:
  [1]   rust-bin-1.65.0 *
The following VMs are available for generation-2:
*)	Eclipse Temurin JDK 17.0.5_p8 [openjdk-bin-17]
2)	Eclipse Temurin JDK 8.352_p08 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8 
  [2]   openjdk-bin-17  system-vm

The Glorious Glasgow Haskell Compilation System, version 9.0.2
php cli (if any):

  HEAD of ::gentoo
commit ddcce5583933141d900dffa1fc81f375b1ab1cd5
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Sat Nov 12 12:16:53 2022 +0000

    2022-11-12 12:16:52 UTC

emerge -qpvO sys-boot/refind
[ebuild  N    ] sys-boot/refind-0.13.3.1  USE="ext2 ext4 iso9660 -btrfs (-custom-cflags) -doc -hfs -ntfs -reiserfs"
Comment 1 Toralf Förster gentoo-dev 2022-11-12 18:08:23 UTC
Created attachment 832049 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-11-12 18:08:24 UTC
Created attachment 832051 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2022-11-12 18:08:26 UTC
Created attachment 832053 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2022-11-12 18:08:27 UTC
Created attachment 832055 [details]
etc.clang.tar.bz2
Comment 5 Toralf Förster gentoo-dev 2022-11-12 18:08:28 UTC
Created attachment 832057 [details]
etc.portage.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2022-11-12 18:08:29 UTC
Created attachment 832059 [details]
sys-boot:refind-0.13.3.1:20221112-130908.log
Comment 7 Toralf Förster gentoo-dev 2022-11-12 18:08:30 UTC
Created attachment 832061 [details]
temp.tar.bz2
Comment 8 Guillaume de Volpiano 2023-06-27 17:32:39 UTC
Sadly,I'm afraid that this bug isn't going to be fixable without involvement from upstream. It is possible to work around this issue and another where the code is "sloppy" by clang standards (see patch), but there is a larger issue where objcopy accepts custom bfdnames in --target, where llvm-objcopy only accepts supported formats, and refind uses a custom format.
Comment 9 Guillaume de Volpiano 2023-06-27 17:33:50 UTC
Created attachment 864730 [details, diff]
Patch to work around unnecessary optimisation and non-standard c.

This is not a complete fix
Comment 10 Larry the Git Cow gentoo-dev 2023-09-14 04:43:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=797977a54c63876d010635d5d8431798396e9b15

commit 797977a54c63876d010635d5d8431798396e9b15
Author:     Viorel Munteanu <ceamac@gentoo.org>
AuthorDate: 2023-09-10 12:29:17 +0000
Commit:     Viorel Munteanu <ceamac@gentoo.org>
CommitDate: 2023-09-14 04:39:01 +0000

    sys-boot/refind: fix compilation with clang
    
    Compiling with clang works.
    Linking with lld produces broken executables (including the drivers).
    llvm-objcopy does not support the output format needed by refind.
    
    Try to force ld.bfd and binutils objcopy.  Fail otherwise.
    
    Bug: https://bugs.gentoo.org/732256
    Bug: https://bugs.gentoo.org/832018
    Bug: https://bugs.gentoo.org/881131
    Closes: https://github.com/gentoo/gentoo/pull/32710
    Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>

 sys-boot/refind/files/refind-0.14.0.2-clang.patch |  62 +++++++++
 sys-boot/refind/refind-0.14.0.2-r1.ebuild         | 160 ++++++++++++++++++++++
 2 files changed, 222 insertions(+)