mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
openbsd.rtld: init
rtld contains ld.so, the dynamic linker on OpenBSD. This package does not include related scripts (ldd and ldconfig), because they would create a dependency loop. rtld (run-time ld) is an os-agnostic term for dynamic linker. For simplicity, also link this into the libc symlinkJoin package
This commit is contained in:
parent
f5194c3579
commit
fcd62ad082
@ -1,11 +1,13 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoLibc,
|
||||
symlinkJoin,
|
||||
libcMinimal,
|
||||
librthread,
|
||||
libm,
|
||||
librpcsvc,
|
||||
libutil,
|
||||
rtld,
|
||||
version,
|
||||
}:
|
||||
|
||||
@ -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"
|
||||
|
@ -0,0 +1,57 @@
|
||||
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 $@ $?
|
31
pkgs/os-specific/bsd/openbsd/pkgs/rtld/package.nix
Normal file
31
pkgs/os-specific/bsd/openbsd/pkgs/rtld/package.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
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…
Reference in New Issue
Block a user