lol

autoPatchelfHook: teach it to avoid objects created by separateDebugInfo

otherwise systemd fails to build because autoPatchelfHook patches libs
with debug objects and this creates circular dependencies from out to
debug (of course, debug depends on out)

example of faulty behavior:

searching for dependencies of /nix/store/c8cd7b82py02f0rkags351nhg82wwjm6-systemd-minimal-257.5/bin/systemd-delta
libsystemd-shared-257.so -> found: /nix/store/icpqrawjhsw4fbi4i2hp7cxvf3kbzq7m-systemd-minimal-257.5-debug/lib/debug
libc.so.6 -> found: /nix/store/7lyblga0bzjk0sl93vp4aiwbvb57vp2x-glibc-2.40-66/lib

+12
+1
pkgs/build-support/setup-hooks/auto-patchelf.sh
··· 95 95 if [[ -z "${dontAutoPatchelf-}" ]]; then 96 96 autoPatchelf -- $(for output in $(getAllOutputNames); do 97 97 [ -e "${!output}" ] || continue 98 + [ "${output}" = debug ] && continue 98 99 echo "${!output}" 99 100 done) 100 101 fi
+11
pkgs/by-name/au/auto-patchelf/source/auto-patchelf.py
··· 42 42 # section but their ELF type is DYN. 43 43 return bool(elf.get_section_by_name(".interp")) 44 44 45 + def is_separate_debug_object(elf: ELFFile) -> bool: 46 + # objects created by separateDebugInfo = true have all the section headers 47 + # of the unstripped objects but those that normal `strip` would have kept 48 + # are NOBITS 49 + text_section = elf.get_section_by_name(".text") 50 + return elf.has_dwarf_info() and bool(text_section) and text_section.header['sh_type'] == "SHT_NOBITS" 51 + 45 52 46 53 def get_dependencies(elf: ELFFile) -> list[list[Path]]: 47 54 dependencies = [] ··· 174 181 175 182 try: 176 183 with open_elf(path) as elf: 184 + if is_separate_debug_object(elf): 185 + print(f"skipping {path} because it looks like a separate debug object") 186 + continue 187 + 177 188 osabi = get_osabi(elf) 178 189 arch = get_arch(elf) 179 190 rpath = [Path(p) for p in get_rpath(elf)