Commit Graph

558 Commits

Author SHA1 Message Date
Weijia Wang
3365511f02 openbsd: fix eval on riscv64-linux (#551100) 2026-08-17 11:56:37 +00:00
John Ericson
83cb487509 gcc/ng: build libgcc twice, once for the libc and once against it
The libc bootstrap had every stage except the last. `gccNoLibgcc` builds
libgcc, `gccWithLibgcc` builds the libc with it — and then nothing goes
back to rebuild libgcc now that the libc exists. So the only libgcc
anyone ever got was the one from before there was a libc, which is
necessarily single-threaded: `gthr-posix.h` includes `<pthread.h>`
unconditionally, and at that point there is no libc to provide it.
`libstdcxx` above it assumed `posix` regardless, so the two disagreed by
construction — the unwinder's registry locking compiled away to nothing
underneath a `libstdc++` handing out `std::thread`.

Add the last stage the way the LLVM package set does with
`compiler-rt-no-libc` and `compiler-rt-libc`: instantiate the same
package twice. `libgcc-no-libc` is the existing one and now feeds only
the three bootstrap compilers. `libgcc-libc` is built after the libc, by
a new `gccWithLibcAndBasicLibgcc` — real libc, bootstrap libgcc — and is
what `libgcc` resolves to for any platform that has a libc.

Nothing is passed to the package to say which of the two it is. The
distinction is the compiler it is handed, exactly as in the LLVM set:
`gccNoLibgcc` is wrapped with `binutilsNoLibc`, whose `libc` is
`preLibcHeaders` -- the header-only stand-in, or nothing at all on
platforms without one -- and `wrapCCWith` defaults a wrapper's `libc` to
its bintools'. So the package reads `stdenv.cc.libc` and needs no
bootstrap flag of its own.

Which threading model is available is a property of the libc, so the libc
declares it as `passthru.threadModel` and `libgcc` reads it from there.
That is what makes the pre-libc build single-threaded without being told
to be: a headers-only package declares no `threadModel`, a real libc
does.
`libstdcxx` in turn takes both the model and the generated
`gthr-default.h` from `libgcc`, replacing a `$CXX -v` probe that asked
the compiler — which in this package set is configured separately from
libgcc and so answers for the wrong component. Platforms that declare
nothing keep the single-threaded model they already had.

The second libgcc is also the first one that can be shared. Previously
only the static library was built, and the compiler was configured
`--disable-shared` for every target, which is compiled into the driver's
specs, so it named bare `-lgcc` and never `-lgcc_s`:

    $ x86_64-unknown-netbsd-g++ -### eh.cc
    collect2 ... -lstdc++ -lm -lgcc -lc -lgcc

Both halves have to move together. Build the shared library without
changing the specs and the unwinder leaves `libgcc.a` while the specs
still name it:

    libgcc.a         _Unwind_RaiseException: absent
    libgcc_eh.a      _Unwind_RaiseException: present
    libgcc_s.so.1    _Unwind_RaiseException: present

so every throwing C++ program fails to link and `rustc` fails on
`-lgcc_s` outright. Either standard arm would do, `-lgcc_s -lgcc` shared
or `-lgcc -lgcc_eh` static; the halves disagreeing is what breaks.

`--disable-shared` was passed to libgcc with the comment "Do not have
dynamic linker without libc". That does not hold: the monolithic build
ships `libgcc_s` even from its *nolibc* cross stage, and the result needs
nothing at run time --

    $ readelf -d .../nolibc-gcc-15.3.0-libgcc/.../libgcc_s.so.1
     0x...0e (SONAME)  Library soname: [libgcc_s.so.1]
    (no NEEDED entries at all)

What genuinely blocks it is libgcc's own makefile: `SHLIB_LC` defaults to
`-lc`, so the `libgcc_s.so` rule links against a libc that does not exist
yet and fails with `cannot find -lc`. The monolithic build clobbers that
variable -- see `common/libgcc-buildstuff.nix` -- so reuse that helper
rather than reinventing it. On the compiler side the flag derives from
`hasSharedLibraries`, as the monolithic build does, so a target genuinely
without shared libraries keeps the old behaviour; it is spelled
`enableTargetShared` there because it describes the target's libgcc
rather than anything about the compiler being built.

Verified on `x86_64-unknown-netbsd`, where `libgcc_s.so.1` and the
`GROUP ( libgcc_s.so.1 -lgcc )` script now appear in the output, and by
building `stdenv.cc` for `aarch64-unknown-linux-gnu` and
`aarch64-unknown-linux-musl`.

Assisted-by: Claude Code (Claude Opus 5)
2026-08-12 16:59:29 -04:00
liberodark
2743a20db7 openbsd: fix eval on riscv64-linux 2026-08-10 13:22:39 +02:00
jopejoe1
8adf0e4f23 freebsd.mkDerivation: fix meta when custom meta is set 2026-08-09 00:07:22 +02:00
Ben Siraphob
857a1c3a4f pkgs/os-specific: fix typos
Assisted-by: Claude Code (claude-opus-5)
2026-08-02 11:15:27 -07:00
Jo
134518cebe treewide: avoid using singleton lists for licenses (#535754) 2026-07-15 18:25:37 +00:00
Eman Resu
ff094f60ad treewide: replace more singleton license lists 2026-07-15 14:04:39 -04:00
Artemis Tosini
25a581579f freebsd: fix compile for aarch64-freebsd 2026-07-14 14:42:08 -04:00
Artemis Tosini
9ab1989aba freebsd: Build packages with compiler-rt 2026-07-14 14:42:04 -04:00
Artemis Tosini
a1a36bfe71 freebsd.libcompiler_rt: init 2026-07-14 14:42:01 -04:00
bin
c90576aecf openbsd: bump sources to 7.9 2026-06-23 10:10:24 -04:00
Sigmanificient
0bbc8dffae treewide: set meta.license on hooks 2026-05-25 13:48:20 +02:00
Artemis Tosini
a51a52d832 freebsd.iwlwifi-firmware: init 2026-03-06 14:44:02 -08:00
Artemis Tosini
b9565b5722 freebsd.uathload: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:22:30 -08:00
Artemis Tosini
b56107b27c freebsd.sort: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:21:59 -08:00
Artemis Tosini
e0935d9adc freebsd.service: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:21:14 -08:00
Artemis Tosini
d3b51e5057 freebsd.nvmecontrol: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:20:46 -08:00
Artemis Tosini
bbfb0d85c6 freebsd.logger: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:19:57 -08:00
Artemis Tosini
eb0481ea02 freebsd.libnvmf: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:19:08 -08:00
Artemis Tosini
9d28ad840d freebsd.freebsd_wordexp: init
wrapper script for a builtin

Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:18:16 -08:00
Artemis Tosini
541bd9e309 freebsd.env: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:17:17 -08:00
Artemis Tosini
faf6debc2c freebsd.devmatch: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:16:39 -08:00
Artemis Tosini
78b96fe36d freebsd.devctl: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:16:03 -08:00
Artemis Tosini
17d8804ebe freebsd.autofs: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:14:51 -08:00
Artemis Tosini
ac26dc7385 freebsd.wpa_supplicant: init
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:14:05 -08:00
Artemis Tosini
771090934f freebsd.rc: support bash, fix hardcoded paths
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:11:59 -08:00
Artemis Tosini
41e01ae7d5 freebsd.devd: build sound and acpi
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 13:10:57 -08:00
Artemis Tosini
4791b9919b freebsd.backlight: init 2026-03-06 12:14:04 -08:00
Artemis Tosini
a60bbb5290 freebsd.zzz: init 2026-03-06 12:14:02 -08:00
Artemis Tosini
7cc4f7f604 freebsd.apm: init 2026-03-06 12:13:59 -08:00
Artemis Tosini
18906f8598 freebsd.acpi: init 2026-03-06 12:13:57 -08:00
Audrey Dutcher
bb621257d2 freebsd.bsdfan: init 2026-03-06 12:13:54 -08:00
Audrey Dutcher
feb9df08ed freebsd.powerd: init 2026-03-06 12:13:52 -08:00
Artemis Tosini
97d5cf6833 freebsd.pciconf: install configuration files
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 12:13:50 -08:00
Artemis Tosini
356fcd58ba freebsd.lib80211: install configuration files
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 12:13:47 -08:00
Audrey Dutcher
9b1131ee60 freebsd.libc-conf: init 2026-03-06 12:13:45 -08:00
Audrey Dutcher
51e5a86ee8 freebsd.sockstat: init 2026-03-06 12:13:43 -08:00
Artemis Tosini
77d58ac0fc freebsd.zfsd: fix build
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 12:13:41 -08:00
Artemis Tosini
6f37b27b3b freebsd.libcam: fix build
Co-Authored-By: Audrey Dutcher <audrey@rhelmot.io>
2026-03-06 12:13:39 -08:00
Artemis Tosini
b21937d9cf freebsd.{drm-kmod,drm-kmod-firmware}: update 2026-02-20 11:29:26 -05:00
quantenzitrone
7d8132a92c treewide: remove references to the xorg namespace in pkgs (automated)
this creates some eval errors that will be fixed in the next commit

done with the following script:

```fish
\#!/usr/bin/env fish

set packagesjson (nix eval --impure --json --expr '
let
  lib = import ./lib;
in
import pkgs/servers/x11/xorg/default.nix (lib.mapAttrs (
  name: _:
  if name == "lib" then
    lib
  else if name == "config" then
    { allowAliases = false; }
  else
    name
) (__functionArgs (import pkgs/servers/x11/xorg/default.nix))) { }
' | jq)

set one (grep '^    [A-Za-z0-9_-]*$' pkgs/servers/x11/xorg/default.nix | string trim | string replace -r '$' Z | sort | string sub -e -1)
set two (grep '^  [A-Za-z0-9_-]* = [A-Za-z0-9_-]*;$' pkgs/servers/x11/xorg/default.nix | cut -d= -f1 | string trim | string replace -r '$' Z | sort | string sub -e -1)

for arg in $one $two
    set oname $arg
    set nname (echo $packagesjson | jq -r .$oname)

    if test $nname = null
        echo (set_color red)warn:(set_color normal) unknown package xorg.$oname >&2
        continue
    end

    echo $oname "->" $nname

    # replace basic xorg.$name references
    for file in (rg -F "xorg.$oname" --files-with-matches pkgs)
        # special cases
        sd -F "$oname = xorg.$oname;" "$nname = $nname;" $file

        # replace
        sd -F "xorg.$oname" "$nname" $file

        # fixup function arguments

        # prevent duplicate function args
        if grep -E " ($oname|$nname),\$" $file >/dev/null
            continue
        end

        if grep 'xorg\..' $file >/dev/null # case1: there is more so we can't just remove the function arg

            if grep ' xorg,$' $file >/dev/null
                sd ' xorg,$' " xorg,
                $nname," $file

            else if grep ' xorg ? .*,$' $file >/dev/null
                sd 'xorg( ? .*),$' "xorg\$1,
                $nname," $file

            else
                sd -F 'xorg,' "$nname,
                xorg," $file
            end

        else # case there is no more xorg..* so we can just replace the function arg
            sd 'xorg(| ? .*),.*$' "$nname," $file
        end
    end
end

nix fmt
```
2026-01-25 22:28:09 +01:00
Audrey Dutcher
ee10fb97d6 freebsd.libbsddialog: init 2025-12-19 21:01:23 -07:00
Felix Bühler
cda22db97c treewide: use pname and version (#460481) 2025-12-14 15:37:21 +00:00
Ihar Hrachyshka
567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00
Audrey Dutcher
0e8d351557 freebsd.libsysdecode: fix build for FreeBSD 15.0-RELEASE 2025-12-08 18:04:45 -07:00
Audrey Dutcher
a0611ad79b freebsd: format tree 2025-12-06 22:36:39 -07:00
Audrey Dutcher
e5516ab15c freebsd.libncurses-form: init 2025-12-06 22:27:32 -07:00
Audrey Dutcher
6f2ee4181e freebsd.drm-kmod: split debug output 2025-12-06 22:27:31 -07:00
Audrey Dutcher
5a93df11fb freebsd.sys: backport a patch to fix a bad compiler macro 2025-12-06 22:27:31 -07:00
Audrey Dutcher
9145da72f5 freebsd.tip: init 2025-12-06 22:27:31 -07:00