From: Klemens Nanni Subject: Re: binutils: enable ld.bfd ? To: Frederic Cambus Cc: ports Date: Sun, 30 Nov 2025 14:11:30 +0000 30.11.2025 16:30, Frederic Cambus пишет: > On Sat, Nov 29, 2025 at 08:17:19PM +0000, Klemens Nanni wrote: > >>> net/ipxe in openbsd-wip seems to require the GNU linker. >>> >>> 2.17 from base just segfaults (certainly too old) and ld.lld(1) complains >>> differently, depending on what/how I build stuff: >>> >>> - ld: error: section .text file range overlaps with .shstrtab >>> - ld: error: output file too large: 18446744073709485768 bytes >>> >>> When using gld built with the diff below, ipxe.efi links fine. >>> >>> >>> Is there a reason disable it? >> >> If yes, would a FLAVOR (that is not hooked up) and/or enabling it >> only for amd64 and arm64 (none other needed, atm) be acceptable? > > There was simply no use-case for it, because as far as I remember it is > not going to produce working OpenBSD executables. > > Adding a FLAVOR would probably be overkill, but as it will only be useful > to build net/ipxe on amd64 and arm64 I think it indeed makes sense to only > enable building ld on these architectures. Sure, that looks like this. Feedback? OK? Index: Makefile =================================================================== RCS file: /cvs/ports/devel/binutils/Makefile,v diff -u -p -r1.23 Makefile --- Makefile 29 Nov 2025 18:11:04 -0000 1.23 +++ Makefile 30 Nov 2025 14:04:55 -0000 @@ -3,7 +3,7 @@ COMMENT = GNU binary utilities # keep version synchronized with devel/gas V = 2.45.1 DISTNAME = binutils-${V} -REVISION = 0 +REVISION = 1 CATEGORIES = devel @@ -28,13 +28,21 @@ CONFIGURE_STYLE = gnu CONFIGURE_ARGS += --disable-gas \ --disable-gprof \ - --disable-ld \ --disable-libctf \ --disable-nls \ --disable-install-libbfd \ --program-prefix=g \ --without-msgpack \ --with-system-zlib + +LD_ARCHS = aarch64 \ + amd64 +SUBST_VARS = LD_ARCHS +.if ${LD_ARCHS:M${MACHINE_ARCH}} +PKG_ARGS = -Dld=1 +.else +CONFIGURE_ARGS += --disable-ld +.endif USE_GMAKE = Yes Index: patches/patch-ld_configure_tgt =================================================================== RCS file: patches/patch-ld_configure_tgt diff -N patches/patch-ld_configure_tgt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-ld_configure_tgt 30 Nov 2025 14:01:55 -0000 @@ -0,0 +1,15 @@ +recognise arm64 + +Index: ld/configure.tgt +--- ld/configure.tgt.orig ++++ ld/configure.tgt +@@ -98,6 +98,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd + aarch64-*-fuchsia*) targ_emul=aarch64elf + targ_extra_emuls="aarch64elfb armelf armelfb" + ;; ++aarch64-*-openbsd*) targ_emul=aarch64obsd ++ targ_extra_emuls="aarch64obsdb aarch64elf" ++ ;; + aarch64_be-*-linux-gnu_ilp32) + targ_emul=aarch64linux32b + targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi" Index: pkg/DESCR =================================================================== RCS file: /cvs/ports/devel/binutils/pkg/DESCR,v diff -u -p -r1.1.1.1 DESCR --- pkg/DESCR 7 Aug 2022 20:44:09 -0000 1.1.1.1 +++ pkg/DESCR 30 Nov 2025 14:04:29 -0000 @@ -4,6 +4,7 @@ This package contains the following GNU - ar - A utility for creating, modifying and extracting from archives. - c++filt - Filter to demangle encoded C++ symbols. - elfedit - Update ELF header and program property of ELF files. +- ld - Links files. (only on ${LD_ARCHS}) - nm - Lists symbols from object files. - objcopy - Copies and translates object files. - objdump - Displays information from object files. Index: pkg/PFRAG.ld =================================================================== RCS file: pkg/PFRAG.ld diff -N pkg/PFRAG.ld --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PFRAG.ld 30 Nov 2025 14:09:26 -0000 @@ -0,0 +1,7 @@ +@bin bin/gld +@bin bin/gld.bfd +lib/bfd-plugins/ +@so lib/bfd-plugins/libdep.so +@info info/ld.info +@info info/ldint.info +@man man/man1/gld.1 Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/devel/binutils/pkg/PLIST,v diff -u -p -r1.4 PLIST --- pkg/PLIST 24 Sep 2025 17:03:55 -0000 1.4 +++ pkg/PLIST 30 Nov 2025 14:09:28 -0000 @@ -28,3 +28,4 @@ @man man/man1/gstrip.1 @comment @man man/man1/gwindmc.1 @comment @man man/man1/gwindres.1 +%%ld%%