Loading pkgs/build-support/bintools-wrapper/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,7 @@ let else if targetPlatform.isLoongArch64 then "${sharedLibraryLoader}/lib/ld-linux-loongarch*.so.1" else if targetPlatform.isDarwin then "/usr/lib/dyld" else if targetPlatform.isFreeBSD then "${sharedLibraryLoader}/libexec/ld-elf.so.1" else if targetPlatform.isOpenBSD then "${sharedLibraryLoader}/libexec/ld.so" else if hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else ""; Loading pkgs/os-specific/bsd/openbsd/pkgs/libc.nix +12 −7 Original line number Diff line number Diff line { lib, stdenvNoLibc, symlinkJoin, libcMinimal, librthread, libm, librpcsvc, libutil, rtld, version, }: Loading @@ -27,13 +29,16 @@ symlinkJoin rec { (lib.getLib p) (lib.getMan p) ]) ( [ libcMinimal libm librthread librpcsvc libutil ]; ] ++ (lib.optional (!stdenvNoLibc.hostPlatform.isStatic) rtld) ); postBuild = '' rm -r "$out/nix-support" Loading pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh +5 −0 Original line number Diff line number Diff line addOpenBSDMakeFlags() { prependToVar makeFlags "INCSDIR=${!outputDev}/include" prependToVar makeFlags "MANDIR=${!outputMan}/share/man" # Variables are used to declare dependencies, but we handle them with cc-wrapper prependToVar makeFlags "CRTBEGIN=" prependToVar makeFlags "CRTEND=" prependToVar makeFlags "LIBCRT0=" prependToVar makeFlags "LIBC=" } fixOpenBSDInstallDirs() { Loading pkgs/os-specific/bsd/openbsd/pkgs/rtld/ldso-fix-makefile.patch 0 → 100644 +57 −0 Original line number Diff line number Diff line diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile index 7f8f6ef2961..469c34bb6de 100644 --- a/libexec/ld.so/Makefile +++ b/libexec/ld.so/Makefile @@ -1,6 +1,5 @@ # $OpenBSD: Makefile,v 1.88 2024/04/05 13:51:47 deraadt Exp $ -SUBDIR=ldconfig ldd MAN= ld.so.1 .include <bsd.own.mk> @@ -70,21 +69,15 @@ ELF_LDFLAGS+=--shared -Bsymbolic --no-undefined .ifdef RELATIVE_RELOC CHECK_LDSO=c() { \ - ! readelf -Wr $$1 | \ + ! $(READELF) -Wr $$1 | \ egrep -qv '^($$|[ R])| (${RELATIVE_RELOC}) '; \ }; c .endif -test_prog= test-$(PROG) -CLEANFILES+= test-$(PROG) candidate= $(PROG).test CLEANFILES+= ${candidate} -$(test_prog): - printf '#include <stdio.h>\n#include <pthread.h>\nint main(int argc, char **argv){ pthread_attr_t attr; printf("%%s: ", argv[0]); pthread_attr_init(&attr); printf("%%s!\\n", argv[1] ? argv[1] : "foo"); }\n' | \ - $(CC) -P -x c - -Wl,-dynamic-linker,./$(candidate) -o $@ -lpthread - -$(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} +$(PROG): ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} .if defined(SYSPATCH_PATH) $(LD) -e _dl_start $(ELF_LDFLAGS) -o $(candidate) \ `readelf -Ws ${SYSPATCH_PATH}/usr/libexec/${.TARGET} | \ @@ -96,9 +89,6 @@ $(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} .endif .ifdef CHECK_LDSO ${CHECK_LDSO} $(candidate) -.endif -.ifndef CROSSDIR - ulimit -c 0; [ "`${.OBJDIR}/$(test_prog) ok`" = "${.OBJDIR}/$(test_prog): ok!" ] .endif cp $(candidate) $@ .endif @@ -113,10 +103,4 @@ CLEANFILES+= ld.so.a all: ld.so.a ld.so.a: ${OBJS} ${.CURDIR}/Symbols.map ${test_prog} ${LD_SCRIPT} - ar cqD $@ $? - -afterinstall: ld.so.a - install -d -o root -g wheel -m 755 \ - ${DESTDIR}/usr/share/relink/usr/libexec - install -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \ - ld.so.a ${DESTDIR}/usr/share/relink/usr/libexec/ld.so.a + $(AR) cqD $@ $? pkgs/os-specific/bsd/openbsd/pkgs/rtld/package.nix 0 → 100644 +31 −0 Original line number Diff line number Diff line { lib, mkDerivation, }: mkDerivation { path = "libexec/ld.so"; extraPaths = [ "lib/libc/string" "lib/csu/os-note-elf.h" ]; patches = [ ./ldso-fix-makefile.patch ]; libcMinimal = true; NIX_CFLAGS_COMPILE = "-Wno-error"; # DESTDIR is overridden in bsdSetupHook, just fixup afterwards postInstall = '' mv $out/bin $out/libexec ''; outputs = [ "out" "man" ]; meta.platforms = lib.platforms.openbsd; } Loading
pkgs/build-support/bintools-wrapper/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,7 @@ let else if targetPlatform.isLoongArch64 then "${sharedLibraryLoader}/lib/ld-linux-loongarch*.so.1" else if targetPlatform.isDarwin then "/usr/lib/dyld" else if targetPlatform.isFreeBSD then "${sharedLibraryLoader}/libexec/ld-elf.so.1" else if targetPlatform.isOpenBSD then "${sharedLibraryLoader}/libexec/ld.so" else if hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else ""; Loading
pkgs/os-specific/bsd/openbsd/pkgs/libc.nix +12 −7 Original line number Diff line number Diff line { lib, stdenvNoLibc, symlinkJoin, libcMinimal, librthread, libm, librpcsvc, libutil, rtld, version, }: Loading @@ -27,13 +29,16 @@ symlinkJoin rec { (lib.getLib p) (lib.getMan p) ]) ( [ libcMinimal libm librthread librpcsvc libutil ]; ] ++ (lib.optional (!stdenvNoLibc.hostPlatform.isStatic) rtld) ); postBuild = '' rm -r "$out/nix-support" Loading
pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh +5 −0 Original line number Diff line number Diff line addOpenBSDMakeFlags() { prependToVar makeFlags "INCSDIR=${!outputDev}/include" prependToVar makeFlags "MANDIR=${!outputMan}/share/man" # Variables are used to declare dependencies, but we handle them with cc-wrapper prependToVar makeFlags "CRTBEGIN=" prependToVar makeFlags "CRTEND=" prependToVar makeFlags "LIBCRT0=" prependToVar makeFlags "LIBC=" } fixOpenBSDInstallDirs() { Loading
pkgs/os-specific/bsd/openbsd/pkgs/rtld/ldso-fix-makefile.patch 0 → 100644 +57 −0 Original line number Diff line number Diff line diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile index 7f8f6ef2961..469c34bb6de 100644 --- a/libexec/ld.so/Makefile +++ b/libexec/ld.so/Makefile @@ -1,6 +1,5 @@ # $OpenBSD: Makefile,v 1.88 2024/04/05 13:51:47 deraadt Exp $ -SUBDIR=ldconfig ldd MAN= ld.so.1 .include <bsd.own.mk> @@ -70,21 +69,15 @@ ELF_LDFLAGS+=--shared -Bsymbolic --no-undefined .ifdef RELATIVE_RELOC CHECK_LDSO=c() { \ - ! readelf -Wr $$1 | \ + ! $(READELF) -Wr $$1 | \ egrep -qv '^($$|[ R])| (${RELATIVE_RELOC}) '; \ }; c .endif -test_prog= test-$(PROG) -CLEANFILES+= test-$(PROG) candidate= $(PROG).test CLEANFILES+= ${candidate} -$(test_prog): - printf '#include <stdio.h>\n#include <pthread.h>\nint main(int argc, char **argv){ pthread_attr_t attr; printf("%%s: ", argv[0]); pthread_attr_init(&attr); printf("%%s!\\n", argv[1] ? argv[1] : "foo"); }\n' | \ - $(CC) -P -x c - -Wl,-dynamic-linker,./$(candidate) -o $@ -lpthread - -$(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} +$(PROG): ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} .if defined(SYSPATCH_PATH) $(LD) -e _dl_start $(ELF_LDFLAGS) -o $(candidate) \ `readelf -Ws ${SYSPATCH_PATH}/usr/libexec/${.TARGET} | \ @@ -96,9 +89,6 @@ $(PROG): $(test_prog) ${VERSION_SCRIPT} $(OBJS) ${LD_SCRIPT} .endif .ifdef CHECK_LDSO ${CHECK_LDSO} $(candidate) -.endif -.ifndef CROSSDIR - ulimit -c 0; [ "`${.OBJDIR}/$(test_prog) ok`" = "${.OBJDIR}/$(test_prog): ok!" ] .endif cp $(candidate) $@ .endif @@ -113,10 +103,4 @@ CLEANFILES+= ld.so.a all: ld.so.a ld.so.a: ${OBJS} ${.CURDIR}/Symbols.map ${test_prog} ${LD_SCRIPT} - ar cqD $@ $? - -afterinstall: ld.so.a - install -d -o root -g wheel -m 755 \ - ${DESTDIR}/usr/share/relink/usr/libexec - install -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \ - ld.so.a ${DESTDIR}/usr/share/relink/usr/libexec/ld.so.a + $(AR) cqD $@ $?
pkgs/os-specific/bsd/openbsd/pkgs/rtld/package.nix 0 → 100644 +31 −0 Original line number Diff line number Diff line { lib, mkDerivation, }: mkDerivation { path = "libexec/ld.so"; extraPaths = [ "lib/libc/string" "lib/csu/os-note-elf.h" ]; patches = [ ./ldso-fix-makefile.patch ]; libcMinimal = true; NIX_CFLAGS_COMPILE = "-Wno-error"; # DESTDIR is overridden in bsdSetupHook, just fixup afterwards postInstall = '' mv $out/bin $out/libexec ''; outputs = [ "out" "man" ]; meta.platforms = lib.platforms.openbsd; }