FS#75731 - gnu-efi [gcc] - lto prevents refind linking

Attached to Project: Arch Linux
Opened by Gene (GeneC) - Monday, 29 August 2022, 16:03 GMT
Last edited by Toolybird (Toolybird) - Wednesday, 03 May 2023, 20:56 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To David Runge (dvzrv)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
After the addition of the 2 lto flags in gnu-efi package, refind no longer builds against it.

Tooling is gcc not clang.

The issue is described in more detail in refind upstream report :

https://sourceforge.net/p/refind/discussion/general/thread/ba04d306d3/

Perhaps there is a better way, but what I found did fix the problem, was to rebuild gnu-efi with CFLAGS="-O2".

There may be a way to build refind against the current gnu-efi with "-flto -ffat-lto-objects" but I was unable to find it.

This may or may not have anything to do with some of the gnu-efi source, notably crt0-efi-x86_64.S, being assembly code not C - but that's just a very wild guess.


This task depends upon

Closed by  Toolybird (Toolybird)
Wednesday, 03 May 2023, 20:56 GMT
Reason for closing:  Fixed
Additional comments about closing:  gnu-efi 3.0.17-2
Comment by David Runge (dvzrv) - Tuesday, 02 May 2023, 20:47 GMT
@GeneC thanks for the ticket. Can you please check whether 3.0.17 in testing has the same issue for you?
Comment by Gene (GeneC) - Tuesday, 02 May 2023, 21:13 GMT
Nope - and gcc 13 is lovely and verbose ... I'll only quote a few of the errors.

rebuilding gnu-efi as I said above with CFLAGS='-O2'
fixes the problem:

First few lines of errors:
/usr/bin/ld: /usr/lib/libefi.a(data.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(data.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(dpath.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(dpath.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(entry.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(entry.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(error.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(error.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(guid.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(guid.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(hand.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(hand.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(init.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(init.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(misc.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(misc.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(print.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(print.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(str.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(str.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(rtdata.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/libefi.a(rtdata.o): plugin needed to handle lto object
/usr/bin/ld: /usr/lib/crt0-efi-x86_64.o: in function `_start':
/build/gnu-efi/src/gnu-efi-3.0.17//gnuefi/crt0-efi-x86_64.S:59: undefined reference to `_entry'

Comment by Gene (GeneC) - Tuesday, 02 May 2023, 21:17 GMT
This was against refind git HEAD (0.14.0.10)
Comment by Gene (GeneC) - Tuesday, 02 May 2023, 21:24 GMT
Sorry by 'nope' I mean nope it the same problem - not working for me anyway
Maybe you have better solution.
Comment by David Runge (dvzrv) - Wednesday, 03 May 2023, 07:19 GMT
Can you check if 3.0.17-2 in [testing] works for you?
Comment by Gene (GeneC) - Wednesday, 03 May 2023, 10:28 GMT
Yes it's all fine now - thanks David

Loading...