!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

341 Members
105 Servers

Load older messages


SenderMessageTime
19 Aug 2023
@misuzu:matrix.orgmisuzu
% readelf -d $(where cat)

Dynamic section at offset 0x13b080 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libacl.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libattr.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.10]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/wah0xp4ani8b4l7d6hcjlb2lyiy2g83z-acl-2.3.1/lib:/nix/store/d0v43l0kfszyiq8ln9mgizg3yyp63p81-attr-2.5.1/lib:/nix/store/kh108jif43dm3yk6yxr9zmyskybcww3w-gmp-with-cxx-6.2.1/lib:/nix/store/z963s748p2pxlv91q3lsm7hx3m06h0a9-openssl-3.0.9/lib:/nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib]
 0x000000000000000c (INIT)               0x408000
 0x000000000000000d (FINI)               0x4dd814
 0x0000000000000019 (INIT_ARRAY)         0x531ff0
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x531ff8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000004 (HASH)               0x4003f8
 0x000000006ffffef5 (GNU_HASH)           0x400e98
 0x0000000000000005 (STRTAB)             0x4035e0
 0x0000000000000006 (SYMTAB)             0x400ef8
 0x000000000000000a (STRSZ)              5023 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x53c2d0
 0x0000000000000002 (PLTRELSZ)           9192 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4050d8
 0x0000000000000007 (RELA)               0x404e80
 0x0000000000000008 (RELASZ)             600 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x000000006ffffffe (VERNEED)            0x404cc0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x404980
 0x0000000000000000 (NULL)               0x0
05:40:41
@rhelmot:matrix.orgrhelmotthat is exactly what I needed to see, ty05:40:57
@trofi:matrix.orgtrofi

In Linux ld.so itself has a default directory it loads libc from:

$ ld.so --help
...
Shared library search path:
  (libraries located via /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/etc/ld.so.cache)
  /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (system search path)
  /nix/store/5cfwfnp4capzbjmkkrl7a6shvaghgj3h-xgcc-12.3.0-libgcc/lib (system search path)
07:25:41
@rhelmot:matrix.orgrhelmotI'll take a look later to see if it's possible to configure the freebsd interpreter to use a custom socache. in the meantime it's patchelf time07:27:03
@trofi:matrix.orgtrofi On NixOS ld.so.cache is not present. It uses /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (and other RUNPATHs) as a lookup (and it's not super-efficient). 07:28:17
@trofi:matrix.orgtrofi https://man.freebsd.org/cgi/man.cgi?query=ld.so&apropos=0&sektion=8&manpath=CentOS+7.1&arch=default&format=html hints that there are default like /lib:/usr/lib as well (unless -z nodeflib). Maybe you can set those as well. 07:29:45
@rhelmot:matrix.orgrhelmotthat page seems to be for the linux ld despite being hosted on freebsd.org07:30:47
@trofi:matrix.orgtrofiOh, yeah.07:31:10
@trofi:matrix.orgtrofi https://github.com/lattera/freebsd/blob/master/libexec/rtld-elf/rtld.c#L1430 . Maybe it's up to BSD's ld to populate the actual default? 07:34:30
@trofi:matrix.orgtrofi Aha, it uses STANDARD_LIBRARY_PATH there. 07:35:38
@trofi:matrix.orgtrofihttps://github.com/lattera/freebsd/blob/401a161083850a9a4ce916f37520c084cff1543b/libexec/rtld-elf/rtld.h#L5407:36:08
@rhelmot:matrix.orgrhelmotpogchamp07:36:36
@rhelmot:matrix.orgrhelmotanyone have any tips on debugging infinite recursion in the stdenv construction? I'm having trouble building bash. it seems like it's not using the bootstrap shell I provided as the stdenv's shell, it seems to be trying to build itself.09:34:08
@snektron:matrix.orgSnektronNew esmil kernel just dropped10:05:16
@snektron:matrix.orgSnektronAnd it looks like starfive finally added pci support in uboot 10:07:58
@trofi:matrix.orgtrofi stdenv/linux has a few debugging tips: https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L25C37-L25C37 10:09:04
@trofi:matrix.orgtrofi I guess it depends on how exactly you construct the stdenv. But generally one uses overlays to break the recursion and refer to already present dependencies from the previous stages of stdenv. 10:11:16
@trofi:matrix.orgtrofi

For example linux does it via steps like https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L412:

  (prevStage:
    stageFun prevStage {
    name = "bootstrap-stage2";
    # ...
    overrides = self: super: {
      inherit (prevStage)
        ccWrapperStdenv gettext
        gcc-unwrapped coreutils gnugrep
        perl gnum4 bison texinfo which;

Here perl and friends come from a previous instance of stdenv instead of being built normally.

10:13:32
@trofi:matrix.orgtrofi And initial seed is populated from "bootstrap-stage0" like coreutils = bootstrapTools; gnugrep = bootstrapTools;. 10:14:33
@misuzu:matrix.orgmisuzu
In reply to @snektron:matrix.org
And it looks like starfive finally added pci support in uboot
Upstream u-boot is broken though
13:03:47
@misuzu:matrix.orgmisuzuAnd nvme boot doesn't work out of the box13:04:09
@misuzu:matrix.orgmisuzuhttps://github.com/misuzu/u-boot/commits/visionfive2-usb13:04:14
@misuzu:matrix.orgmisuzuThis has https://patchwork.ozlabs.org/project/uboot/cover/20230814160404.9B2E067373@verein.lst.de/ and makes nvme work13:06:35
20 Aug 2023
@rhelmot:matrix.orgrhelmothow does the default set of hooks (?) in the cc-wrapper make sure that the built binaries have the right rpath and interpreter? it seems that the way I have it set right now, it has set the rpath correctly but not the interpreter.07:25:33
@rhelmot:matrix.orgrhelmot * how does the default set of hooks (?) in the cc-wrapper make sure that the built binaries have the right rpath and interpreter? it seems that the way I have it set right now, it has set the rpath correctly but not the interpreter, but I never actually configured this in any way.07:27:10
@trofi:matrix.orgtrofi

it's in ld-wrapper: pkgs/build-support/bintools-wrapper/ld-wrapper.sh:

        for path in "$dir"/*; do
            file="${path##*/}"
            if [ "${libs[$file]:-}" ]; then
                rpaths["$dir"]=1
                extraAfter+=(-rpath "$dir")
                break
            fi
        done
12:11:38
@trofi:matrix.orgtrofi It's simplistic description is to expand each -Lfoo into -Lfoo -rpath foo. 12:12:40
@trofi:matrix.orgtrofi

I believe dynamic linker is set inf a slightly different way: via nix-support/ld-set-dynamic-linker file indirection. From pkgs/build-support/bintools-wrapper/add-flags.sh:

if [ -z "$NIX_DYNAMIC_LINKER_@suffixSalt@" ] && [ -e @out@/nix-support/ld-set-dynamic-linker ]; then
    NIX_DYNAMIC_LINKER_@suffixSalt@="$(< @out@/nix-support/dynamic-linker)"
fi

and later in ld-wrapper: pkgs/build-support/bintools-wrapper/ld-wrapper.sh:

extraBefore+=("-dynamic-linker" "$NIX_DYNAMIC_LINKER_@suffixSalt@")
12:18:53
@zimbatm:numtide.comJonas Chevalier joined the room.13:07:46
@erremilia:matrix.org@erremilia:matrix.org joined the room.17:49:37

Show newer messages


Back to Room ListRoom Version: 6