Page MenuHomeFreeBSD

stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
ClosedPublic

Authored by jhb on Feb 1 2022, 1:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 7:44 PM
Unknown Object (File)
Jan 18 2024, 6:32 PM
Unknown Object (File)
Jan 15 2024, 1:51 AM
Unknown Object (File)
Dec 23 2023, 2:00 AM
Unknown Object (File)
Nov 19 2023, 4:36 PM
Unknown Object (File)
Nov 13 2023, 2:22 PM
Unknown Object (File)
Nov 11 2023, 2:17 PM
Unknown Object (File)
Nov 9 2023, 2:47 AM
Subscribers

Details

Summary

ld.bfd in binutils 2.34+ now reports an error in more cases for custom
ldscripts that do not place PHDRs in a LOAD segment. However, EFI
binaries are not dynamic binaries which need PHDRs, so pass
--no-dynamic-linker to disable this check.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Feb 1 2022, 1:33 AM

Where does bsd.linker.mk get included from?

we're starting to accumulate a rather long laundry list of things here... Its OK, ish, but it seems like it might be better in something like stand/efi/Makefile.inc...

In D34124#771692, @imp wrote:

we're starting to accumulate a rather long laundry list of things here... Its OK, ish, but it seems like it might be better in something like stand/efi/Makefile.inc...

If you view boot1 as something that will eventually get removed then you are down to only one place that this will live in the future. I think part of the problem is that you don't want this in LDFLAGS for all subdirs of stand/efi, so you'd have to have some helper var to request stand/efi/Makefile.inc to append these settings to LDFLAGS and that starts getting a bit cumbersome and obtuse.

stand/efi/boot1/Makefile
3

This includes stand/efi/Makefile.inc which includes stand/Makefile.inc which includes "defs.mk" which includes <bsd.linker.mk>.

stand/efi/loader/Makefile
100

This should maybe use EFISRC like boot1/Makefile does. And actually, it's kind of odd as "../loader/" is a no-op.

This revision is now accepted and ready to land.Feb 1 2022, 5:45 PM
In D34124#771889, @jhb wrote:
In D34124#771692, @imp wrote:

we're starting to accumulate a rather long laundry list of things here... Its OK, ish, but it seems like it might be better in something like stand/efi/Makefile.inc...

If you view boot1 as something that will eventually get removed then you are down to only one place that this will live in the future. I think part of the problem is that you don't want this in LDFLAGS for all subdirs of stand/efi, so you'd have to have some helper var to request stand/efi/Makefile.inc to append these settings to LDFLAGS and that starts getting a bit cumbersome and obtuse.

boot1 likely won't go away given the need for gptboot for some environments...
I was thinking of defining some additional LD flags that both boot1 and loader's makefiles could add to their LDFLAGS, but I think that's beyond the scope of this patch and is something I can look at afterwards.

stand/efi/loader/Makefile
100

we include this makefile for each of the 3 different interpreters we build for, so in those includes, ../loader is not a nop.

boot1 likely won't go away

The EFI version

stand/efi/loader/Makefile
100

Fair enough, using EFISRC like boot1/Makefile is probably cleaner though overall.